aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNik Nyby <nikolas@gnu.org>2015-01-17 17:12:36 -0500
committerNik Nyby <nikolas@gnu.org>2015-01-17 17:12:36 -0500
commitada88090ead2c3b9d0804794c5f20f9b24d1c2b1 (patch)
tree2838a7eee6c5d74094216acebd86915e0ea1de42
downloadlibrejsxul-ada88090ead2c3b9d0804794c5f20f9b24d1c2b1.tar.lz
librejsxul-ada88090ead2c3b9d0804794c5f20f9b24d1c2b1.tar.xz
librejsxul-ada88090ead2c3b9d0804794c5f20f9b24d1c2b1.zip
Import to new git repository
The old repository was using almost 100mb of space because of all the unnecessary files in the history. So I've imported the code to a new git repository. Unfortunately the history isn't viewable from this repository anymore. To see what happened with LibreJS before 2015, see the old Bazaar repo here: http://bzr.savannah.gnu.org/lh/librejs/
-rw-r--r--.gitignore17
-rw-r--r--COPYING674
-rw-r--r--ChangeLog158
-rw-r--r--Makefile.in109
-rw-r--r--README33
-rw-r--r--TODO1
-rw-r--r--configure.ac12
-rw-r--r--data/README2
-rw-r--r--data/assets/css/style.css191
-rw-r--r--data/assets/images/README21
-rw-r--r--data/assets/images/complain-button3.pngbin0 -> 8958 bytes
-rw-r--r--data/assets/images/complain.pngbin0 -> 1206 bytes
-rw-r--r--data/assets/images/info-title.pngbin0 -> 4310 bytes
-rw-r--r--data/assets/images/separator.pngbin0 -> 279 bytes
-rw-r--r--data/assets/images/torchy2.pngbin0 -> 273 bytes
-rw-r--r--data/chrome_worker/parser/jsdefs.js751
-rw-r--r--data/chrome_worker/parser/jslex.js719
-rw-r--r--data/chrome_worker/parser/jsparse.js2042
-rw-r--r--data/chrome_worker/parser/parse.js55
-rw-r--r--data/complain/contact_finder.js434
-rw-r--r--data/complain/contact_regex.js98
-rw-r--r--data/complain/link_types.js42
-rw-r--r--data/complain/pagemod_finder.js348
-rw-r--r--data/complain/worker_finder.js35
-rw-r--r--data/display_panel/content/README21
-rw-r--r--data/display_panel/content/background-panel.pngbin0 -> 14814 bytes
-rw-r--r--data/display_panel/content/display-panel.html65
-rw-r--r--data/display_panel/content/librejs-title-old.pngbin0 -> 2673 bytes
-rw-r--r--data/display_panel/content/librejs-title.pngbin0 -> 14123 bytes
-rw-r--r--data/display_panel/content/panel-styles.css193
-rw-r--r--data/display_panel/main_panel.js381
-rw-r--r--data/images/gnu-icon-white.icobin0 -> 4286 bytes
-rw-r--r--data/images/gnu-icon.icobin0 -> 4286 bytes
-rw-r--r--data/images/gnu-icon.pngbin0 -> 2667 bytes
-rw-r--r--data/librejs-settings.html23
-rw-r--r--data/licenses/Boost-1.0.txt23
-rw-r--r--data/licenses/ISC.txt12
-rw-r--r--data/licenses/IntelACPI.txt116
-rw-r--r--data/licenses/agpl-3.0.txt661
-rw-r--r--data/licenses/apache-2.0.txt202
-rw-r--r--data/licenses/artistic-2.0.txt201
-rw-r--r--data/licenses/bsd-3-clause.txt27
-rw-r--r--data/licenses/cc0.txt118
-rw-r--r--data/licenses/clear-bsd.txt33
-rw-r--r--data/licenses/cpal-1.0.txt105
-rwxr-xr-xdata/licenses/create-magnets.sh28
-rw-r--r--data/licenses/epl-1.0.txt231
-rw-r--r--data/licenses/expat.txt5
-rw-r--r--data/licenses/freebsd.txt25
-rw-r--r--data/licenses/gpl-2.0.txt339
-rw-r--r--data/licenses/gpl-3.0.txt674
-rw-r--r--data/licenses/illinois-NCSA.txt24
-rw-r--r--data/licenses/imlib2.txt31
-rw-r--r--data/licenses/lgpl-2.0.txt481
-rw-r--r--data/licenses/lgpl-2.1.txt502
-rw-r--r--data/licenses/lgpl-3.0.txt165
-rw-r--r--data/licenses/magnet-links.txt28
-rw-r--r--data/licenses/mpl-2.0.txt373
-rw-r--r--data/licenses/public-domain.txt18
-rw-r--r--data/licenses/torrents/Boost-1.0.txt.torrent2
-rw-r--r--data/licenses/torrents/ISC.txt.torrent1
-rw-r--r--data/licenses/torrents/IntelACPI.txt.torrent1
-rw-r--r--data/licenses/torrents/agpl-3.0.txt.torrent1
-rw-r--r--data/licenses/torrents/apache-2.0.txt.torrent1
-rw-r--r--data/licenses/torrents/artistic-2.0.txt.torrentbin0 -> 200 bytes
-rw-r--r--data/licenses/torrents/bsd-3-clause.txt.torrent1
-rw-r--r--data/licenses/torrents/cc0.txt.torrent1
-rw-r--r--data/licenses/torrents/clear-bsd.txt.torrent1
-rw-r--r--data/licenses/torrents/cpal-1.0.txt.torrent1
-rw-r--r--data/licenses/torrents/expat.txt.torrent1
-rw-r--r--data/licenses/torrents/freebsd.txt.torrent1
-rw-r--r--data/licenses/torrents/gpl-2.0.txt.torrent1
-rw-r--r--data/licenses/torrents/gpl-3.0.txt.torrent1
-rw-r--r--data/licenses/torrents/illinois-NCSA.txt.torrent1
-rw-r--r--data/licenses/torrents/imlib2.txt.torrent1
-rw-r--r--data/licenses/torrents/lgpl-2.0.txt.torrent1
-rw-r--r--data/licenses/torrents/lgpl-2.1.txt.torrent1
-rw-r--r--data/licenses/torrents/lgpl-3.0.txt.torrent2
-rw-r--r--data/licenses/torrents/magnet-links.txt.torrentbin0 -> 200 bytes
-rw-r--r--data/licenses/torrents/mpl-2.0.txt.torrent1
-rw-r--r--data/licenses/torrents/public-domain.txt.torrent1
-rw-r--r--data/licenses/torrents/unlicense.txt.torrent1
-rw-r--r--data/licenses/torrents/wtfpl.txt.torrent1
-rw-r--r--data/licenses/torrents/x11.txt.torrent1
-rw-r--r--data/licenses/torrents/xfree86.txt.torrent1
-rw-r--r--data/licenses/unlicense.txt25
-rw-r--r--data/licenses/wtfpl.txt11
-rw-r--r--data/licenses/x11.txt26
-rw-r--r--data/licenses/xfree86.txt43
-rw-r--r--data/loading/loader.gifbin0 -> 8787 bytes
-rw-r--r--data/loading/loading-panel.html31
-rw-r--r--data/preferences_panel/contentscript.js67
-rw-r--r--data/preferences_panel/preferences_panel.html71
-rw-r--r--data/script_detector/script_detector.js359
-rwxr-xr-xdata/script_libraries/gethash.sh24
-rw-r--r--data/script_libraries/script-libraries.json1511
-rw-r--r--data/settings/images/button-download.pngbin0 -> 3426 bytes
-rw-r--r--data/settings/images/libre.pngbin0 -> 19048 bytes
-rw-r--r--data/settings/images/logo-medium.pngbin0 -> 11050 bytes
-rw-r--r--data/settings/index.html113
-rw-r--r--data/settings/js/form-row.js118
-rw-r--r--data/settings/js/form-types.js145
-rw-r--r--data/settings/js/pagescript-emitter.js14
-rw-r--r--data/settings/js/pagescript-listener.js51
-rw-r--r--data/settings/js/permafrost-info-box.js21
-rw-r--r--data/settings/styles/form.css33
-rw-r--r--data/settings/styles/styles.css130
-rw-r--r--data/settings/third-party/bootstrap/css/bootstrap.min.css5
-rw-r--r--data/settings/third-party/jquery/jquery.min.js4
-rw-r--r--data/widget/images/README21
-rw-r--r--data/widget/images/librejs-32.pngbin0 -> 1011 bytes
-rw-r--r--data/widget/images/librejs-64.pngbin0 -> 1604 bytes
-rw-r--r--data/widget/images/librejs-off.pngbin0 -> 498 bytes
-rw-r--r--data/widget/images/librejs.pngbin0 -> 503 bytes
-rw-r--r--doc/fdl.texi506
-rw-r--r--doc/librejs.info1243
-rw-r--r--doc/librejs.texi878
-rw-r--r--doc/manual/html_node/Disclaimer.html89
-rw-r--r--doc/manual/html_node/Free-Licenses-Detection.html249
-rw-r--r--doc/manual/html_node/GNU-Free-Documentation-License.html551
-rw-r--r--doc/manual/html_node/How-to-Use.html160
-rw-r--r--doc/manual/html_node/Installation-Requirements.html132
-rw-r--r--doc/manual/html_node/Installation.html105
-rw-r--r--doc/manual/html_node/JavaScript-Detection.html165
-rw-r--r--doc/manual/html_node/LibreJS-Internals.html94
-rw-r--r--doc/manual/html_node/Overview.html93
-rw-r--r--doc/manual/html_node/Setting-Your-JavaScript-Free.html239
-rw-r--r--doc/manual/html_node/Tests.html160
-rw-r--r--doc/manual/html_node/index.html159
-rw-r--r--doc/manual/index.html73
-rw-r--r--doc/manual/librejs.dvi.gzbin0 -> 31485 bytes
-rw-r--r--doc/manual/librejs.html1419
-rw-r--r--doc/manual/librejs.html.gzbin0 -> 20533 bytes
-rw-r--r--doc/manual/librejs.html_node.tar.gzbin0 -> 22368 bytes
-rw-r--r--doc/manual/librejs.info.tar.gzbin0 -> 18558 bytes
-rw-r--r--doc/manual/librejs.pdfbin0 -> 203465 bytes
-rw-r--r--doc/manual/librejs.texi.tar.gzbin0 -> 18301 bytes
-rw-r--r--doc/manual/librejs.txt1181
-rw-r--r--doc/manual/librejs.txt.gzbin0 -> 17601 bytes
-rw-r--r--doc/version.texi4
-rw-r--r--install-sh527
-rw-r--r--lib/addon_management/install_uninstall.js65
-rw-r--r--lib/addon_management/prefchange.js124
-rw-r--r--lib/html_script_finder/bug_fix.js23
-rw-r--r--lib/html_script_finder/dom_handler.js571
-rw-r--r--lib/html_script_finder/dom_handler/attributes.js137
-rw-r--r--lib/html_script_finder/dom_handler/dom_checker.js478
-rw-r--r--lib/html_script_finder/dom_handler/dom_gatherer.js281
-rw-r--r--lib/html_script_finder/dom_handler/request.js115
-rw-r--r--lib/html_script_finder/dom_handler/script_object.js208
-rw-r--r--lib/html_script_finder/dom_handler/script_properties.js43
-rw-r--r--lib/html_script_finder/html_parser.js158
-rw-r--r--lib/html_script_finder/url_seen_tester.js78
-rw-r--r--lib/html_script_finder/web_labels/find_js_labels.js131
-rw-r--r--lib/html_script_finder/web_labels/js_web_labels.js279
-rw-r--r--lib/html_script_finder/web_labels/script_hash_worker.js62
-rw-r--r--lib/http_observer/allowed_referrers.js67
-rw-r--r--lib/http_observer/caching.js30
-rw-r--r--lib/http_observer/http_request_observer.js146
-rw-r--r--lib/http_observer/process_response.js429
-rw-r--r--lib/http_observer/stream_loader.js111
-rw-r--r--lib/js_checker/constant_types.js190
-rw-r--r--lib/js_checker/free_checker.js231
-rw-r--r--lib/js_checker/js_checker.js518
-rw-r--r--lib/js_checker/license_definitions.js249
-rw-r--r--lib/js_checker/nontrivial_checker.js374
-rw-r--r--lib/js_checker/pattern_utils.js40
-rw-r--r--lib/js_checker/privacy_checker.js44
-rw-r--r--lib/js_checker/privacy_threat_definitions.js52
-rw-r--r--lib/js_checker/relation_checker.js289
-rw-r--r--lib/js_load_observer/js_load_observer.js143
-rw-r--r--lib/main.js70
-rw-r--r--lib/parser/narcissus_worker.js79
-rw-r--r--lib/pref_observer/pref_observer.js71
-rw-r--r--lib/preferences/preferences.js72
-rw-r--r--lib/script_entries/accepted_scripts.js67
-rw-r--r--lib/script_entries/all_scripts.js108
-rw-r--r--lib/script_entries/crypto.js60
-rw-r--r--lib/script_entries/dryrun_scripts.js76
-rw-r--r--lib/script_entries/free_libraries.js65
-rw-r--r--lib/script_entries/removed_scripts.js71
-rw-r--r--lib/script_entries/scripts_cache.js189
-rw-r--r--lib/settings/settings.js0
-rw-r--r--lib/settings/settings_tab.js78
-rw-r--r--lib/settings/storage.js175
-rw-r--r--lib/ui.js186
-rw-r--r--lib/ui/notification.js76
-rw-r--r--lib/ui/script_panel.js73
-rw-r--r--lib/ui/ui_info.js202
-rw-r--r--lib/url_handler/node_punycode.js510
-rw-r--r--lib/url_handler/node_querystring.js213
-rw-r--r--lib/url_handler/node_url.js691
-rw-r--r--lib/url_handler/url_handler.js114
-rw-r--r--missing330
-rw-r--r--package.json68
-rw-r--r--packages/menuitems/README.md3
-rw-r--r--packages/menuitems/docs/menuitems.md66
-rw-r--r--packages/menuitems/lib/menuitems.js195
-rw-r--r--packages/menuitems/package.json9
-rw-r--r--packages/menuitems/tests/test-menuitems.js171
-rw-r--r--packages/notificationbox/LICENSE373
-rw-r--r--packages/notificationbox/README.md5
-rw-r--r--packages/notificationbox/data/gnu-icon.pngbin0 -> 2344 bytes
-rw-r--r--packages/notificationbox/doc/images/critical-notification.pngbin0 -> 25113 bytes
-rw-r--r--packages/notificationbox/doc/images/info-low-priority.pngbin0 -> 23498 bytes
-rw-r--r--packages/notificationbox/doc/main.md46
-rw-r--r--packages/notificationbox/lib/main.js16
-rw-r--r--packages/notificationbox/lib/notification-box.js129
-rw-r--r--packages/notificationbox/package.json9
-rw-r--r--packages/notificationbox/test/test-main.js12
-rw-r--r--packages/vold-utils/README.md5
-rw-r--r--packages/vold-utils/docs/listen.md23
-rw-r--r--packages/vold-utils/docs/unload+.md20
-rw-r--r--packages/vold-utils/lib/array.js6
-rw-r--r--packages/vold-utils/lib/instances.js57
-rw-r--r--packages/vold-utils/lib/listen.js29
-rw-r--r--packages/vold-utils/lib/memoize.js131
-rw-r--r--packages/vold-utils/lib/net-utils.js3
-rw-r--r--packages/vold-utils/lib/services.js84
-rw-r--r--packages/vold-utils/lib/unload+.js80
-rw-r--r--packages/vold-utils/lib/window-watcher.js91
-rw-r--r--packages/vold-utils/lib/xpcom-utils.js3
-rw-r--r--packages/vold-utils/package.json7
-rw-r--r--packages/vold-utils/tests/test-unload+.js119
-rw-r--r--test.sh3
-rw-r--r--test/mock/long_string.js22
-rw-r--r--test/mock/mock_dom.js87
-rw-r--r--test/mock/mock_licenses.js26
-rw-r--r--test/mock/mock_nodes.js814
-rw-r--r--test/mock/mock_nodes_with_comments.js187
-rw-r--r--test/mock/realHtml.html226
-rw-r--r--test/test-accepted_scripts.js64
-rw-r--r--test/test-all_scripts.js39
-rw-r--r--test/test-allowed_referrers.js54
-rw-r--r--test/test-bug-frozen.js44
-rw-r--r--test/test-contact_finder.js214
-rw-r--r--test/test-contact_finder2.js88
-rw-r--r--test/test-cors-bug.js60
-rw-r--r--test/test-crypto-a.js43
-rw-r--r--test/test-crypto-b.js357
-rw-r--r--test/test-domHandler.js71
-rw-r--r--test/test-domParser.js36
-rw-r--r--test/test-free_libraries.js56
-rw-r--r--test/test-html_parser.js43
-rw-r--r--test/test-js_checker.js119
-rw-r--r--test/test-js_load_observer_1.js75
-rw-r--r--test/test-js_load_observer_3.js146
-rw-r--r--test/test-license_definitions.js46
-rw-r--r--test/test-narcissus_worker.js73
-rw-r--r--test/test-nonfree_checker.js101
-rw-r--r--test/test-nontrivial_checker.js180
-rw-r--r--test/test-privacy_checker.js55
-rw-r--r--test/test-relation_checker.js68
-rw-r--r--test/test-removed_scripts.js67
-rw-r--r--test/test-request.js102
-rw-r--r--test/test-script_detector.js49
-rw-r--r--test/test-script_object.js50
-rw-r--r--test/test-script_properties.js29
-rw-r--r--test/test-stream_loader.js35
-rw-r--r--test/test-ui_info.js42
-rw-r--r--test/test-url_handler.js78
-rw-r--r--test/test-web-label-finder.js195
-rw-r--r--test/test-web-labels.js42
-rw-r--r--test/test-windowProperty.js34
-rw-r--r--test/webpages/test-labels/index.html36
-rw-r--r--test/webpages/test-labels/js-licenses.html45
-rw-r--r--tools/library-fetch-tools/LICENSE24
-rw-r--r--tools/library-fetch-tools/build_whitelist.py42
-rw-r--r--tools/library-fetch-tools/jslibfetcher.py190
-rw-r--r--tools/library-fetch-tools/list-of-js-for-testing.html337
-rw-r--r--tools/library-fetch-tools/whitelist_hashes.txt306
271 files changed, 37825 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4626e16
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+*.cache
+*.log
+configure
+config.status
+gendocs_template
+librejs.aux
+librejs.cp
+librejs.cps
+librejs.fn
+librejs.ky
+librejs.log
+librejs.pg
+librejs.toc
+librejs.tp
+librejs.vr
+*.xpi
+Makefile
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..38d9f17
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,158 @@
+2015-01-17 Nik Nyby <nikolas@gnu.org>
+ * Include the Eclipse Public License in license definitions.
+ Thanks to Daniel Ziltener for the patch.
+
+2014-12-06 Nik Nyby <nikolas@gnu.org>
+ * You can now specify multiple licenses for a JavaScript file
+ that's been compiled or concatenated from more than one source
+ file. Info on how to do this is in the manual - search for
+ "Specifying multiple licenses". Thanks to Arne Möhle for
+ starting a discussion that led to this change.
+
+2014-12-06 Nik Nyby <nikolas@gnu.org>
+ * You can now move the "Complain" button out of the way if it's
+ blocking something on the website you're looking at. Thanks to
+ Alexandre Garreau for pointing out this problem.
+
+2014-12-01 Nik Nyby <nikolas@gnu.org>
+ * Applied a patch from Lutz Horn: updating the whitelisted
+ scripts to include some more libraries, and improving the
+ gethash.sh script.
+
+2014-11-30 Nik Nyby <nikolas@gnu.org>
+ * Add support for using the BSD 3-Clause license in a JavaScript
+ Web Labels table. Thanks to Enoch Root for pointing out that this
+ wasn't working.
+ * Add a "Web Labels pages being used for this session" list on
+ the main display panel.
+
+2014-11-20 Nik Nyby <nikolas@gnu.org>
+ * Recognize the JS Web Labels link with data-jslicense=1, as
+ well as rel="jslicense", in case you want the page to be
+ HTML5-valid. Savannah ticket #13366. Thanks to Marco Bresciani
+ for bringing this up.
+ * Fixed a bug on the whitelist page (Tools -> LibreJS) where
+ the "Reset whitelist to default" button wasn't working.
+
+2014-11-10 Nik Nyby <nikolas@gnu.org>
+ * LibreJS now works in private browsing mode, and with Tor.
+ * The complaint email's default subject and body are now
+ configurable.
+
+2014-11-03 Nik Nyby <nikolas@gnu.org>
+ * Fix a bug where the complain button on the main LibreJS panel
+ would never appear.
+
+2014-10-26 Nik Nyby <nikolas@gnu.org>
+ * Fixed bug #43403 - LibreJS was marking all scripts as nonfree
+ if the page returned a 404 status code. Thanks to Rubén
+ Rodríguez for reporting this.
+
+2014-10-25 Nik Nyby <nikolas@gnu.org>
+ * Fixed a bug where some sites would hang until you reload them.
+ Savannah bug #43466
+
+2014-10-24 Nik Nyby <nikolas@gnu.org>
+ * Fixed a bug where the complaint box would sometimes get
+ mis-rendered.
+
+2014-10-22 Nik Nyby <nikolas@gnu.org>
+ * Removed dependency to addon-tab library.
+
+ * Updated node.js libraries for url_handler to node v0.10.33.
+
+2014-10-20 Nik Nyby <nikolas@gnu.org>
+ * Disable JS analysis when JavaScript is turned off in the
+ browser.
+
+2014-08-28 Nik Nyby <nikolas@gnu.org>
+ * Updated Google Analytics regex, and added tests for this.
+
+2014-08-23 Nik Nyby <nikolas@gnu.org>
+ * Fixed a bug on pages with lots of embedded onclick= script
+ attributes.
+
+ * Fixed whitelisting table not loading any whitelisted scripts.
+
+2012-11-25 Loic J. Duros <lduros@gnu.org>
+ * Accepted scripts are displayed at the top of the main panel by
+ default. This allows LibreJS to emphasize those scripts that are
+ allowed, this list being usually shorter than those that are
+ blocked.
+
+ * The script list in the main panel is generated when clicking on
+ the addon toolbar widget instead of at load time. This allows to
+ display those scripts that are embedded dynamically after a
+ certain amount of time (such as with setTimeout and with
+ asynchronous function calls.)
+
+ * A <th> element (table header) in the JS Web Labels table would
+ throw an exception and prevent the JavaScript files from being
+ flagged as free when applicable. (Thanks to Mark Burdett for
+ reporting this issue.)
+
+2012-11-14 Loic J. Duros <lduros@gnu.org>
+ * Fixed issue with JS Web Labels when a Facebook iFrame was found
+ in the JS Web Labels page. (It would prevent page from loading.)
+
+2012-11-06 Loic J. Duros <lduros@gnu.org>
+ * Fixed issue with missing third column in JS Web Labels reported
+ by Mark Burdett. This bug would lead a page to never render if a
+ column was missing from the JS Web Labels table.
+
+ * Now ignoring the fragment part from the canonical URL of
+ licenses. This issue was reported by Nicolas Cesar with the
+ XFree86 URL.
+
+ * More than one canonical URL can now be added to the license
+ definitions, as it is now the case with the XFree86 license that
+ links to both http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3 and
+ the new url http://www.xfree86.org/current/LICENSE4.html that is
+ now commonly used.
+
+ * Packaged with the Addon SDK version 1.11.
+
+ * New and improved scripts for configure and make have been
+ provided by Brandon Invergo.
+
+2012-10-31 Loic J. Duros <lduros@gnu.org>
+ * Fixed character encoding issues with koi8-r and many other
+ encoding problems.
+ * Fixed issue with about:home and about:startpage, which was
+ crashing IceCat/Firefox when visiting the page while LibreJS was
+ enabled.
+ * Now using DOMParser instead of the XUL hidden iframe.
+ * Now using nsIDocumentEncoder instead of the innerHTML hack and
+ the DOMserializer.
+ * Updated list of free JavaScript libraries from 275 versions to
+ 306 versions.
+
+2012-07-04 Loic J. Duros <lduros@gnu.org>
+ * Bug fix with character encoding of certain pages.
+ * Bug fix with <body> contents which were not parsed properly for
+ certain pages (like article page on money.cnn.com)
+ * Updated list of free libraries.
+
+2012-06-04 Loic J. Duros <lduros@gnu.org>
+ * Try catch clause for request module convert to unicode.
+ This should fix the gimp.org bug.
+
+2012-05-24 Loic J. Duros lduros@gnu.org
+
+ * Fixed a bug which would block an inline script detected as free
+ under certain circumstances.
+
+ * GNU LibreJS now detects 256 official versions of free libraries
+ using their SHA1 hash, and accepts them as free.
+
+ * Replaced the use of XHR (nsIXMLHttpRequest component) with a new
+ module that creates a channel and listens for the data
+ reception. This makes LibreJS compatible with Https-Everywhere,
+ which ships with IceCat.
+
+ * Now keeps in memory the list of JavaScript files that were
+ listed in a JS Web Labels table. This enables adding scripts that
+ are embedded dynamically to a JS Web Labels table.
+
+ * Escaped a stylesheet variable in complaint feature (per AMO's
+ request)
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..c7c9986
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,109 @@
+# GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+#
+# Copyright (C) 2011, 2012, 2014 Loic J. Duros
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SHELL := /bin/bash
+
+DESTDIR =
+ADDON_SDK = /opt/addon-sdk
+srcdir = @srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+bindir = @bindir@
+datarootdir = @datarootdir@
+datadir = @datadir@
+infodir = @infodir@
+htmldir= = @htmldir@
+dvidir = @dvidir@
+pdfdir = @pdfdir@
+psdir = @psdir@
+apphash = {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+extdir = ${libdir}/mozilla/extensions/${exthash}
+
+MAKEINFO = @MAKEINFO@
+TEXI2HTML = $(MAKEINFO) --no-split --html
+TEXI2ANY = @TEXI2ANY@
+TEXI2DVI = @TEXI2DVI@
+TEXI2PDF = @TEXI2PDF@
+INSTALL = @INSTALL@
+INSTALL_DATA = ${INSTALL} -m644 -D
+INSTALL_MSG = "\
+Depending on your version of the Mozilla-browser, if LibreJS is not \
+enabled already, you may, inside your Mozilla-browser, need to go in \
+the menu in Tools > Add-ons and click enable where you see LibreJS. \
+"
+
+CFX_ARGS =
+
+all: xpi
+
+install: xpi info
+ $(NORMAL_INSTALL)
+ $(INSTALL_DATA) librejs.xpi $(DESTDIR)$(extdir)/jid1-KtlZuoiikVfFew@jetpack.xpi
+ $(POST_INSTALL)
+ -if test -f doc/librejs.info; then d=.; \
+ else d=$(srcdir); fi; \
+ $(INSTALL_DATA) $$d/doc/librejs.info $(DESTDIR)$(infodir)/librejs.info; \
+ if $(SHELL) -c 'install-info --version' \
+ >/dev/null 2>&1; then \
+ install-info --dir-file=$(DESTDIR)$(infodir)/dir \
+ $(DESTDIR)$(infodir)/librejs.info; \
+ else true; fi
+ @echo $(INSTALL_MSG)
+
+install-pdf: pdf
+ $(INSTALL_DATA) $(srcdir)/doc/librejs.pdf $(pdfdir)
+
+install-dvi: dvi
+ $(INSTALL_DATA) $(srcdir)/doc/librejs.dvi $(dvidir)
+
+install-html: html
+ $(INSTALL_DATA) $(srcdir)/doc/librejs.html $(htmldir)
+
+uninstall:
+ @rm $(DESTDIR)$(extdir)/jid1-KtlZuoiikVfFew@jetpack.xpi
+ @rm -rf $(DESTDIR)$(extdir)
+
+clean:
+ @rm -f librejs.xpi
+
+distclean: clean
+ @rm -rf autom4te.cache
+ @rm -f config.log
+ @rm -f config.status
+ @rm -f $(srcdir)/doc/librejs.info
+ @rm -f $(srcdir)/doc/manual/librejs.html
+ @rm -f $(srcdir)/doc/manual/librejs.html.gz
+ @rm -f $(srcdir)/doc/manual/librejs.pdf
+ @rm -f $(srcdir)/doc/manual/librejs.dvi
+ @rm -f $(srcdir)/doc/manual/librejs.dvi.gz
+ @rm -f $(srcdir)/doc/manual/librejs.txt
+ @rm -f $(srcdir)/doc/manual/librejs.txt.gz
+
+dist:
+
+info: doc/librejs.info
+ cd doc && gendocs.sh --email bug-librejs@gnu.org librejs "GNU LibreJS Manual"
+
+xpi: librejs.xpi
+
+librejs.xpi:
+ cd $(ADDON_SDK) && source bin/activate && cd - && cfx $(CFX_ARGS) xpi
+
+.PHONY: all install install-pdf install-dvi install-html uninstall clean \
+ distclean info pdf dvi html xpi txt
diff --git a/README b/README
new file mode 100644
index 0000000..6cd5131
--- /dev/null
+++ b/README
@@ -0,0 +1,33 @@
+GNU LibreJS --an add-on for GNU IceCat and Mozilla Firefox-- detects and
+blocks nonfree nontrivial JavaScript while allowing its execution on
+pages containing code that is either trivial and/or free.
+
+
+Notes on working with the code
+-------------------------------
+== Running the addon ==
+Download Mozilla's Add-on SDK, then do something like this in the LibreJS
+directory:
+
+ cfx run -b `which icecat`
+
+== Testing ==
+Run all tests:
+ cfx test -v -b `which icecat`
+
+Run a single test file:
+ cfx test -v -b `which icecat` -f test-accepted_scripts
+
+== Debugging ==
+Uncomment lines 22 and 23 in lib/main.js to enable printing of
+console.debug() statements.
+
+== Releasing a new version ==
+* Update version number in:
+** configure.ac
+** package.json
+** doc/version.texi
+* Then run `make info` to build the docs with gendocs.sh
+* `bzr commit` and `bzr tag 6.0.4`
+* Export a tarball: bzr export ~/releases/librejs-6.0.4/librejs-6.0.4.tar.gz
+* Make xpi file: cfx xpi --strip-sdk; mv librejs.xpi librejs-6.0.4.xpi
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..f1accdf
--- /dev/null
+++ b/TODO
@@ -0,0 +1 @@
+* Localization. Currently nothing is supported except English for any string.
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..404f2fa
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,12 @@
+AC_INIT(librejs, 6.0.8.20150117, [bug-librejs@gnu.org])
+
+AC_PROG_INSTALL
+AC_PATH_PROG([MAKEINFO], makeinfo)
+AC_PATH_PROG([TEXI2ANY], texi2any)
+AC_PATH_PROG([TEXI2DVI], texi2dvi)
+AC_PATH_PROG([TEXI2PDF], texi2pdf)
+AC_ARG_VAR([ADDON_SDK], [location of the Mozilla addon-sdk (default=/opt/addon-sdk)])
+AC_ARG_VAR([CFX_ARGS], [build arguments to pass to cfx])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/data/README b/data/README
new file mode 100644
index 0000000..6633b5e
--- /dev/null
+++ b/data/README
@@ -0,0 +1,2 @@
+The stylesheets, HTML files, and images provided in this folder and
+its subfolders are released under the GPL version 3 or later. \ No newline at end of file
diff --git a/data/assets/css/style.css b/data/assets/css/style.css
new file mode 100644
index 0000000..23cf324
--- /dev/null
+++ b/data/assets/css/style.css
@@ -0,0 +1,191 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+
+
+
+*/
+/* quick reset for box and children */
+#librejs-complaint-box,
+#librejs-complaint-box *,
+#librejs-complaint-box a:hover,
+#librejs-complaint-box a:active,
+#librejs-complaint-box a:visited,
+#librejs-time-mention,
+#librejs-time-mention:hover {
+ margin:0;
+ padding:0;
+ line-height:1;
+ list-style:square;
+ color:#000;
+ text-align:left;
+ border:0;
+ content: '';
+ font-style:normal;
+ font-weight:normal;
+ font-size:12px;
+ text-decoration:none;
+ font-variant:normal;
+ font-family: sans-serif !important;
+ text-shadow: none !important;
+ text-transform: none;
+ background-image:none;
+ background-color:transparent;
+}
+
+#librejs-time-mention, #librejs-time-mention:hover {
+ font-size:14px;
+ font-weight:bold;
+ text-align:center;
+}
+
+#librejs-complaint-box, #librejs-complaint-box * {
+ box-sizing: content-box;
+ width: auto;
+}
+
+div {
+ width:auto;
+}
+
+#librejs-tab-button {
+ cursor: move;
+ opacity: 0.6;
+ display: block;
+ width: 18px;
+
+ padding-top: 16px;
+ padding-bottom: 16px;
+ padding-left: 20px;
+
+ background-color: #e3dedb !important;
+ border: solid #454545 1px !important;
+ border-right:none !important;
+ overflow: hidden;
+ border-top-left-radius:20px !important;
+ border-bottom-left-radius:20px !important;
+ float:left;
+ z-index:50;
+ position: relative;
+
+ top: 40px;
+}
+
+#librejs-tab-button:hover {
+ opacity: 1;
+}
+
+#librejs-tab-button .librejs-complain-button {
+ height: 93px;
+ width: 20px;
+ margin-left: -10px;
+ background-image: url('../images/complain.png');
+ background-repeat: no-repeat;
+}
+
+#librejs-tab-button .librejs-complain-separator {
+ width: 18px;
+ height: 88px;
+ position: absolute;
+ top: 36px;
+ left: 46px;
+ background-image: url("../images/separator.png") !important;
+ background-repeat: no-repeat !important;
+}
+
+#librejs-complaint-box {
+ position: fixed;
+ z-index: 2147483647 !important; /* fix for tech crunch big number */
+ right: -465px;
+ display: none;
+}
+
+#librejs-complaint-info {
+ border: solid #454545 1px;
+ background-color:#e3dedb !important;
+ width:460px !important;
+ border-top-left-radius: 10px;
+ z-index:0;
+ text-align:center;
+ position: relative;
+ margin-left: 38px !important;
+ margin-top: 40px;
+}
+
+#librejs-complaint-info .librejs-hide-button {
+ cursor: pointer;
+ font-size: 24px;
+ float: left;
+ margin-top: 6px;
+ margin-left: 8px;
+}
+
+#librejs-complaint-info .librejs-hide-button:hover {
+ font-weight: bold;
+}
+
+#librejs-complaint-info:hover {
+ background-color:#e3dedb !important;
+}
+
+#librejs-complaint-info-text {
+ overflow: auto;
+ height: auto;
+ padding: 0 30px;
+}
+
+#librejs-complaint-info h1 {
+ z-index:1;
+ font:"Century Schoolbook";
+ font-size:25px;
+ text-align:center;
+ background:url('../images/info-title.png') no-repeat 50% 30px !important;
+ overflow: hidden;
+ text-indent:-3000em;
+ height:100px;
+ padding: 20px;
+ margin:0 !important;
+ line-height:0 !important;
+ display:block !important;
+ clear:none !important;
+ width:auto !important;
+}
+
+#librejs-complaint-info h1 span.huge {
+ display:block;
+ font-size:35px;
+ font-weight:bold;
+}
+
+#librejs-complaint-info h2 {
+ font-weight:bold !important;
+ font-size:14px !important;
+ margin:20px 0 10px !important;
+ display:none;
+ border-top:1px solid #CCC;
+ padding:10px 0 10px;
+ text-shadow: 0 1px 0 #FFF !important;
+}
+
+#librejs-complaint-info ul {
+ margin-left: 15px;
+}
+
+#librejs-complaint-info ul li a {
+ font-size: 14px !important;
+} \ No newline at end of file
diff --git a/data/assets/images/README b/data/assets/images/README
new file mode 100644
index 0000000..e442861
--- /dev/null
+++ b/data/assets/images/README
@@ -0,0 +1,21 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+All images in this directory are free, released under the GPLv3 or later. \ No newline at end of file
diff --git a/data/assets/images/complain-button3.png b/data/assets/images/complain-button3.png
new file mode 100644
index 0000000..5e3b4e3
--- /dev/null
+++ b/data/assets/images/complain-button3.png
Binary files differ
diff --git a/data/assets/images/complain.png b/data/assets/images/complain.png
new file mode 100644
index 0000000..ca0cf27
--- /dev/null
+++ b/data/assets/images/complain.png
Binary files differ
diff --git a/data/assets/images/info-title.png b/data/assets/images/info-title.png
new file mode 100644
index 0000000..02ebbfa
--- /dev/null
+++ b/data/assets/images/info-title.png
Binary files differ
diff --git a/data/assets/images/separator.png b/data/assets/images/separator.png
new file mode 100644
index 0000000..7eedd12
--- /dev/null
+++ b/data/assets/images/separator.png
Binary files differ
diff --git a/data/assets/images/torchy2.png b/data/assets/images/torchy2.png
new file mode 100644
index 0000000..60da8fc
--- /dev/null
+++ b/data/assets/images/torchy2.png
Binary files differ
diff --git a/data/chrome_worker/parser/jsdefs.js b/data/chrome_worker/parser/jsdefs.js
new file mode 100644
index 0000000..aff5c08
--- /dev/null
+++ b/data/chrome_worker/parser/jsdefs.js
@@ -0,0 +1,751 @@
+/* vim: set sw=4 ts=4 et tw=78: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Narcissus JavaScript engine.
+ *
+ * The Initial Developer of the Original Code is
+ * Brendan Eich <brendan@mozilla.org>.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Tom Austin <taustin@ucsc.edu>
+ * Brendan Eich <brendan@mozilla.org>
+ * Shu-Yu Guo <shu@rfrn.org>
+ * Dave Herman <dherman@mozilla.com>
+ * Dimitris Vardoulakis <dimvar@ccs.neu.edu>
+ * Patrick Walton <pcwalton@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Narcissus - JS implemented in JS.
+ *
+ * Well-known constants and lookup tables. Many consts are generated from the
+ * tokens table via eval to minimize redundancy, so consumers must be compiled
+ * separately to take advantage of the simple switch-case constant propagation
+ * done by SpiderMonkey.
+ */
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+//"use scrict";
+
+var Narcissus = {};
+(function() {
+
+ var narcissus = {
+ options: {
+ version: 185,
+ // Global variables to hide from the interpreter
+ hiddenHostGlobals: { Narcissus: true },
+ // Desugar SpiderMonkey language extensions?
+ desugarExtensions: false
+ },
+ hostSupportsEvalConst: (function() {
+ try {
+ return eval("(function(s) { eval(s); return x })('const x = true;')");
+ } catch (e) {
+ return false;
+ }
+ })(),
+ hostGlobal: this
+ };
+ Narcissus = narcissus;
+})();
+
+Narcissus.definitions = (function() {
+
+ var tokens = [
+ // End of source.
+ "END",
+
+ // Operators and punctuators. Some pair-wise order matters, e.g. (+, -)
+ // and (UNARY_PLUS, UNARY_MINUS).
+ "\n", ";",
+ ",",
+ "=",
+ "?", ":", "CONDITIONAL",
+ "||",
+ "&&",
+ "|",
+ "^",
+ "&",
+ "==", "!=", "===", "!==",
+ "<", "<=", ">=", ">",
+ "<<", ">>", ">>>",
+ "+", "-",
+ "*", "/", "%",
+ "!", "~", "UNARY_PLUS", "UNARY_MINUS",
+ "++", "--",
+ ".",
+ "[", "]",
+ "{", "}",
+ "(", ")",
+
+ // Nonterminal tree node type codes.
+ "SCRIPT", "BLOCK", "LABEL", "FOR_IN", "CALL", "NEW_WITH_ARGS", "INDEX",
+ "ARRAY_INIT", "OBJECT_INIT", "PROPERTY_INIT", "GETTER", "SETTER",
+ "GROUP", "LIST", "LET_BLOCK", "ARRAY_COMP", "GENERATOR", "COMP_TAIL",
+
+ // Terminals.
+ "IDENTIFIER", "NUMBER", "STRING", "REGEXP",
+
+ // Keywords.
+ "break",
+ "case", "catch", "const", "continue",
+ "debugger", "default", "delete", "do",
+ "else", "export",
+ "false", "finally", "for", "function",
+ "if", "import", "in", "instanceof",
+ "let", "module",
+ "new", "null",
+ "return",
+ "switch",
+ "this", "throw", "true", "try", "typeof",
+ "var", "void",
+ "yield",
+ "while", "with",
+ ];
+
+ var statementStartTokens = [
+ "break",
+ "const", "continue",
+ "debugger", "do",
+ "for",
+ "if",
+ "return",
+ "switch",
+ "throw", "try",
+ "var",
+ "yield",
+ "while", "with",
+ ];
+
+ // Whitespace characters (see ECMA-262 7.2)
+ var whitespaceChars = [
+ // normal whitespace:
+ "\u0009", "\u000B", "\u000C", "\u0020", "\u00A0", "\uFEFF",
+
+ // high-Unicode whitespace:
+ "\u1680", "\u180E",
+ "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006",
+ "\u2007", "\u2008", "\u2009", "\u200A",
+ "\u202F", "\u205F", "\u3000"
+ ];
+
+ var whitespace = {};
+ for (var i = 0; i < whitespaceChars.length; i++) {
+ whitespace[whitespaceChars[i]] = true;
+ }
+
+ // Operator and punctuator mapping from token to tree node type name.
+ // NB: because the lexer doesn't backtrack, all token prefixes must themselves
+ // be valid tokens (e.g. !== is acceptable because its prefixes are the valid
+ // tokens != and !).
+ var opTypeNames = {
+ '\n': "NEWLINE",
+ ';': "SEMICOLON",
+ ',': "COMMA",
+ '?': "HOOK",
+ ':': "COLON",
+ '||': "OR",
+ '&&': "AND",
+ '|': "BITWISE_OR",
+ '^': "BITWISE_XOR",
+ '&': "BITWISE_AND",
+ '===': "STRICT_EQ",
+ '==': "EQ",
+ '=': "ASSIGN",
+ '!==': "STRICT_NE",
+ '!=': "NE",
+ '<<': "LSH",
+ '<=': "LE",
+ '<': "LT",
+ '>>>': "URSH",
+ '>>': "RSH",
+ '>=': "GE",
+ '>': "GT",
+ '++': "INCREMENT",
+ '--': "DECREMENT",
+ '+': "PLUS",
+ '-': "MINUS",
+ '*': "MUL",
+ '/': "DIV",
+ '%': "MOD",
+ '!': "NOT",
+ '~': "BITWISE_NOT",
+ '.': "DOT",
+ '[': "LEFT_BRACKET",
+ ']': "RIGHT_BRACKET",
+ '{': "LEFT_CURLY",
+ '}': "RIGHT_CURLY",
+ '(': "LEFT_PAREN",
+ ')': "RIGHT_PAREN"
+ };
+
+ // Hash of keyword identifier to tokens index. NB: we must null __proto__ to
+ // avoid toString, etc. namespace pollution.
+ var keywords = {__proto__: null};
+
+ // Define const END, etc., based on the token names. Also map name to index.
+ var tokenIds = {};
+
+ // Building up a string to be eval'd in different contexts.
+ var consts = Narcissus.hostSupportsEvalConst ? "const " : "var ";
+ for (var i = 0, j = tokens.length; i < j; i++) {
+ if (i > 0)
+ consts += ", ";
+ var t = tokens[i];
+ var name;
+ if (/^[a-z]/.test(t)) {
+ name = t.toUpperCase();
+ keywords[t] = i;
+ } else {
+ name = (/^\W/.test(t) ? opTypeNames[t] : t);
+ }
+ consts += name + " = " + i;
+ tokenIds[name] = i;
+ tokens[t] = i;
+ }
+ consts += ";";
+
+ var isStatementStartCode = {__proto__: null};
+ for (i = 0, j = statementStartTokens.length; i < j; i++)
+ isStatementStartCode[keywords[statementStartTokens[i]]] = true;
+
+ // Map assignment operators to their indexes in the tokens array.
+ var assignOps = ['|', '^', '&', '<<', '>>', '>>>', '+', '-', '*', '/', '%'];
+
+ for (i = 0, j = assignOps.length; i < j; i++) {
+ t = assignOps[i];
+ assignOps[t] = tokens[t];
+ }
+
+ function defineGetter(obj, prop, fn, dontDelete, dontEnum) {
+ Object.defineProperty(obj, prop,
+ { get: fn, configurable: !dontDelete, enumerable: !dontEnum });
+ }
+
+ function defineGetterSetter(obj, prop, getter, setter, dontDelete, dontEnum) {
+ Object.defineProperty(obj, prop, {
+ get: getter,
+ set: setter,
+ configurable: !dontDelete,
+ enumerable: !dontEnum
+ });
+ }
+
+ function defineMemoGetter(obj, prop, fn, dontDelete, dontEnum) {
+ Object.defineProperty(obj, prop, {
+ get: function() {
+ var val = fn();
+ defineProperty(obj, prop, val, dontDelete, true, dontEnum);
+ return val;
+ },
+ configurable: true,
+ enumerable: !dontEnum
+ });
+ }
+
+ function defineProperty(obj, prop, val, dontDelete, readOnly, dontEnum) {
+ Object.defineProperty(obj, prop,
+ { value: val, writable: !readOnly, configurable: !dontDelete,
+ enumerable: !dontEnum });
+ }
+
+ // Returns true if fn is a native function. (Note: SpiderMonkey specific.)
+ function isNativeCode(fn) {
+ // Relies on the toString method to identify native code.
+ return ((typeof fn) === "function") && fn.toString().match(/\[native code\]/);
+ }
+
+ var Fpapply = Function.prototype.apply;
+
+ function apply(f, o, a) {
+ return Fpapply.call(f, [o].concat(a));
+ }
+
+ var applyNew;
+
+ // ES5's bind is a simpler way to implement applyNew
+ if (Function.prototype.bind) {
+ applyNew = function applyNew(f, a) {
+ return new (f.bind.apply(f, [,].concat(a)))();
+ };
+ } else {
+ applyNew = function applyNew(f, a) {
+ switch (a.length) {
+ case 0:
+ return new f();
+ case 1:
+ return new f(a[0]);
+ case 2:
+ return new f(a[0], a[1]);
+ case 3:
+ return new f(a[0], a[1], a[2]);
+ default:
+ var argStr = "a[0]";
+ for (var i = 1, n = a.length; i < n; i++)
+ argStr += ",a[" + i + "]";
+ return eval("new f(" + argStr + ")");
+ }
+ };
+ }
+
+ function getPropertyDescriptor(obj, name) {
+ while (obj) {
+ if (({}).hasOwnProperty.call(obj, name))
+ return Object.getOwnPropertyDescriptor(obj, name);
+ obj = Object.getPrototypeOf(obj);
+ }
+ return undefined;
+ }
+
+ function getPropertyNames(obj) {
+ var table = Object.create(null, {});
+ while (obj) {
+ var names = Object.getOwnPropertyNames(obj);
+ for (var i = 0, n = names.length; i < n; i++)
+ table[names[i]] = true;
+ obj = Object.getPrototypeOf(obj);
+ }
+ return Object.keys(table);
+ }
+
+ function getOwnProperties(obj) {
+ var map = {};
+ for (var name in Object.getOwnPropertyNames(obj))
+ map[name] = Object.getOwnPropertyDescriptor(obj, name);
+ return map;
+ }
+
+ function blacklistHandler(target, blacklist) {
+ var mask = Object.create(null, {});
+ var redirect = StringMap.create(blacklist).mapObject(function(name) { return mask; });
+ return mixinHandler(redirect, target);
+ }
+
+ function whitelistHandler(target, whitelist) {
+ var catchall = Object.create(null, {});
+ var redirect = StringMap.create(whitelist).mapObject(function(name) { return target; });
+ return mixinHandler(redirect, catchall);
+ }
+
+ function mirrorHandler(target, writable) {
+ var handler = makePassthruHandler(target);
+
+ var defineProperty = handler.defineProperty;
+ handler.defineProperty = function(name, desc) {
+ if (!desc.enumerable)
+ throw new Error("mirror property must be enumerable");
+ if (!desc.configurable)
+ throw new Error("mirror property must be configurable");
+ if (desc.writable !== writable)
+ throw new Error("mirror property must " + (writable ? "" : "not ") + "be writable");
+ defineProperty(name, desc);
+ };
+
+ handler.fix = function() { };
+ handler.getOwnPropertyDescriptor = handler.getPropertyDescriptor;
+ handler.getOwnPropertyNames = getPropertyNames.bind(handler, target);
+ handler.keys = handler.enumerate;
+ handler["delete"] = function() { return false; };
+ handler.hasOwn = handler.has;
+ return handler;
+ }
+
+ /*
+ * Mixin proxies break the single-inheritance model of prototypes, so
+ * the handler treats all properties as own-properties:
+ *
+ * X
+ * |
+ * +------------+------------+
+ * | O |
+ * | | |
+ * | O O O |
+ * | | | | |
+ * | O O O O |
+ * | | | | | |
+ * | O O O O O |
+ * | | | | | | |
+ * +-(*)--(w)--(x)--(y)--(z)-+
+ */
+
+ function mixinHandler(redirect, catchall) {
+ function targetFor(name) {
+ return hasOwn(redirect, name) ? redirect[name] : catchall;
+ }
+
+ function getMuxPropertyDescriptor(name) {
+ var desc = getPropertyDescriptor(targetFor(name), name);
+ if (desc)
+ desc.configurable = true;
+ return desc;
+ }
+
+ function getMuxPropertyNames() {
+ var names1 = Object.getOwnPropertyNames(redirect).filter(function(name) {
+ return name in redirect[name];
+ });
+ var names2 = getPropertyNames(catchall).filter(function(name) {
+ return !hasOwn(redirect, name);
+ });
+ return names1.concat(names2);
+ }
+
+ function enumerateMux() {
+ var result = Object.getOwnPropertyNames(redirect).filter(function(name) {
+ return name in redirect[name];
+ });
+ for (name in catchall) {
+ if (!hasOwn(redirect, name))
+ result.push(name);
+ };
+ return result;
+ }
+
+ function hasMux(name) {
+ return name in targetFor(name);
+ }
+
+ return {
+ getOwnPropertyDescriptor: getMuxPropertyDescriptor,
+ getPropertyDescriptor: getMuxPropertyDescriptor,
+ getOwnPropertyNames: getMuxPropertyNames,
+ defineProperty: function(name, desc) {
+ Object.defineProperty(targetFor(name), name, desc);
+ },
+ "delete": function(name) {
+ var target = targetFor(name);
+ return delete target[name];
+ },
+ // FIXME: ha ha ha
+ fix: function() { },
+ has: hasMux,
+ hasOwn: hasMux,
+ get: function(receiver, name) {
+ var target = targetFor(name);
+ return target[name];
+ },
+ set: function(receiver, name, val) {
+ var target = targetFor(name);
+ target[name] = val;
+ return true;
+ },
+ enumerate: enumerateMux,
+ keys: enumerateMux
+ };
+ }
+
+ function makePassthruHandler(obj) {
+ // Handler copied from
+ // http://wiki.ecmascript.org/doku.php?id=harmony:proxies&s=proxy%20object#examplea_no-op_forwarding_proxy
+ return {
+ getOwnPropertyDescriptor: function(name) {
+ var desc = Object.getOwnPropertyDescriptor(obj, name);
+
+ // a trapping proxy's properties must always be configurable
+ desc.configurable = true;
+ return desc;
+ },
+ getPropertyDescriptor: function(name) {
+ var desc = getPropertyDescriptor(obj, name);
+
+ // a trapping proxy's properties must always be configurable
+ desc.configurable = true;
+ return desc;
+ },
+ getOwnPropertyNames: function() {
+ return Object.getOwnPropertyNames(obj);
+ },
+ defineProperty: function(name, desc) {
+ Object.defineProperty(obj, name, desc);
+ },
+ "delete": function(name) { return delete obj[name]; },
+ fix: function() {
+ if (Object.isFrozen(obj)) {
+ return getOwnProperties(obj);
+ }
+
+ // As long as obj is not frozen, the proxy won't allow itself to be fixed.
+ return undefined; // will cause a TypeError to be thrown
+ },
+
+ has: function(name) { return name in obj; },
+ hasOwn: function(name) { return ({}).hasOwnProperty.call(obj, name); },
+ get: function(receiver, name) { return obj[name]; },
+
+ // bad behavior when set fails in non-strict mode
+ set: function(receiver, name, val) { obj[name] = val; return true; },
+ enumerate: function() {
+ var result = [];
+ for (name in obj) { result.push(name); };
+ return result;
+ },
+ keys: function() { return Object.keys(obj); }
+ };
+ }
+
+ var hasOwnProperty = ({}).hasOwnProperty;
+
+ function hasOwn(obj, name) {
+ return hasOwnProperty.call(obj, name);
+ }
+
+ function StringMap(table, size) {
+ this.table = table || Object.create(null, {});
+ this.size = size || 0;
+ }
+
+ StringMap.create = function(table) {
+ var init = Object.create(null, {});
+ var size = 0;
+ var names = Object.getOwnPropertyNames(table);
+ for (var i = 0, n = names.length; i < n; i++) {
+ var name = names[i];
+ init[name] = table[name];
+ size++;
+ }
+ return new StringMap(init, size);
+ };
+
+ StringMap.prototype = {
+ has: function(x) { return hasOwnProperty.call(this.table, x); },
+ set: function(x, v) {
+ if (!hasOwnProperty.call(this.table, x))
+ this.size++;
+ this.table[x] = v;
+ },
+ get: function(x) { return this.table[x]; },
+ getDef: function(x, thunk) {
+ if (!hasOwnProperty.call(this.table, x)) {
+ this.size++;
+ this.table[x] = thunk();
+ }
+ return this.table[x];
+ },
+ forEach: function(f) {
+ var table = this.table;
+ for (var key in table)
+ f.call(this, key, table[key]);
+ },
+ map: function(f) {
+ var table1 = this.table;
+ var table2 = Object.create(null, {});
+ this.forEach(function(key, val) {
+ table2[key] = f.call(this, val, key);
+ });
+ return new StringMap(table2, this.size);
+ },
+ mapObject: function(f) {
+ var table1 = this.table;
+ var table2 = Object.create(null, {});
+ this.forEach(function(key, val) {
+ table2[key] = f.call(this, val, key);
+ });
+ return table2;
+ },
+ toObject: function() {
+ return this.mapObject(function(val) { return val; });
+ },
+ choose: function() {
+ return Object.getOwnPropertyNames(this.table)[0];
+ },
+ remove: function(x) {
+ if (hasOwnProperty.call(this.table, x)) {
+ this.size--;
+ delete this.table[x];
+ }
+ },
+ copy: function() {
+ var table = Object.create(null, {});
+ for (var key in this.table)
+ table[key] = this.table[key];
+ return new StringMap(table, this.size);
+ },
+ keys: function() {
+ return Object.keys(this.table);
+ },
+ toString: function() { return "[object StringMap]" }
+ };
+
+ // an object-key table with poor asymptotics (replace with WeakMap when possible)
+ function ObjectMap(array) {
+ this.array = array || [];
+ }
+
+ function searchMap(map, key, found, notFound) {
+ var a = map.array;
+ for (var i = 0, n = a.length; i < n; i++) {
+ var pair = a[i];
+ if (pair.key === key)
+ return found(pair, i);
+ }
+ return notFound();
+ }
+
+ ObjectMap.prototype = {
+ has: function(x) {
+ return searchMap(this, x, function() { return true }, function() { return false });
+ },
+ set: function(x, v) {
+ var a = this.array;
+ searchMap(this, x,
+ function(pair) { pair.value = v },
+ function() { a.push({ key: x, value: v }) });
+ },
+ get: function(x) {
+ return searchMap(this, x,
+ function(pair) { return pair.value },
+ function() { return null });
+ },
+ getDef: function(x, thunk) {
+ var a = this.array;
+ return searchMap(this, x,
+ function(pair) { return pair.value },
+ function() {
+ var v = thunk();
+ a.push({ key: x, value: v });
+ return v;
+ });
+ },
+ forEach: function(f) {
+ var a = this.array;
+ for (var i = 0, n = a.length; i < n; i++) {
+ var pair = a[i];
+ f.call(this, pair.key, pair.value);
+ }
+ },
+ choose: function() {
+ return this.array[0].key;
+ },
+ get size() {
+ return this.array.length;
+ },
+ remove: function(x) {
+ var a = this.array;
+ searchMap(this, x,
+ function(pair, i) { a.splice(i, 1) },
+ function() { });
+ },
+ copy: function() {
+ return new ObjectMap(this.array.map(function(pair) {
+ return { key: pair.key, value: pair.value }
+ }));
+ },
+ clear: function() {
+ this.array = [];
+ },
+ toString: function() { return "[object ObjectMap]" }
+ };
+
+ // non-destructive stack
+ function Stack(elts) {
+ this.elts = elts || null;
+ }
+
+ Stack.prototype = {
+ push: function(x) {
+ return new Stack({ top: x, rest: this.elts });
+ },
+ top: function() {
+ if (!this.elts)
+ throw new Error("empty stack");
+ return this.elts.top;
+ },
+ isEmpty: function() {
+ return this.top === null;
+ },
+ find: function(test) {
+ for (var elts = this.elts; elts; elts = elts.rest) {
+ if (test(elts.top))
+ return elts.top;
+ }
+ return null;
+ },
+ has: function(x) {
+ return Boolean(this.find(function(elt) { return elt === x }));
+ },
+ forEach: function(f) {
+ for (var elts = this.elts; elts; elts = elts.rest) {
+ f(elts.top);
+ }
+ }
+ };
+
+ if (!Array.prototype.copy) {
+ Array.prototype.copy = function() {
+ var result = [];
+ for (var i = 0, n = this.length; i < n; i++)
+ result[i] = this[i];
+ return result;
+ };
+ }
+
+ return {
+ tokens: tokens,
+ whitespace: whitespace,
+ opTypeNames: opTypeNames,
+ keywords: keywords,
+ isStatementStartCode: isStatementStartCode,
+ tokenIds: tokenIds,
+ consts: consts,
+ assignOps: assignOps,
+ defineGetter: defineGetter,
+ defineGetterSetter: defineGetterSetter,
+ defineMemoGetter: defineMemoGetter,
+ defineProperty: defineProperty,
+ isNativeCode: isNativeCode,
+ apply: apply,
+ applyNew: applyNew,
+ mirrorHandler: mirrorHandler,
+ mixinHandler: mixinHandler,
+ whitelistHandler: whitelistHandler,
+ blacklistHandler: blacklistHandler,
+ makePassthruHandler: makePassthruHandler,
+ StringMap: StringMap,
+ ObjectMap: ObjectMap,
+ Stack: Stack
+ };
+}());
diff --git a/data/chrome_worker/parser/jslex.js b/data/chrome_worker/parser/jslex.js
new file mode 100644
index 0000000..c5c2673
--- /dev/null
+++ b/data/chrome_worker/parser/jslex.js
@@ -0,0 +1,719 @@
+/* vim: set sw=4 ts=4 et tw=78: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Narcissus JavaScript engine.
+ *
+ * The Initial Developer of the Original Code is
+ * Brendan Eich <brendan@mozilla.org>.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Tom Austin <taustin@ucsc.edu>
+ * Brendan Eich <brendan@mozilla.org>
+ * Shu-Yu Guo <shu@rfrn.org>
+ * Stephan Herhut <stephan.a.herhut@intel.com>
+ * Dave Herman <dherman@mozilla.com>
+ * Dimitris Vardoulakis <dimvar@ccs.neu.edu>
+ * Patrick Walton <pcwalton@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+/*
+ * Narcissus - JS implemented in JS.
+ *
+ * Lexical scanner.
+ */
+
+"use strict";
+
+Narcissus.lexer = (function() {
+
+ var definitions = Narcissus.definitions;
+
+ //throw Error (definitions.consts);
+
+ // Set constants in the local scope.
+ //eval(definitions.consts);
+ const END = 0,
+ NEWLINE = 1,
+ SEMICOLON = 2,
+ COMMA = 3,
+ ASSIGN = 4,
+ HOOK = 5,
+ COLON = 6,
+ CONDITIONAL = 7,
+ OR = 8,
+ AND = 9,
+ BITWISE_OR = 10,
+ BITWISE_XOR = 11,
+ BITWISE_AND = 12,
+ EQ = 13,
+ NE = 14,
+ STRICT_EQ = 15,
+ STRICT_NE = 16,
+ LT = 17,
+ LE = 18,
+ GE = 19,
+ GT = 20,
+ LSH = 21,
+ RSH = 22,
+ URSH = 23,
+ PLUS = 24,
+ MINUS = 25,
+ MUL = 26,
+ DIV = 27,
+ MOD = 28,
+ NOT = 29,
+ BITWISE_NOT = 30,
+ UNARY_PLUS = 31,
+ UNARY_MINUS = 32,
+ INCREMENT = 33,
+ DECREMENT = 34,
+ DOT = 35,
+ LEFT_BRACKET = 36,
+ RIGHT_BRACKET = 37,
+ LEFT_CURLY = 38,
+ RIGHT_CURLY = 39,
+ LEFT_PAREN = 40,
+ RIGHT_PAREN = 41,
+ SCRIPT = 42,
+ BLOCK = 43,
+ LABEL = 44,
+ FOR_IN = 45,
+ CALL = 46,
+ NEW_WITH_ARGS = 47,
+ INDEX = 48,
+ ARRAY_INIT = 49,
+ OBJECT_INIT = 50,
+ PROPERTY_INIT = 51,
+ GETTER = 52,
+ SETTER = 53,
+ GROUP = 54,
+ LIST = 55,
+ LET_BLOCK = 56,
+ ARRAY_COMP = 57,
+ GENERATOR = 58,
+ COMP_TAIL = 59,
+ IDENTIFIER = 60,
+ NUMBER = 61,
+ STRING = 62,
+ REGEXP = 63,
+ BREAK = 64,
+ CASE = 65,
+ CATCH = 66,
+ CONST = 67,
+ CONTINUE = 68,
+ DEBUGGER = 69,
+ DEFAULT = 70,
+ DELETE = 71,
+ DO = 72,
+ ELSE = 73,
+ EXPORT = 74,
+ FALSE = 75,
+ FINALLY = 76,
+ FOR = 77,
+ FUNCTION = 78,
+ IF = 79,
+ IMPORT = 80,
+ IN = 81,
+ INSTANCEOF = 82,
+ LET = 83,
+ MODULE = 84,
+ NEW = 85,
+ NULL = 86,
+ RETURN = 87,
+ SWITCH = 88,
+ THIS = 89,
+ THROW = 90,
+ TRUE = 91,
+ TRY = 92,
+ TYPEOF = 93,
+ VAR = 94,
+ VOID = 95,
+ YIELD = 96,
+ WHILE = 97,
+ WITH = 98;
+
+ // Banned keywords by language version
+ const blackLists = { 160: {}, 185: {}, harmony: {} };
+/* blackLists[160][LET] = true;
+ blackLists[160][MODULE] = true;
+ blackLists[160][YIELD] = true;
+ blackLists[185][MODULE] = true;
+*/
+ // Build up a trie of operator tokens.
+ var opTokens = {};
+ for (var op in definitions.opTypeNames) {
+ if (op === '\n' || op === '.')
+ continue;
+
+ var node = opTokens;
+ for (var i = 0; i < op.length; i++) {
+ var ch = op[i];
+ if (!(ch in node))
+ node[ch] = {};
+ node = node[ch];
+ node.op = op;
+ }
+ }
+
+ /*
+ * Since JavaScript provides no convenient way to determine if a
+ * character is in a particular Unicode category, we use
+ * metacircularity to accomplish this (oh yeaaaah!)
+ */
+ function isValidIdentifierChar(ch, first) {
+ // check directly for ASCII
+ if (ch <= "\u007F") {
+ if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch === '$' || ch === '_' ||
+ (!first && (ch >= '0' && ch <= '9'))) {
+ return true;
+ }
+ return false;
+ }
+
+ // create an object to test this in
+ var x = {};
+ x["x"+ch] = true;
+ x[ch] = true;
+
+ // then use eval to determine if it's a valid character
+ var valid = false;
+ try {
+ valid = (Function("x", "return (x." + (first?"":"x") + ch + ");")(x) === true);
+ } catch (ex) {}
+
+ return valid;
+ }
+
+ function isIdentifier(str) {
+ if (typeof str !== "string")
+ return false;
+
+ if (str.length === 0)
+ return false;
+
+ if (!isValidIdentifierChar(str[0], true))
+ return false;
+
+ for (var i = 1; i < str.length; i++) {
+ if (!isValidIdentifierChar(str[i], false))
+ return false;
+ }
+
+ return true;
+ }
+
+ /*
+ * Tokenizer :: (source, filename, line number) -> Tokenizer
+ */
+ function Tokenizer(s, f, l) {
+ this.cursor = 0;
+ this.source = String(s);
+ this.tokens = [];
+ this.tokenIndex = 0;
+ this.lookahead = 0;
+ this.scanNewlines = false;
+ this.unexpectedEOF = false;
+ this.filename = f || "";
+ this.lineno = l || 1;
+ this.blackList = blackLists[Narcissus.options.version];
+ this.blockComments = null;
+ }
+
+ Tokenizer.prototype = {
+ get done() {
+ // We need to set scanOperand to true here because the first thing
+ // might be a regexp.
+ return this.peek(true) === END;
+ },
+
+ get token() {
+ return this.tokens[this.tokenIndex];
+ },
+
+ match: function (tt, scanOperand) {
+ return this.get(scanOperand) === tt || this.unget();
+ },
+
+ mustMatch: function (tt) {
+ if (!this.match(tt)) {
+ throw this.newSyntaxError("Missing " +
+ definitions.tokens[tt].toLowerCase());
+ }
+ return this.token;
+ },
+
+ peek: function (scanOperand) {
+ var tt, next;
+ if (this.lookahead) {
+ next = this.tokens[(this.tokenIndex + this.lookahead) & 3];
+ tt = (this.scanNewlines && next.lineno !== this.lineno)
+ ? NEWLINE
+ : next.type;
+ } else {
+ tt = this.get(scanOperand);
+ this.unget();
+ }
+ return tt;
+ },
+
+ peekOnSameLine: function (scanOperand) {
+ this.scanNewlines = true;
+ var tt = this.peek(scanOperand);
+ this.scanNewlines = false;
+ return tt;
+ },
+
+ lastBlockComment: function() {
+ var length = this.blockComments.length;
+ return length ? this.blockComments[length - 1] : null;
+ },
+
+ // Eat comments and whitespace.
+ skip: function () {
+ var input = this.source;
+ this.blockComments = [];
+ for (;;) {
+ var ch = input[this.cursor++];
+ var next = input[this.cursor];
+ // handle \r, \r\n and (always preferable) \n
+ if (ch === '\r') {
+ // if the next character is \n, we don't care about this at all
+ if (next === '\n') continue;
+
+ // otherwise, we want to consider this as a newline
+ ch = '\n';
+ }
+
+ if (ch === '\n' && !this.scanNewlines) {
+ this.lineno++;
+ } else if (ch === '/' && next === '*') {
+ var commentStart = ++this.cursor;
+ for (;;) {
+ ch = input[this.cursor++];
+ if (ch === undefined)
+ throw this.newSyntaxError("Unterminated comment");
+
+ if (ch === '*') {
+ next = input[this.cursor];
+ if (next === '/') {
+ var commentEnd = this.cursor - 1;
+ this.cursor++;
+ break;
+ }
+ } else if (ch === '\n') {
+ this.lineno++;
+ }
+ }
+ this.blockComments.push(input.substring(commentStart, commentEnd));
+ }
+ else if (ch === '-' && next === '-' &&
+ input[this.cursor + 1] === '>') {
+ this.cursor += 2;
+ }
+ else if ((ch === '/' && next === '/') ||
+ (ch === '<' && next === '!' &&
+ input[this.cursor + 1] === '-' &&
+ input[this.cursor + 2] === '-' &&
+ (this.cursor += 2))) {
+
+ // capture single line comments starts.
+ var commentStart = ++this.cursor;
+ for (;;) {
+ ch = input[this.cursor++];
+ if (ch === undefined) {
+ //this.lineno++;
+ break;
+ //throw this.newSyntaxError("Unterminated comment");
+ }
+ if (ch === '\r') {
+ // check for \r\n
+ if (next !== '\n') ch = '\n';
+ var commentEnd = this.cursor - 1;
+ }
+
+ if (ch === '\n') {
+ if (this.scanNewlines) {
+ this.cursor--;
+ } else {
+ this.lineno++;
+ }
+ var commentEnd = this.cursor - 1;
+ break;
+ }
+ }
+ this.blockComments.push(input.substring(commentStart, commentEnd));
+ // capture single line comments ends.
+ } else if (!(ch in definitions.whitespace)) {
+ this.cursor--;
+ return;
+ }
+ }
+ },
+
+ // Lex the exponential part of a number, if present. Return true iff an
+ // exponential part was found.
+ lexExponent: function() {
+ var input = this.source;
+ var next = input[this.cursor];
+ if (next === 'e' || next === 'E') {
+ this.cursor++;
+ ch = input[this.cursor++];
+ if (ch === '+' || ch === '-')
+ ch = input[this.cursor++];
+
+ if (ch < '0' || ch > '9')
+ throw this.newSyntaxError("Missing exponent");
+
+ do {
+ ch = input[this.cursor++];
+ } while (ch >= '0' && ch <= '9');
+ this.cursor--;
+
+ return true;
+ }
+
+ return false;
+ },
+
+ lexZeroNumber: function (ch) {
+ var token = this.token, input = this.source;
+ token.type = NUMBER;
+
+ ch = input[this.cursor++];
+ if (ch === '.') {
+ do {
+ ch = input[this.cursor++];
+ } while (ch >= '0' && ch <= '9');
+ this.cursor--;
+
+ this.lexExponent();
+ token.value = parseFloat(
+ input.substring(token.start, this.cursor));
+ } else if (ch === 'x' || ch === 'X') {
+ do {
+ ch = input[this.cursor++];
+ } while ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') ||
+ (ch >= 'A' && ch <= 'F'));
+ this.cursor--;
+
+ token.value = parseInt(input.substring(token.start, this.cursor));
+ } else if (ch >= '0' && ch <= '7') {
+ do {
+ ch = input[this.cursor++];
+ } while (ch >= '0' && ch <= '7');
+ this.cursor--;
+
+ token.value = parseInt(input.substring(token.start, this.cursor));
+ } else {
+ this.cursor--;
+ this.lexExponent(); // 0E1, &c.
+ token.value = 0;
+ }
+ },
+
+ lexNumber: function (ch) {
+ var token = this.token, input = this.source;
+ token.type = NUMBER;
+
+ var floating = false;
+ do {
+ ch = input[this.cursor++];
+ if (ch === '.' && !floating) {
+ floating = true;
+ ch = input[this.cursor++];
+ }
+ } while (ch >= '0' && ch <= '9');
+
+ this.cursor--;
+
+ var exponent = this.lexExponent();
+ floating = floating || exponent;
+
+ var str = input.substring(token.start, this.cursor);
+ token.value = floating ? parseFloat(str) : parseInt(str);
+ },
+
+ lexDot: function (ch) {
+ var token = this.token, input = this.source;
+ var next = input[this.cursor];
+ if (next >= '0' && next <= '9') {
+ do {
+ ch = input[this.cursor++];
+ } while (ch >= '0' && ch <= '9');
+ this.cursor--;
+
+ this.lexExponent();
+
+ token.type = NUMBER;
+ token.value = parseFloat(
+ input.substring(token.start, this.cursor));
+ } else {
+ token.type = DOT;
+ token.assignOp = null;
+ token.value = '.';
+ }
+ },
+
+ lexString: function (ch) {
+ var token = this.token, input = this.source;
+ token.type = STRING;
+
+ var hasEscapes = false;
+ var delim = ch;
+ if (input.length <= this.cursor)
+ throw this.newSyntaxError("Unterminated string literal");
+ while ((ch = input[this.cursor++]) !== delim) {
+ if (this.cursor == input.length)
+ throw this.newSyntaxError("Unterminated string literal");
+ if (ch === '\\') {
+ hasEscapes = true;
+ if (++this.cursor == input.length)
+ throw this.newSyntaxError("Unterminated string literal");
+ }
+ }
+
+ token.value = hasEscapes
+ ? eval(input.substring(token.start, this.cursor))
+ : input.substring(token.start + 1, this.cursor - 1);
+ },
+
+ lexRegExp: function (ch) {
+ var token = this.token, input = this.source;
+ token.type = REGEXP;
+
+ do {
+ ch = input[this.cursor++];
+ if (ch === '\\') {
+ this.cursor++;
+ } else if (ch === '[') {
+ do {
+ if (ch === undefined)
+ throw this.newSyntaxError("Unterminated character class");
+
+ if (ch === '\\')
+ this.cursor++;
+
+ ch = input[this.cursor++];
+ } while (ch !== ']');
+ } else if (ch === undefined) {
+ throw this.newSyntaxError("Unterminated regex");
+ }
+ } while (ch !== '/');
+
+ do {
+ ch = input[this.cursor++];
+ } while (ch >= 'a' && ch <= 'z');
+
+ this.cursor--;
+
+ token.value = eval(input.substring(token.start, this.cursor));
+ },
+
+ lexOp: function (ch) {
+ var token = this.token, input = this.source;
+
+ // A bit ugly, but it seems wasteful to write a trie lookup routine
+ // for only 3 characters...
+ var node = opTokens[ch];
+ var next = input[this.cursor];
+ if (next in node) {
+ node = node[next];
+ this.cursor++;
+ next = input[this.cursor];
+ if (next in node) {
+ node = node[next];
+ this.cursor++;
+ next = input[this.cursor];
+ }
+ }
+
+ var op = node.op;
+ if (definitions.assignOps[op] && input[this.cursor] === '=') {
+ this.cursor++;
+ token.type = ASSIGN;
+ token.assignOp = definitions.tokenIds[definitions.opTypeNames[op]];
+ op += '=';
+ } else {
+ token.type = definitions.tokenIds[definitions.opTypeNames[op]];
+ token.assignOp = null;
+ }
+
+ token.value = op;
+ },
+
+ // FIXME: Unicode escape sequences
+ lexIdent: function (ch) {
+ var token = this.token;
+ var id = ch;
+
+ while ((ch = this.getValidIdentifierChar(false)) !== null) {
+ id += ch;
+ }
+
+ token.type = definitions.keywords[id] || IDENTIFIER;
+ if (token.type in this.blackList) {
+ // banned keyword, this is an identifier
+ token.type = IDENTIFIER;
+ }
+ token.value = id;
+ },
+
+ /*
+ * Tokenizer.get :: void -> token type
+ *
+ * Consume input *only* if there is no lookahead.
+ * Dispatch to the appropriate lexing function depending on the input.
+ */
+ get: function (scanOperand) {
+ var token;
+ while (this.lookahead) {
+ --this.lookahead;
+ this.tokenIndex = (this.tokenIndex + 1) & 3;
+ token = this.tokens[this.tokenIndex];
+ if (token.type !== NEWLINE || this.scanNewlines)
+ return token.type;
+ }
+
+ this.skip();
+
+ this.tokenIndex = (this.tokenIndex + 1) & 3;
+ token = this.tokens[this.tokenIndex];
+ if (!token)
+ this.tokens[this.tokenIndex] = token = {};
+
+ var input = this.source;
+ if (this.cursor >= input.length)
+ return token.type = END;
+
+ token.start = this.cursor;
+ token.lineno = this.lineno;
+
+ var ich = this.getValidIdentifierChar(true);
+ var ch = (ich === null) ? input[this.cursor++] : null;
+ if (ich !== null) {
+ this.lexIdent(ich);
+ } else if (scanOperand && ch === '/') {
+ this.lexRegExp(ch);
+ } else if (ch in opTokens) {
+ this.lexOp(ch);
+ } else if (ch === '.') {
+ this.lexDot(ch);
+ } else if (ch >= '1' && ch <= '9') {
+ this.lexNumber(ch);
+ } else if (ch === '0') {
+ this.lexZeroNumber(ch);
+ } else if (ch === '"' || ch === "'") {
+ this.lexString(ch);
+ } else if (this.scanNewlines && (ch === '\n' || ch === '\r')) {
+ // if this was a \r, look for \r\n
+ if (ch === '\r' && input[this.cursor] === '\n') this.cursor++;
+ token.type = NEWLINE;
+ token.value = '\n';
+ this.lineno++;
+ } else {
+ throw this.newSyntaxError("Illegal token");
+ }
+
+ token.end = this.cursor;
+ return token.type;
+ },
+
+ /*
+ * Tokenizer.unget :: void -> undefined
+ *
+ * Match depends on unget returning undefined.
+ */
+ unget: function () {
+ if (++this.lookahead === 4) throw "PANIC: too much lookahead!";
+ this.tokenIndex = (this.tokenIndex - 1) & 3;
+ },
+
+ newSyntaxError: function (m) {
+ m = (this.filename ? this.filename + ":" : "") + this.lineno + ": " + m;
+ var e = new SyntaxError(m, this.filename, this.lineno);
+ e.source = this.source;
+ e.cursor = this.lookahead
+ ? this.tokens[(this.tokenIndex + this.lookahead) & 3].start
+ : this.cursor;
+ return e;
+ },
+
+
+ /* Gets a single valid identifier char from the input stream, or null
+ * if there is none.
+ */
+ getValidIdentifierChar: function(first) {
+ var input = this.source;
+ if (this.cursor >= input.length) return null;
+ var ch = input[this.cursor];
+
+ // first check for \u escapes
+ if (ch === '\\' && input[this.cursor+1] === 'u') {
+ // get the character value
+ try {
+ ch = String.fromCharCode(parseInt(
+ input.substring(this.cursor + 2, this.cursor + 6),
+ 16));
+ } catch (ex) {
+ return null;
+ }
+ this.cursor += 5;
+ }
+
+ var valid = isValidIdentifierChar(ch, first);
+ if (valid) this.cursor++;
+ return (valid ? ch : null);
+ },
+ };
+
+
+ return {
+ isIdentifier: isIdentifier,
+ Tokenizer: Tokenizer
+ };
+
+}());
diff --git a/data/chrome_worker/parser/jsparse.js b/data/chrome_worker/parser/jsparse.js
new file mode 100644
index 0000000..b78078c
--- /dev/null
+++ b/data/chrome_worker/parser/jsparse.js
@@ -0,0 +1,2042 @@
+/* -*- Mode: JS; tab-width: 4; indent-tabs-mode: nil; -*-
+ * vim: set sw=4 ts=4 et tw=78:
+ * ***** BEGIN LICENSE BLOCK *****
+ *
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Narcissus JavaScript engine.
+ *
+ * The Initial Developer of the Original Code is
+ * Brendan Eich <brendan@mozilla.org>.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Tom Austin <taustin@ucsc.edu>
+ * Brendan Eich <brendan@mozilla.org>
+ * Shu-Yu Guo <shu@rfrn.org>
+ * Dave Herman <dherman@mozilla.com>
+ * Dimitris Vardoulakis <dimvar@ccs.neu.edu>
+ * Patrick Walton <pcwalton@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+/*
+ * Narcissus - JS implemented in JS.
+ *
+ * Parser.
+ */
+
+"use strict";
+
+Narcissus.parser = (function() {
+
+ var lexer = Narcissus.lexer;
+ var definitions = Narcissus.definitions;
+
+ const StringMap = definitions.StringMap;
+ const Stack = definitions.Stack;
+
+ var comment;
+
+ // Set constants in the local scope.
+ //eval(definitions.consts);
+ const END = 0,
+ NEWLINE = 1,
+ SEMICOLON = 2,
+ COMMA = 3,
+ ASSIGN = 4,
+ HOOK = 5,
+ COLON = 6,
+ CONDITIONAL = 7,
+ OR = 8,
+ AND = 9,
+ BITWISE_OR = 10,
+ BITWISE_XOR = 11,
+ BITWISE_AND = 12,
+ EQ = 13,
+ NE = 14,
+ STRICT_EQ = 15,
+ STRICT_NE = 16,
+ LT = 17,
+ LE = 18,
+ GE = 19,
+ GT = 20,
+ LSH = 21,
+ RSH = 22,
+ URSH = 23,
+ PLUS = 24,
+ MINUS = 25,
+ MUL = 26,
+ DIV = 27,
+ MOD = 28,
+ NOT = 29,
+ BITWISE_NOT = 30,
+ UNARY_PLUS = 31,
+ UNARY_MINUS = 32,
+ INCREMENT = 33,
+ DECREMENT = 34,
+ DOT = 35,
+ LEFT_BRACKET = 36,
+ RIGHT_BRACKET = 37,
+ LEFT_CURLY = 38,
+ RIGHT_CURLY = 39,
+ LEFT_PAREN = 40,
+ RIGHT_PAREN = 41,
+ SCRIPT = 42,
+ BLOCK = 43,
+ LABEL = 44,
+ FOR_IN = 45,
+ CALL = 46,
+ NEW_WITH_ARGS = 47,
+ INDEX = 48,
+ ARRAY_INIT = 49,
+ OBJECT_INIT = 50,
+ PROPERTY_INIT = 51,
+ GETTER = 52,
+ SETTER = 53,
+ GROUP = 54,
+ LIST = 55,
+ LET_BLOCK = 56,
+ ARRAY_COMP = 57,
+ GENERATOR = 58,
+ COMP_TAIL = 59,
+ IDENTIFIER = 60,
+ NUMBER = 61,
+ STRING = 62,
+ REGEXP = 63,
+ BREAK = 64,
+ CASE = 65,
+ CATCH = 66,
+ CONST = 67,
+ CONTINUE = 68,
+ DEBUGGER = 69,
+ DEFAULT = 70,
+ DELETE = 71,
+ DO = 72,
+ ELSE = 73,
+ EXPORT = 74,
+ FALSE = 75,
+ FINALLY = 76,
+ FOR = 77,
+ FUNCTION = 78,
+ IF = 79,
+ IMPORT = 80,
+ IN = 81,
+ INSTANCEOF = 82,
+ LET = 83,
+ MODULE = 84,
+ NEW = 85,
+ NULL = 86,
+ RETURN = 87,
+ SWITCH = 88,
+ THIS = 89,
+ THROW = 90,
+ TRUE = 91,
+ TRY = 92,
+ TYPEOF = 93,
+ VAR = 94,
+ VOID = 95,
+ YIELD = 96,
+ WHILE = 97,
+ WITH = 98;
+
+ // Banned statement types by language version.
+ const blackLists = { 160: {}, 185: {}, harmony: {} };
+ /* blackLists[160][IMPORT] = true;
+ blackLists[160][EXPORT] = true;
+ blackLists[160][LET] = true;
+ blackLists[160][MODULE] = true;
+ blackLists[160][YIELD] = true;
+ blackLists[185][IMPORT] = true;
+ blackLists[185][EXPORT] = true;
+ blackLists[185][MODULE] = true;
+ blackLists.harmony[WITH] = true;
+*/
+ /*
+ * pushDestructuringVarDecls :: (node, hoisting node) -> void
+ *
+ * Recursively add all destructured declarations to varDecls.
+ */
+ function pushDestructuringVarDecls(n, s) {
+ for (var i in n) {
+ var sub = n[i];
+ if (sub.type === IDENTIFIER) {
+ s.varDecls.push(sub);
+ } else {
+ pushDestructuringVarDecls(sub, s);
+ }
+ }
+ }
+
+ function StaticContext(parentScript, parentBlock, inModule, inFunction) {
+ this.parentScript = parentScript;
+ this.parentBlock = parentBlock || parentScript;
+ this.inModule = inModule || false;
+ this.inFunction = inFunction || false;
+ this.inForLoopInit = false;
+ this.topLevel = true;
+ this.allLabels = new Stack();
+ this.currentLabels = new Stack();
+ this.labeledTargets = new Stack();
+ this.defaultLoopTarget = null;
+ this.defaultTarget = null;
+ this.blackList = blackLists[Narcissus.options.version];
+ Narcissus.options.ecma3OnlyMode && (this.ecma3OnlyMode = true);
+ Narcissus.options.parenFreeMode && (this.parenFreeMode = true);
+ }
+
+ StaticContext.prototype = {
+ ecma3OnlyMode: false,
+ parenFreeMode: false,
+ // non-destructive update via prototype extension
+ update: function(ext) {
+ var desc = {};
+ for (var key in ext) {
+ desc[key] = {
+ value: ext[key],
+ writable: true,
+ enumerable: true,
+ configurable: true
+ }
+ }
+ return Object.create(this, desc);
+ },
+ pushLabel: function(label) {
+ return this.update({ currentLabels: this.currentLabels.push(label),
+ allLabels: this.allLabels.push(label) });
+ },
+ pushTarget: function(target) {
+ var isDefaultLoopTarget = target.isLoop;
+ var isDefaultTarget = isDefaultLoopTarget || target.type === SWITCH;
+
+ if (this.currentLabels.isEmpty()) {
+ if (isDefaultLoopTarget) this.update({ defaultLoopTarget: target });
+ if (isDefaultTarget) this.update({ defaultTarget: target });
+ return this;
+ }
+
+ target.labels = new StringMap();
+ this.currentLabels.forEach(function(label) {
+ target.labels.set(label, true);
+ });
+ return this.update({ currentLabels: new Stack(),
+ labeledTargets: this.labeledTargets.push(target),
+ defaultLoopTarget: isDefaultLoopTarget
+ ? target
+ : this.defaultLoopTarget,
+ defaultTarget: isDefaultTarget
+ ? target
+ : this.defaultTarget });
+ },
+ nest: function() {
+ return this.topLevel ? this.update({ topLevel: false }) : this;
+ },
+ allow: function(type) {
+ switch (type) {
+ case EXPORT:
+ if (!this.inModule || this.inFunction || !this.topLevel)
+ return false;
+ // FALL THROUGH
+
+ case IMPORT:
+ return !this.inFunction && this.topLevel;
+
+ case MODULE:
+ return !this.inFunction && this.topLevel;
+
+ default:
+ return true;
+ }
+ }
+ };
+
+ /*
+ * Script :: (tokenizer, boolean, boolean) -> node
+ *
+ * Parses the toplevel and module/function bodies.
+ */
+ function Script(t, inModule, inFunction) {
+ var n = new Node(t, scriptInit());
+ Statements(t, new StaticContext(n, n, inModule, inFunction), n);
+ return n;
+ }
+
+ // We extend Array slightly with a top-of-stack method.
+ definitions.defineProperty(Array.prototype, "top",
+ function() {
+ return this.length && this[this.length-1];
+ }, false, false, true);
+
+ /*
+ * Node :: (tokenizer, optional init object) -> node
+ */
+ function Node(t, init) {
+ var token = t.token;
+ if (token) {
+ // If init.type exists it will override token.type.
+ this.type = token.type;
+ this.value = token.value;
+ this.lineno = token.lineno;
+
+ // Start and end are file positions for error handling.
+ this.start = token.start;
+ this.end = token.end;
+ } else {
+ this.lineno = t.lineno;
+ }
+
+ // Node uses a tokenizer for debugging (getSource, filename getter).
+ this.tokenizer = t;
+ this.children = [];
+
+ for (var prop in init)
+ this[prop] = init[prop];
+ }
+
+ /*
+ * SyntheticNode :: (tokenizer, optional init object) -> node
+ */
+ function SyntheticNode(t, init) {
+ // print("SYNTHETIC NODE");
+ // if (init.type === COMMA) {
+ // print("SYNTHETIC COMMA");
+ // print(init);
+ // }
+ this.tokenizer = t;
+ this.children = [];
+ for (var prop in init)
+ this[prop] = init[prop];
+ this.synthetic = true;
+ }
+
+ var Np = Node.prototype = SyntheticNode.prototype = {};
+ Np.constructor = Node;
+
+ const TO_SOURCE_SKIP = {
+ type: true,
+ value: true,
+ lineno: true,
+ start: true,
+ end: true,
+ tokenizer: true,
+ assignOp: true
+ };
+ function unevalableConst(code) {
+ var token = definitions.tokens[code];
+ var constName = definitions.opTypeNames.hasOwnProperty(token)
+ ? definitions.opTypeNames[token]
+ : token in definitions.keywords
+ ? token.toUpperCase()
+ : token;
+ return { toSource: function() { return constName } };
+ }
+ Np.toSource = function toSource() {
+ var mock = {};
+ var self = this;
+ mock.type = unevalableConst(this.type);
+ if ("value" in this)
+ mock.value = this.value;
+ if ("lineno" in this)
+ mock.lineno = this.lineno;
+ if ("start" in this)
+ mock.start = this.start;
+ if ("end" in this)
+ mock.end = this.end;
+ if (this.assignOp)
+ mock.assignOp = unevalableConst(this.assignOp);
+ for (var key in this) {
+ if (this.hasOwnProperty(key) && !(key in TO_SOURCE_SKIP))
+ mock[key] = this[key];
+ }
+ return mock.toSource();
+ };
+
+ // Always use push to add operands to an expression, to update start and end.
+ Np.push = function (kid) {
+ // kid can be null e.g. [1, , 2].
+ if (kid !== null) {
+ if (kid.start < this.start)
+ this.start = kid.start;
+ if (this.end < kid.end)
+ this.end = kid.end;
+ }
+ return this.children.push(kid);
+ }
+
+ Node.indentLevel = 0;
+
+ function tokenString(tt) {
+ var t = definitions.tokens[tt];
+ return /^\W/.test(t) ? definitions.opTypeNames[t] : t.toUpperCase();
+ }
+
+ Np.toString = function () {
+ var a = [];
+ for (var i in this) {
+ if (this.hasOwnProperty(i) && i !== 'type' && i !== 'target')
+ a.push({id: i, value: this[i]});
+ }
+ a.sort(function (a,b) { return (a.id < b.id) ? -1 : 1; });
+ const INDENTATION = " ";
+ var n = ++Node.indentLevel;
+ var s = "{\n" + INDENTATION.repeat(n) + "type: " + tokenString(this.type);
+ for (i = 0; i < a.length; i++)
+ s += ",\n" + INDENTATION.repeat(n) + a[i].id + ": " + a[i].value;
+ n = --Node.indentLevel;
+ s += "\n" + INDENTATION.repeat(n) + "}";
+ return s;
+ }
+
+ Np.getSource = function () {
+ return this.tokenizer.source.slice(this.start, this.end);
+ };
+
+ /*
+ * Helper init objects for common nodes.
+ */
+
+ const LOOP_INIT = { isLoop: true };
+
+ function blockInit() {
+ return { type: BLOCK, varDecls: [] };
+ }
+
+ function scriptInit() {
+ return { type: SCRIPT,
+ funDecls: [],
+ varDecls: [],
+ modDefns: new StringMap(),
+ modAssns: new StringMap(),
+ modDecls: new StringMap(),
+ modLoads: new StringMap(),
+ impDecls: [],
+ expDecls: [],
+ exports: new StringMap(),
+ hasEmptyReturn: false,
+ hasReturnWithValue: false,
+ isGenerator: false };
+ }
+
+ definitions.defineGetter(Np, "filename",
+ function() {
+ return this.tokenizer.filename;
+ });
+
+ definitions.defineGetter(Np, "length",
+ function() {
+ throw new Error("Node.prototype.length is gone; " +
+ "use n.children.length instead");
+ });
+
+ definitions.defineProperty(String.prototype, "repeat",
+ function(n) {
+ var s = "", t = this + s;
+ while (--n >= 0)
+ s += t;
+ return s;
+ }, false, false, true);
+
+ function MaybeLeftParen(t, x) {
+ if (x.parenFreeMode)
+ return t.match(LEFT_PAREN) ? LEFT_PAREN : END;
+ return t.mustMatch(LEFT_PAREN).type;
+ }
+
+ function MaybeRightParen(t, p) {
+ if (p === LEFT_PAREN)
+ t.mustMatch(RIGHT_PAREN);
+ }
+
+ /*
+ * Statements :: (tokenizer, compiler context, node) -> void
+ *
+ * Parses a sequence of Statements.
+ */
+ function Statements(t, x, n) {
+ try {
+ while (!t.done && t.peek(true) !== RIGHT_CURLY)
+ n.push(Statement(t, x));
+ } catch (e) {
+ if (t.done)
+ t.unexpectedEOF = true;
+ throw e;
+ }
+ }
+
+ function Block(t, x) {
+ t.mustMatch(LEFT_CURLY);
+ var n = new Node(t, blockInit());
+ Statements(t, x.update({ parentBlock: n }).pushTarget(n), n);
+ t.mustMatch(RIGHT_CURLY);
+ return n;
+ }
+
+ const DECLARED_FORM = 0, EXPRESSED_FORM = 1, STATEMENT_FORM = 2;
+
+ /*
+ * Export :: (binding node, boolean) -> Export
+ *
+ * Static semantic representation of a module export.
+ */
+ function Export(node, isDefinition) {
+ this.node = node; // the AST node declaring this individual export
+ this.isDefinition = isDefinition; // is the node an 'export'-annotated definition?
+ this.resolved = null; // resolved pointer to the target of this export
+ }
+
+ /*
+ * registerExport :: (StringMap, EXPORT node) -> void
+ */
+ function registerExport(exports, decl) {
+ function register(name, exp) {
+ if (exports.has(name))
+ throw new SyntaxError("multiple exports of " + name);
+ exports.set(name, exp);
+ }
+
+ switch (decl.type) {
+ case MODULE:
+ case FUNCTION:
+ register(decl.name, new Export(decl, true));
+ break;
+
+ case VAR:
+ for (var i = 0; i < decl.children.length; i++)
+ register(decl.children[i].name, new Export(decl.children[i], true));
+ break;
+
+ case LET:
+ case CONST:
+ throw new Error("NYI: " + definitions.tokens[decl.type]);
+
+ case EXPORT:
+ for (var i = 0; i < decl.pathList.length; i++) {
+ var path = decl.pathList[i];
+ switch (path.type) {
+ case OBJECT_INIT:
+ for (var j = 0; j < path.children.length; j++) {
+ // init :: IDENTIFIER | PROPERTY_INIT
+ var init = path.children[j];
+ if (init.type === IDENTIFIER)
+ register(init.value, new Export(init, false));
+ else
+ register(init.children[0].value, new Export(init.children[1], false));
+ }
+ break;
+
+ case DOT:
+ register(path.children[1].value, new Export(path, false));
+ break;
+
+ case IDENTIFIER:
+ register(path.value, new Export(path, false));
+ break;
+
+ default:
+ throw new Error("unexpected export path: " + definitions.tokens[path.type]);
+ }
+ }
+ break;
+
+ default:
+ throw new Error("unexpected export decl: " + definitions.tokens[exp.type]);
+ }
+ }
+
+ /*
+ * Module :: (node) -> Module
+ *
+ * Static semantic representation of a module.
+ */
+ function Module(node) {
+ var exports = node.body.exports;
+ var modDefns = node.body.modDefns;
+
+ var exportedModules = new StringMap();
+
+ exports.forEach(function(name, exp) {
+ var node = exp.node;
+ if (node.type === MODULE) {
+ exportedModules.set(name, node);
+ } else if (!exp.isDefinition && node.type === IDENTIFIER && modDefns.has(node.value)) {
+ var mod = modDefns.get(node.value);
+ exportedModules.set(name, mod);
+ }
+ });
+
+ this.node = node;
+ this.exports = exports;
+ this.exportedModules = exportedModules;
+ }
+
+ /*
+ * Statement :: (tokenizer, compiler context) -> node
+ *
+ * Parses a Statement.
+ */
+ function Statement(t, x) {
+ var i, label, n, n2, p, c, ss, tt = t.get(true), tt2, x2, x3;
+
+ var comments = t.blockComments;
+
+ if (x.blackList[tt])
+ throw t.newSyntaxError(definitions.tokens[tt] + " statements only allowed in Harmony");
+ if (!x.allow(tt))
+ throw t.newSyntaxError(definitions.tokens[tt] + " statement in illegal context");
+
+ // Cases for statements ending in a right curly return early, avoiding the
+ // common semicolon insertion magic after this switch.
+ switch (tt) {
+ case IMPORT:
+ n = new Node(t);
+ n.pathList = ImportPathList(t, x);
+ x.parentScript.impDecls.push(n);
+ n.blockComments = comments;
+ break;
+
+ case EXPORT:
+ switch (t.peek()) {
+ case MODULE:
+ case FUNCTION:
+ case LET:
+ case VAR:
+ case CONST:
+ n = Statement(t, x);
+ n.blockComments = comments;
+ n.exported = true;
+ x.parentScript.expDecls.push(n);
+ registerExport(x.parentScript.exports, n);
+ return n;
+
+ default:
+ n = new Node(t);
+ n.blockComments = comments;
+ n.pathList = ExportPathList(t, x);
+ break;
+ }
+ x.parentScript.expDecls.push(n);
+ registerExport(x.parentScript.exports, n);
+ break;
+
+ case MODULE:
+ n = new Node(t);
+ n.blockComments = comments;
+ t.mustMatch(IDENTIFIER);
+ label = t.token.value;
+
+ if (t.match(LEFT_CURLY)) {
+ n.name = label;
+ n.body = Script(t, true, false);
+ n.module = new Module(n);
+ t.mustMatch(RIGHT_CURLY);
+ x.parentScript.modDefns.set(n.name, n);
+ return n;
+ }
+
+ t.unget();
+ ModuleVariables(t, x, n);
+ return n;
+
+ case FUNCTION:
+ // DECLARED_FORM extends funDecls of x, STATEMENT_FORM doesn't.
+ return FunctionDefinition(t, x, true, x.topLevel ? DECLARED_FORM : STATEMENT_FORM, comments);
+
+ case LEFT_CURLY:
+ n = new Node(t, blockInit());
+ n.blockComments = comments;
+ Statements(t, x.update({ parentBlock: n }).pushTarget(n).nest(), n);
+ t.mustMatch(RIGHT_CURLY);
+ return n;
+
+ case IF:
+ n = new Node(t);
+ n.blockComments = comments;
+ n.condition = HeadExpression(t, x);
+ x2 = x.pushTarget(n).nest();
+ n.thenPart = Statement(t, x2);
+ n.elsePart = t.match(ELSE, true) ? Statement(t, x2) : null;
+ return n;
+
+ case SWITCH:
+ // This allows CASEs after a DEFAULT, which is in the standard.
+ n = new Node(t, { cases: [], defaultIndex: -1 });
+ n.blockComments = comments;
+ n.discriminant = HeadExpression(t, x);
+ x2 = x.pushTarget(n).nest();
+ t.mustMatch(LEFT_CURLY);
+ while ((tt = t.get()) !== RIGHT_CURLY) {
+ switch (tt) {
+ case DEFAULT:
+ if (n.defaultIndex >= 0)
+ throw t.newSyntaxError("More than one switch default");
+ // FALL THROUGH
+ case CASE:
+ n2 = new Node(t);
+ if (tt === DEFAULT)
+ n.defaultIndex = n.cases.length;
+ else
+ n2.caseLabel = Expression(t, x2, COLON);
+ break;
+
+ default:
+ throw t.newSyntaxError("Invalid switch case");
+ }
+ t.mustMatch(COLON);
+ n2.statements = new Node(t, blockInit());
+ while ((tt=t.peek(true)) !== CASE && tt !== DEFAULT &&
+ tt !== RIGHT_CURLY)
+ n2.statements.push(Statement(t, x2));
+ n.cases.push(n2);
+ }
+ return n;
+
+ case FOR:
+ n = new Node(t, LOOP_INIT);
+ n.blockComments = comments;
+ if (t.match(IDENTIFIER)) {
+ if (t.token.value === "each")
+ n.isEach = true;
+ else
+ t.unget();
+ }
+ if (!x.parenFreeMode)
+ t.mustMatch(LEFT_PAREN);
+ x2 = x.pushTarget(n).nest();
+ x3 = x.update({ inForLoopInit: true });
+ n2 = null;
+ if ((tt = t.peek(true)) !== SEMICOLON) {
+ if (tt === VAR || tt === CONST) {
+ t.get();
+ n2 = Variables(t, x3);
+ } else if (tt === LET) {
+ t.get();
+ if (t.peek() === LEFT_PAREN) {
+ n2 = LetBlock(t, x3, false);
+ } else {
+ // Let in for head, we need to add an implicit block
+ // around the rest of the for.
+ x3.parentBlock = n;
+ n.varDecls = [];
+ n2 = Variables(t, x3);
+ }
+ } else {
+ n2 = Expression(t, x3);
+ }
+ }
+ if (n2 && t.match(IN)) {
+ n.type = FOR_IN;
+ n.object = Expression(t, x3);
+ if (n2.type === VAR || n2.type === LET) {
+ c = n2.children;
+
+ // Destructuring turns one decl into multiples, so either
+ // there must be only one destructuring or only one
+ // decl.
+ if (c.length !== 1 && n2.destructurings.length !== 1) {
+ throw new SyntaxError("Invalid for..in left-hand side",
+ t.filename, n2.lineno);
+ }
+ if (n2.destructurings.length > 0) {
+ n.iterator = n2.destructurings[0];
+ } else {
+ n.iterator = c[0];
+ }
+ n.varDecl = n2;
+ } else {
+ if (n2.type === ARRAY_INIT || n2.type === OBJECT_INIT) {
+ n2.destructuredNames = checkDestructuring(t, x3, n2);
+ }
+ n.iterator = n2;
+ }
+ } else {
+ x3.inForLoopInit = false;
+ n.setup = n2;
+ t.mustMatch(SEMICOLON);
+ if (n.isEach)
+ throw t.newSyntaxError("Invalid for each..in loop");
+ n.condition = (t.peek(true) === SEMICOLON)
+ ? null
+ : Expression(t, x3);
+ t.mustMatch(SEMICOLON);
+ tt2 = t.peek(true);
+ n.update = (x.parenFreeMode
+ ? tt2 === LEFT_CURLY || definitions.isStatementStartCode[tt2]
+ : tt2 === RIGHT_PAREN)
+ ? null
+ : Expression(t, x3);
+ }
+ if (!x.parenFreeMode)
+ t.mustMatch(RIGHT_PAREN);
+ n.body = Statement(t, x2);
+ return n;
+
+ case WHILE:
+ n = new Node(t, { isLoop: true });
+ n.blockComments = comments;
+ n.condition = HeadExpression(t, x);
+ n.body = Statement(t, x.pushTarget(n).nest());
+ return n;
+
+ case DO:
+ n = new Node(t, { isLoop: true });
+ n.blockComments = comments;
+ n.body = Statement(t, x.pushTarget(n).nest());
+ t.mustMatch(WHILE);
+ n.condition = HeadExpression(t, x);
+ if (!x.ecmaStrictMode) {
+ // <script language="JavaScript"> (without version hints) may need
+ // automatic semicolon insertion without a newline after do-while.
+ // See http://bugzilla.mozilla.org/show_bug.cgi?id=238945.
+ t.match(SEMICOLON);
+ return n;
+ }
+ break;
+
+ case BREAK:
+ case CONTINUE:
+ n = new Node(t);
+ n.blockComments = comments;
+
+ // handle the |foo: break foo;| corner case
+ x2 = x.pushTarget(n);
+
+ if (t.peekOnSameLine() === IDENTIFIER) {
+ t.get();
+ n.label = t.token.value;
+ }
+
+ if (n.label) {
+ n.target = x2.labeledTargets.find(function(target) { return target.labels.has(n.label) });
+ } else if (tt === CONTINUE) {
+ n.target = x2.defaultLoopTarget;
+ } else {
+ n.target = x2.defaultTarget;
+ }
+
+ if (!n.target)
+ throw t.newSyntaxError("Invalid " + ((tt === BREAK) ? "break" : "continue"));
+ if (!n.target.isLoop && tt === CONTINUE)
+ throw t.newSyntaxError("Invalid continue");
+
+ break;
+
+ case TRY:
+ n = new Node(t, { catchClauses: [] });
+ n.blockComments = comments;
+ n.tryBlock = Block(t, x);
+ while (t.match(CATCH)) {
+ n2 = new Node(t);
+ p = MaybeLeftParen(t, x);
+ switch (t.get()) {
+ case LEFT_BRACKET:
+ case LEFT_CURLY:
+ // Destructured catch identifiers.
+ t.unget();
+ n2.varName = DestructuringExpression(t, x, true);
+ break;
+ case IDENTIFIER:
+ n2.varName = t.token.value;
+ break;
+ default:
+ throw t.newSyntaxError("missing identifier in catch");
+ break;
+ }
+ if (t.match(IF)) {
+ if (x.ecma3OnlyMode)
+ throw t.newSyntaxError("Illegal catch guard");
+ if (n.catchClauses.length && !n.catchClauses.top().guard)
+ throw t.newSyntaxError("Guarded catch after unguarded");
+ n2.guard = Expression(t, x);
+ }
+ MaybeRightParen(t, p);
+ n2.block = Block(t, x);
+ n.catchClauses.push(n2);
+ }
+ if (t.match(FINALLY))
+ n.finallyBlock = Block(t, x);
+ if (!n.catchClauses.length && !n.finallyBlock)
+ throw t.newSyntaxError("Invalid try statement");
+ return n;
+
+ case CATCH:
+ case FINALLY:
+ throw t.newSyntaxError(definitions.tokens[tt] + " without preceding try");
+
+ case THROW:
+ n = new Node(t);
+ n.blockComments = comments;
+ n.exception = Expression(t, x);
+ break;
+
+ case RETURN:
+ n = ReturnOrYield(t, x);
+ break;
+
+ case WITH:
+ n = new Node(t);
+ n.blockComments = comments;
+ n.object = HeadExpression(t, x);
+ n.body = Statement(t, x.pushTarget(n).nest());
+ return n;
+
+ case VAR:
+ case CONST:
+ n = Variables(t, x);
+ break;
+
+ case LET:
+ if (t.peek() === LEFT_PAREN)
+ n = LetBlock(t, x, true);
+ else
+ n = Variables(t, x);
+ break;
+
+ case DEBUGGER:
+ n = new Node(t);
+ n.blockComments = comments;
+ break;
+
+ case NEWLINE:
+ case SEMICOLON:
+ n = new Node(t, { type: SEMICOLON });
+ n.blockComments = comments;
+ n.expression = null;
+ return n;
+
+ default:
+ if (tt === IDENTIFIER) {
+ tt = t.peek();
+ // Labeled statement.
+ if (tt === COLON) {
+ label = t.token.value;
+ if (x.allLabels.has(label))
+ throw t.newSyntaxError("Duplicate label");
+ t.get();
+ n = new Node(t, { type: LABEL, label: label });
+ n.blockComments = comments;
+ n.statement = Statement(t, x.pushLabel(label).nest());
+ n.target = (n.statement.type === LABEL) ? n.statement.target : n.statement;
+ return n;
+ }
+ }
+
+ // Expression statement.
+ // We unget the current token to parse the expression as a whole.
+ n = new Node(t, { type: SEMICOLON });
+ t.unget();
+ n.blockComments = comments;
+ n.expression = Expression(t, x);
+ n.end = n.expression.end;
+ break;
+ }
+
+ n.blockComments = comments;
+ MagicalSemicolon(t);
+ return n;
+ }
+
+ /*
+ * MagicalSemicolon :: (tokenizer) -> void
+ */
+ function MagicalSemicolon(t) {
+ var tt;
+ if (t.lineno === t.token.lineno) {
+ tt = t.peekOnSameLine();
+ if (tt !== END && tt !== NEWLINE && tt !== SEMICOLON && tt !== RIGHT_CURLY)
+ throw t.newSyntaxError("missing ; before statement");
+ }
+ t.match(SEMICOLON);
+ }
+
+ /*
+ * ReturnOrYield :: (tokenizer, compiler context) -> (RETURN | YIELD) node
+ */
+ function ReturnOrYield(t, x) {
+ var n, b, tt = t.token.type, tt2;
+
+ var parentScript = x.parentScript;
+
+ if (tt === RETURN) {
+ if (!x.inFunction) {
+ // pass
+ //throw t.newSyntaxError("Return not in function");
+ }
+
+ } else /* if (tt === YIELD) */ {
+ if (!x.inFunction)
+ throw t.newSyntaxError("Yield not in function");
+ parentScript.isGenerator = true;
+ }
+ n = new Node(t, { value: undefined });
+
+ tt2 = (tt === RETURN) ? t.peekOnSameLine(true) : t.peek(true);
+ if (tt2 !== END && tt2 !== NEWLINE &&
+ tt2 !== SEMICOLON && tt2 !== RIGHT_CURLY
+ && (tt !== YIELD ||
+ (tt2 !== tt && tt2 !== RIGHT_BRACKET && tt2 !== RIGHT_PAREN &&
+ tt2 !== COLON && tt2 !== COMMA))) {
+ if (tt === RETURN) {
+ n.value = Expression(t, x);
+ parentScript.hasReturnWithValue = true;
+ } else {
+ n.value = AssignExpression(t, x);
+ }
+ } else if (tt === RETURN) {
+ parentScript.hasEmptyReturn = true;
+ }
+
+ // Disallow return v; in generator.
+ if (parentScript.hasReturnWithValue && parentScript.isGenerator)
+ throw t.newSyntaxError("Generator returns a value");
+
+ return n;
+ }
+
+ /*
+ * ModuleExpression :: (tokenizer, compiler context) -> (STRING | IDENTIFIER | DOT) node
+ */
+ function ModuleExpression(t, x) {
+ return t.match(STRING) ? new Node(t) : QualifiedPath(t, x);
+ }
+
+ /*
+ * ImportPathList :: (tokenizer, compiler context) -> Array[DOT node]
+ */
+ function ImportPathList(t, x) {
+ var a = [];
+ do {
+ a.push(ImportPath(t, x));
+ } while (t.match(COMMA));
+ return a;
+ }
+
+ /*
+ * ImportPath :: (tokenizer, compiler context) -> DOT node
+ */
+ function ImportPath(t, x) {
+ var n = QualifiedPath(t, x);
+ if (!t.match(DOT)) {
+ if (n.type === IDENTIFIER)
+ throw t.newSyntaxError("cannot import local variable");
+ return n;
+ }
+
+ var n2 = new Node(t);
+ n2.push(n);
+ n2.push(ImportSpecifierSet(t, x));
+ return n2;
+ }
+
+ /*
+ * ExplicitSpecifierSet :: (tokenizer, compiler context, (tokenizer, compiler context) -> node)
+ * -> OBJECT_INIT node
+ */
+ function ExplicitSpecifierSet(t, x, SpecifierRHS) {
+ var n, n2, id, tt;
+
+ n = new Node(t, { type: OBJECT_INIT });
+ t.mustMatch(LEFT_CURLY);
+
+ if (!t.match(RIGHT_CURLY)) {
+ do {
+ id = Identifier(t, x);
+ if (t.match(COLON)) {
+ n2 = new Node(t, { type: PROPERTY_INIT });
+ n2.push(id);
+ n2.push(SpecifierRHS(t, x));
+ n.push(n2);
+ } else {
+ n.push(id);
+ }
+ } while (!t.match(RIGHT_CURLY) && t.mustMatch(COMMA));
+ }
+
+ return n;
+ }
+
+ /*
+ * ImportSpecifierSet :: (tokenizer, compiler context) -> (IDENTIFIER | OBJECT_INIT) node
+ */
+ function ImportSpecifierSet(t, x) {
+ return t.match(MUL)
+ ? new Node(t, { type: IDENTIFIER, name: "*" })
+ : ExplicitSpecifierSet(t, x, Identifier);
+ }
+
+ /*
+ * Identifier :: (tokenizer, compiler context) -> IDENTIFIER node
+ */
+ function Identifier(t, x) {
+ t.mustMatch(IDENTIFIER);
+ return new Node(t, { type: IDENTIFIER });
+ }
+
+ /*
+ * IdentifierName :: (tokenizer) -> IDENTIFIER node
+ */
+ function IdentifierName(t) {
+ if (t.match(IDENTIFIER))
+ return new Node(t, { type: IDENTIFIER });
+ t.get();
+ if (t.token.value in definitions.keywords)
+ return new Node(t, { type: IDENTIFIER });
+ throw t.newSyntaxError("missing IdentifierName");
+ }
+
+ /*
+ * QualifiedPath :: (tokenizer, compiler context) -> (IDENTIFIER | DOT) node
+ */
+ function QualifiedPath(t, x) {
+ var n, n2;
+
+ n = Identifier(t, x);
+
+ while (t.match(DOT)) {
+ if (t.peek() !== IDENTIFIER) {
+ // Unget the '.' token, which isn't part of the QualifiedPath.
+ t.unget();
+ break;
+ }
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(Identifier(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ /*
+ * ExportPath :: (tokenizer, compiler context) -> (IDENTIFIER | DOT | OBJECT_INIT) node
+ */
+ function ExportPath(t, x) {
+ if (t.peek() === LEFT_CURLY)
+ return ExplicitSpecifierSet(t, x, QualifiedPath);
+ return QualifiedPath(t, x);
+ }
+
+ /*
+ * ExportPathList :: (tokenizer, compiler context)
+ * -> Array[(IDENTIFIER | DOT | OBJECT_INIT) node]
+ */
+ function ExportPathList(t, x) {
+ var a = [];
+ do {
+ a.push(ExportPath(t, x));
+ } while (t.match(COMMA));
+ return a;
+ }
+
+ /*
+ * FunctionDefinition :: (tokenizer, compiler context, boolean,
+ * DECLARED_FORM or EXPRESSED_FORM or STATEMENT_FORM,
+ * [string] or null or undefined)
+ * -> node
+ */
+ function FunctionDefinition(t, x, requireName, functionForm, comments) {
+ var tt;
+ var f = new Node(t, { params: [], paramComments: [] });
+ if (typeof comment === "undefined")
+ comment = null;
+ f.blockComments = comments;
+ if (f.type !== FUNCTION)
+ f.type = (f.value === "get") ? GETTER : SETTER;
+ if (t.match(IDENTIFIER))
+ f.name = t.token.value;
+ else if (requireName)
+ throw t.newSyntaxError("missing function identifier");
+
+ var inModule = x ? x.inModule : false;
+ var x2 = new StaticContext(null, null, inModule, true);
+
+ t.mustMatch(LEFT_PAREN);
+ if (!t.match(RIGHT_PAREN)) {
+ do {
+ tt = t.get();
+ f.paramComments.push(t.lastBlockComment());
+ switch (tt) {
+ case LEFT_BRACKET:
+ case LEFT_CURLY:
+ // Destructured formal parameters.
+ t.unget();
+ f.params.push(DestructuringExpression(t, x2));
+ break;
+ case IDENTIFIER:
+ f.params.push(t.token.value);
+ break;
+ default:
+ throw t.newSyntaxError("missing formal parameter");
+ break;
+ }
+ } while (t.match(COMMA));
+ t.mustMatch(RIGHT_PAREN);
+ }
+
+ // Do we have an expression closure or a normal body?
+ tt = t.get();
+ if (tt !== LEFT_CURLY)
+ t.unget();
+
+ if (tt !== LEFT_CURLY) {
+ f.body = AssignExpression(t, x2);
+ if (f.body.isGenerator)
+ throw t.newSyntaxError("Generator returns a value");
+ } else {
+ f.body = Script(t, inModule, true);
+ }
+
+ if (tt === LEFT_CURLY)
+ t.mustMatch(RIGHT_CURLY);
+
+ f.end = t.token.end;
+ f.functionForm = functionForm;
+ if (functionForm === DECLARED_FORM)
+ x.parentScript.funDecls.push(f);
+ return f;
+ }
+
+ /*
+ * ModuleVariables :: (tokenizer, compiler context, MODULE node) -> void
+ *
+ * Parses a comma-separated list of module declarations (and maybe
+ * initializations).
+ */
+ function ModuleVariables(t, x, n) {
+ var n1, n2;
+ do {
+ n1 = Identifier(t, x);
+ if (t.match(ASSIGN)) {
+ n2 = ModuleExpression(t, x);
+ n1.initializer = n2;
+ if (n2.type === STRING)
+ x.parentScript.modLoads.set(n1.value, n2.value);
+ else
+ x.parentScript.modAssns.set(n1.value, n1);
+ }
+ n.push(n1);
+ } while (t.match(COMMA));
+ }
+
+ /*
+ * Variables :: (tokenizer, compiler context) -> node
+ *
+ * Parses a comma-separated list of var declarations (and maybe
+ * initializations).
+ */
+ function Variables(t, x, letBlock) {
+ var n, n2, ss, i, s, tt;
+
+ tt = t.token.type;
+ switch (tt) {
+ case VAR:
+ case CONST:
+ s = x.parentScript;
+ break;
+ case LET:
+ s = x.parentBlock;
+ break;
+ case LEFT_PAREN:
+ tt = LET;
+ s = letBlock;
+ break;
+ }
+
+ n = new Node(t, { type: tt, destructurings: [] });
+
+ do {
+ tt = t.get();
+ if (tt === LEFT_BRACKET || tt === LEFT_CURLY) {
+ // Need to unget to parse the full destructured expression.
+ t.unget();
+
+ var dexp = DestructuringExpression(t, x, true);
+
+ n2 = new Node(t, { type: IDENTIFIER,
+ name: dexp,
+ readOnly: n.type === CONST });
+ n.push(n2);
+ pushDestructuringVarDecls(n2.name.destructuredNames, s);
+ n.destructurings.push({ exp: dexp, decl: n2 });
+
+ if (x.inForLoopInit && t.peek() === IN) {
+ continue;
+ }
+
+ t.mustMatch(ASSIGN);
+ if (t.token.assignOp)
+ throw t.newSyntaxError("Invalid variable initialization");
+
+ n2.blockComment = t.lastBlockComment();
+ n2.initializer = AssignExpression(t, x);
+
+ continue;
+ }
+
+ if (tt !== IDENTIFIER)
+ throw t.newSyntaxError("missing variable name");
+
+ n2 = new Node(t, { type: IDENTIFIER,
+ name: t.token.value,
+ readOnly: n.type === CONST });
+ n.push(n2);
+ s.varDecls.push(n2);
+
+ if (t.match(ASSIGN)) {
+ var comment = t.lastBlockComment();
+ if (t.token.assignOp)
+ throw t.newSyntaxError("Invalid variable initialization");
+
+ n2.initializer = AssignExpression(t, x);
+ } else {
+ var comment = t.lastBlockComment();
+ }
+ n2.blockComment = comment;
+ } while (t.match(COMMA));
+
+ return n;
+ }
+
+ /*
+ * LetBlock :: (tokenizer, compiler context, boolean) -> node
+ *
+ * Does not handle let inside of for loop init.
+ */
+ function LetBlock(t, x, isStatement) {
+ var n, n2;
+
+ // t.token.type must be LET
+ n = new Node(t, { type: LET_BLOCK, varDecls: [] });
+ t.mustMatch(LEFT_PAREN);
+ n.variables = Variables(t, x, n);
+ t.mustMatch(RIGHT_PAREN);
+
+ if (isStatement && t.peek() !== LEFT_CURLY) {
+ /*
+ * If this is really an expression in let statement guise, then we
+ * need to wrap the LET_BLOCK node in a SEMICOLON node so that we pop
+ * the return value of the expression.
+ */
+ n2 = new Node(t, { type: SEMICOLON,
+ expression: n });
+ isStatement = false;
+ }
+
+ if (isStatement)
+ n.block = Block(t, x);
+ else
+ n.expression = AssignExpression(t, x);
+
+ return n;
+ }
+
+ function checkDestructuring(t, x, n, simpleNamesOnly) {
+ if (n.type === ARRAY_COMP)
+ throw t.newSyntaxError("Invalid array comprehension left-hand side");
+ if (n.type !== ARRAY_INIT && n.type !== OBJECT_INIT)
+ return undefined;
+
+ var lhss = {};
+ var nn, n2, idx, sub, cc, c = n.children;
+ for (var i = 0, j = c.length; i < j; i++) {
+ if (!(nn = c[i]))
+ continue;
+ if (nn.type === PROPERTY_INIT) {
+ cc = nn.children;
+ sub = cc[1];
+ idx = cc[0].value;
+ } else if (n.type === OBJECT_INIT) {
+ // Do we have destructuring shorthand {foo, bar}?
+ sub = nn;
+ idx = nn.value;
+ } else {
+ sub = nn;
+ idx = i;
+ }
+
+ if (sub.type === ARRAY_INIT || sub.type === OBJECT_INIT) {
+ lhss[idx] = checkDestructuring(t, x, sub, simpleNamesOnly);
+ } else {
+ if (simpleNamesOnly && sub.type !== IDENTIFIER) {
+ // In declarations, lhs must be simple names
+ throw t.newSyntaxError("missing name in pattern");
+ }
+
+ lhss[idx] = sub;
+ }
+ }
+
+ return lhss;
+ }
+
+ function DestructuringExpression(t, x, simpleNamesOnly) {
+ var n = PrimaryExpression(t, x);
+ // Keep the list of lefthand sides for varDecls
+ n.destructuredNames = checkDestructuring(t, x, n, simpleNamesOnly);
+ return n;
+ }
+
+ function GeneratorExpression(t, x, e) {
+ return new Node(t, { type: GENERATOR,
+ expression: e,
+ tail: ComprehensionTail(t, x) });
+ }
+
+ function ComprehensionTail(t, x) {
+ var body, n, n2, n3, p;
+
+ // t.token.type must be FOR
+ body = new Node(t, { type: COMP_TAIL });
+
+ do {
+ // Comprehension tails are always for..in loops.
+ n = new Node(t, { type: FOR_IN, isLoop: true });
+ if (t.match(IDENTIFIER)) {
+ // But sometimes they're for each..in.
+ if (t.token.value === "each")
+ n.isEach = true;
+ else
+ t.unget();
+ }
+ p = MaybeLeftParen(t, x);
+ switch(t.get()) {
+ case LEFT_BRACKET:
+ case LEFT_CURLY:
+ t.unget();
+ // Destructured left side of for in comprehension tails.
+ n.iterator = DestructuringExpression(t, x);
+ break;
+
+ case IDENTIFIER:
+ n.iterator = n3 = new Node(t, { type: IDENTIFIER });
+ n3.name = n3.value;
+ n.varDecl = n2 = new Node(t, { type: VAR });
+ n2.push(n3);
+ x.parentScript.varDecls.push(n3);
+ // Don't add to varDecls since the semantics of comprehensions is
+ // such that the variables are in their own function when
+ // desugared.
+ break;
+
+ default:
+ throw t.newSyntaxError("missing identifier");
+ }
+ t.mustMatch(IN);
+ n.object = Expression(t, x);
+ MaybeRightParen(t, p);
+ body.push(n);
+ } while (t.match(FOR));
+
+ // Optional guard.
+ if (t.match(IF))
+ body.guard = HeadExpression(t, x);
+
+ return body;
+ }
+
+ function HeadExpression(t, x) {
+ var p = MaybeLeftParen(t, x);
+ var n = ParenExpression(t, x);
+ MaybeRightParen(t, p);
+ if (p === END && !n.parenthesized) {
+ var tt = t.peek();
+ if (tt !== LEFT_CURLY && !definitions.isStatementStartCode[tt])
+ throw t.newSyntaxError("Unparenthesized head followed by unbraced body");
+ }
+ return n;
+ }
+
+ function ParenExpression(t, x) {
+ // Always accept the 'in' operator in a parenthesized expression,
+ // where it's unambiguous, even if we might be parsing the init of a
+ // for statement.
+ var n = Expression(t, x.update({ inForLoopInit: x.inForLoopInit &&
+ (t.token.type === LEFT_PAREN) }));
+
+ if (t.match(FOR)) {
+ if (n.type === YIELD && !n.parenthesized)
+ throw t.newSyntaxError("Yield expression must be parenthesized");
+ if (n.type === COMMA && !n.parenthesized)
+ throw t.newSyntaxError("Generator expression must be parenthesized");
+ n = GeneratorExpression(t, x, n);
+ }
+
+ return n;
+ }
+
+ /*
+ * Expression :: (tokenizer, compiler context) -> node
+ *
+ * Top-down expression parser matched against SpiderMonkey.
+ */
+ function Expression(t, x) {
+ var n, n2;
+
+ n = AssignExpression(t, x);
+ if (t.match(COMMA)) {
+ n2 = new Node(t, { type: COMMA });
+ n2.push(n);
+ n = n2;
+ do {
+ n2 = n.children[n.children.length-1];
+ if (n2.type === YIELD && !n2.parenthesized)
+ throw t.newSyntaxError("Yield expression must be parenthesized");
+ n.push(AssignExpression(t, x));
+ } while (t.match(COMMA));
+ }
+
+ return n;
+ }
+
+ function AssignExpression(t, x) {
+ var n, lhs;
+
+ // Have to treat yield like an operand because it could be the leftmost
+ // operand of the expression.
+ if (t.match(YIELD, true))
+ return ReturnOrYield(t, x);
+
+ n = new Node(t, { type: ASSIGN });
+ lhs = ConditionalExpression(t, x);
+
+ if (!t.match(ASSIGN)) {
+ return lhs;
+ }
+
+ n.blockComment = t.lastBlockComment();
+
+ switch (lhs.type) {
+ case OBJECT_INIT:
+ case ARRAY_INIT:
+ lhs.destructuredNames = checkDestructuring(t, x, lhs);
+ // FALL THROUGH
+ case IDENTIFIER: case DOT: case INDEX: case CALL:
+ break;
+ default:
+ throw t.newSyntaxError("Bad left-hand side of assignment");
+ break;
+ }
+
+ n.assignOp = lhs.assignOp = t.token.assignOp;
+ n.push(lhs);
+ n.push(AssignExpression(t, x));
+
+ return n;
+ }
+
+ function ConditionalExpression(t, x) {
+ var n, n2;
+
+ n = OrExpression(t, x);
+ if (t.match(HOOK)) {
+ n2 = n;
+ n = new Node(t, { type: HOOK });
+ n.push(n2);
+ /*
+ * Always accept the 'in' operator in the middle clause of a ternary,
+ * where it's unambiguous, even if we might be parsing the init of a
+ * for statement.
+ */
+ n.push(AssignExpression(t, x.update({ inForLoopInit: false })));
+ if (!t.match(COLON))
+ throw t.newSyntaxError("missing : after ?");
+ n.push(AssignExpression(t, x));
+ }
+
+ return n;
+ }
+
+ function OrExpression(t, x) {
+ var n, n2;
+
+ n = AndExpression(t, x);
+ while (t.match(OR)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(AndExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function AndExpression(t, x) {
+ var n, n2;
+
+ n = BitwiseOrExpression(t, x);
+ while (t.match(AND)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(BitwiseOrExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function BitwiseOrExpression(t, x) {
+ var n, n2;
+
+ n = BitwiseXorExpression(t, x);
+ while (t.match(BITWISE_OR)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(BitwiseXorExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function BitwiseXorExpression(t, x) {
+ var n, n2;
+
+ n = BitwiseAndExpression(t, x);
+ while (t.match(BITWISE_XOR)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(BitwiseAndExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function BitwiseAndExpression(t, x) {
+ var n, n2;
+
+ n = EqualityExpression(t, x);
+ while (t.match(BITWISE_AND)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(EqualityExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function EqualityExpression(t, x) {
+ var n, n2;
+
+ n = RelationalExpression(t, x);
+ while (t.match(EQ) || t.match(NE) ||
+ t.match(STRICT_EQ) || t.match(STRICT_NE)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(RelationalExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function RelationalExpression(t, x) {
+ var n, n2;
+
+ /*
+ * Uses of the in operator in shiftExprs are always unambiguous,
+ * so unset the flag that prohibits recognizing it.
+ */
+ var x2 = x.update({ inForLoopInit: false });
+ n = ShiftExpression(t, x2);
+ while ((t.match(LT) || t.match(LE) || t.match(GE) || t.match(GT) ||
+ (!x.inForLoopInit && t.match(IN)) ||
+ t.match(INSTANCEOF))) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(ShiftExpression(t, x2));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function ShiftExpression(t, x) {
+ var n, n2;
+
+ n = AddExpression(t, x);
+ while (t.match(LSH) || t.match(RSH) || t.match(URSH)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(AddExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function AddExpression(t, x) {
+ var n, n2;
+
+ n = MultiplyExpression(t, x);
+ while (t.match(PLUS) || t.match(MINUS)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(MultiplyExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function MultiplyExpression(t, x) {
+ var n, n2;
+
+ n = UnaryExpression(t, x);
+ while (t.match(MUL) || t.match(DIV) || t.match(MOD)) {
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(UnaryExpression(t, x));
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function UnaryExpression(t, x) {
+ var n, n2, tt;
+
+ switch (tt = t.get(true)) {
+ case DELETE: case VOID: case TYPEOF:
+ case NOT: case BITWISE_NOT: case PLUS: case MINUS:
+ if (tt === PLUS)
+ n = new Node(t, { type: UNARY_PLUS });
+ else if (tt === MINUS)
+ n = new Node(t, { type: UNARY_MINUS });
+ else
+ n = new Node(t);
+ n.push(UnaryExpression(t, x));
+ break;
+
+ case INCREMENT:
+ case DECREMENT:
+ // Prefix increment/decrement.
+ n = new Node(t);
+ n.push(MemberExpression(t, x, true));
+ break;
+
+ default:
+ t.unget();
+ n = MemberExpression(t, x, true);
+
+ // Don't look across a newline boundary for a postfix {in,de}crement.
+ if (t.tokens[(t.tokenIndex + t.lookahead - 1) & 3].lineno ===
+ t.lineno) {
+ if (t.match(INCREMENT) || t.match(DECREMENT)) {
+ n2 = new Node(t, { postfix: true });
+ n2.push(n);
+ n = n2;
+ }
+ }
+ break;
+ }
+
+ return n;
+ }
+
+ function MemberExpression(t, x, allowCallSyntax) {
+ var n, n2, name, tt;
+
+ if (t.match(NEW)) {
+ n = new Node(t);
+ n.push(MemberExpression(t, x, false));
+ if (t.match(LEFT_PAREN)) {
+ n.type = NEW_WITH_ARGS;
+ n.push(ArgumentList(t, x));
+ }
+ } else {
+ n = PrimaryExpression(t, x);
+ }
+
+ while ((tt = t.get()) !== END) {
+ switch (tt) {
+ case DOT:
+ n2 = new Node(t);
+ n2.push(n);
+ n2.push(IdentifierName(t));
+ break;
+
+ case LEFT_BRACKET:
+ n2 = new Node(t, { type: INDEX });
+ n2.push(n);
+ n2.push(Expression(t, x));
+ t.mustMatch(RIGHT_BRACKET);
+ break;
+
+ case LEFT_PAREN:
+ if (allowCallSyntax) {
+ n2 = new Node(t, { type: CALL });
+ n2.push(n);
+ n2.push(ArgumentList(t, x));
+ break;
+ }
+
+ // FALL THROUGH
+ default:
+ t.unget();
+ return n;
+ }
+
+ n = n2;
+ }
+
+ return n;
+ }
+
+ function ArgumentList(t, x) {
+ var n, n2;
+
+ n = new Node(t, { type: LIST });
+ if (t.match(RIGHT_PAREN, true))
+ return n;
+ do {
+ n2 = AssignExpression(t, x);
+ if (n2.type === YIELD && !n2.parenthesized && t.peek() === COMMA)
+ throw t.newSyntaxError("Yield expression must be parenthesized");
+ if (t.match(FOR)) {
+ n2 = GeneratorExpression(t, x, n2);
+ if (n.children.length > 1 || t.peek(true) === COMMA)
+ throw t.newSyntaxError("Generator expression must be parenthesized");
+ }
+ n.push(n2);
+ } while (t.match(COMMA));
+ t.mustMatch(RIGHT_PAREN);
+
+ return n;
+ }
+
+ function PrimaryExpression(t, x) {
+ var n, n2, tt = t.get(true);
+
+ switch (tt) {
+ case FUNCTION:
+ n = FunctionDefinition(t, x, false, EXPRESSED_FORM);
+ break;
+
+ case LEFT_BRACKET:
+ n = new Node(t, { type: ARRAY_INIT });
+ while ((tt = t.peek(true)) !== RIGHT_BRACKET) {
+ if (tt === COMMA) {
+ t.get();
+ n.push(null);
+ continue;
+ }
+ n.push(AssignExpression(t, x));
+ if (tt !== COMMA && !t.match(COMMA))
+ break;
+ }
+
+ // If we matched exactly one element and got a FOR, we have an
+ // array comprehension.
+ if (n.children.length === 1 && t.match(FOR)) {
+ n2 = new Node(t, { type: ARRAY_COMP,
+ expression: n.children[0],
+ tail: ComprehensionTail(t, x) });
+ n = n2;
+ }
+ t.mustMatch(RIGHT_BRACKET);
+ break;
+
+ case LEFT_CURLY:
+ var id, fd;
+ n = new Node(t, { type: OBJECT_INIT });
+
+ object_init:
+ if (!t.match(RIGHT_CURLY)) {
+ do {
+ tt = t.get();
+ if ((t.token.value === "get" || t.token.value === "set") &&
+ t.peek() === IDENTIFIER) {
+ if (x.ecma3OnlyMode)
+ throw t.newSyntaxError("Illegal property accessor");
+ n.push(FunctionDefinition(t, x, true, EXPRESSED_FORM));
+ } else {
+ var comments = t.blockComments;
+ switch (tt) {
+ case IDENTIFIER: case NUMBER: case STRING:
+ id = new Node(t, { type: IDENTIFIER });
+ break;
+ case RIGHT_CURLY:
+ if (x.ecma3OnlyMode)
+ throw t.newSyntaxError("Illegal trailing ,");
+ break object_init;
+ default:
+ if (t.token.value in definitions.keywords) {
+ id = new Node(t, { type: IDENTIFIER });
+ break;
+ }
+ throw t.newSyntaxError("Invalid property name");
+ }
+ if (t.match(COLON)) {
+ n2 = new Node(t, { type: PROPERTY_INIT });
+ n2.push(id);
+ n2.push(AssignExpression(t, x));
+ n2.blockComments = comments;
+ n.push(n2);
+ } else {
+ // Support, e.g., |var {x, y} = o| as destructuring shorthand
+ // for |var {x: x, y: y} = o|, per proposed JS2/ES4 for JS1.8.
+ if (t.peek() !== COMMA && t.peek() !== RIGHT_CURLY)
+ throw t.newSyntaxError("missing : after property");
+ n.push(id);
+ }
+ }
+ } while (t.match(COMMA));
+ t.mustMatch(RIGHT_CURLY);
+ }
+ break;
+
+ case LEFT_PAREN:
+ n = ParenExpression(t, x);
+ t.mustMatch(RIGHT_PAREN);
+ n.parenthesized = true;
+ break;
+
+ case LET:
+ n = LetBlock(t, x, false);
+ break;
+
+ case NULL: case THIS: case TRUE: case FALSE:
+ case IDENTIFIER: case NUMBER: case STRING: case REGEXP:
+ n = new Node(t);
+ break;
+
+ default:
+ n = new Node(t);
+ // don't throw an error by default. Just make it a node and forget it :-}
+ //throw t.newSyntaxError("missing operand");
+ break;
+ }
+
+ return n;
+ }
+
+ /*
+ * parse :: (source, filename, line number) -> node
+ */
+ function parse(s, f, l) {
+ var t = new lexer.Tokenizer(s, f, l);
+ var n = Script(t, false, false);
+ if (!t.done)
+ throw t.newSyntaxError("Syntax error");
+
+ return n;
+ }
+
+ /*
+ * parseStdin :: (source, {line number}, string, (string) -> boolean) -> program node
+ */
+ function parseStdin(s, ln, prefix, isCommand) {
+ // the special .begin command is only recognized at the beginning
+ if (s.match(/^[\s]*\.begin[\s]*$/)) {
+ ++ln.value;
+ return parseMultiline(ln, prefix);
+ }
+
+ // commands at the beginning are treated as the entire input
+ if (isCommand(s.trim()))
+ s = "";
+
+ for (;;) {
+ try {
+ var t = new lexer.Tokenizer(s, "stdin", ln.value);
+ var n = Script(t, false, false);
+ ln.value = t.lineno;
+ return n;
+ } catch (e) {
+ if (!t.unexpectedEOF)
+ throw e;
+
+ // commands in the middle are not treated as part of the input
+ var more;
+ do {
+ if (prefix)
+ putstr(prefix);
+ more = readline();
+ if (!more)
+ throw e;
+ } while (isCommand(more.trim()));
+
+ s += "\n" + more;
+ }
+ }
+ }
+
+ /*
+ * parseMultiline :: ({line number}, string | null) -> program node
+ */
+ function parseMultiline(ln, prefix) {
+ var s = "";
+ for (;;) {
+ if (prefix)
+ putstr(prefix);
+ var more = readline();
+ if (more === null)
+ return null;
+ // the only command recognized in multiline mode is .end
+ if (more.match(/^[\s]*\.end[\s]*$/))
+ break;
+ s += "\n" + more;
+ }
+ var t = new lexer.Tokenizer(s, "stdin", ln.value);
+ var n = Script(t, false, false);
+ ln.value = t.lineno;
+ return n;
+ }
+
+ return {
+ parse: parse,
+ parseStdin: parseStdin,
+ Node: Node,
+ SyntheticNode: SyntheticNode,
+ DECLARED_FORM: DECLARED_FORM,
+ EXPRESSED_FORM: EXPRESSED_FORM,
+ STATEMENT_FORM: STATEMENT_FORM,
+ Tokenizer: lexer.Tokenizer,
+ FunctionDefinition: FunctionDefinition,
+ Module: Module,
+ Export: Export
+ };
+
+}());
diff --git a/data/chrome_worker/parser/parse.js b/data/chrome_worker/parser/parse.js
new file mode 100644
index 0000000..c24bbb0
--- /dev/null
+++ b/data/chrome_worker/parser/parse.js
@@ -0,0 +1,55 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * parse.js
+ *
+ * A chrome worker that we keep working for the duration
+ * of the session.
+ *
+ * It takes about 10-12M in memory when not actively running, and it
+ * is much faster than reloading the Narcissus scripts for every
+ * script.
+ *
+ */
+
+importScripts('./jsdefs.js', './jslex.js', './jsparse.js');
+
+self.onmessage = function(event) {
+ if (event.data === 'stop') {
+ // destroy chrome worker.
+ self.close();
+ return;
+ }
+
+ var obj = JSON.parse(event.data);
+ var tree;
+
+ try {
+ tree = new Narcissus.parser.parse(obj.code);
+ self.postMessage({'tree': tree, 'hash': obj.hash});
+ } catch (x) {
+ // error with parsing. Delete all.
+ self.postMessage({'hash': obj.hash});
+ }
+
+ tree = null;
+ obj = null;
+};
diff --git a/data/complain/contact_finder.js b/data/complain/contact_finder.js
new file mode 100644
index 0000000..aece488
--- /dev/null
+++ b/data/complain/contact_finder.js
@@ -0,0 +1,434 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var ContactFinder = function(options) {
+ if (typeof options === 'undefined') {
+ options = {};
+ }
+ this.complaintEmailSubject = options.complaintEmailSubject;
+ this.complaintEmailBody = options.complaintEmailBody;
+
+ // initial full list of links
+ // on a page.
+ this.pageLinks = null;
+
+ // arrays of links.
+ this.certainLinks = null;
+ this.probableLinks = null;
+ this.uncertainLinks = null;
+
+ // if not page worker,
+ // then allow to trigger a page worker.
+ this.isPageWorker = false;
+
+ // keep track of links already visited.
+ this.visitedLinks = {};
+
+ // keep track of the hostname of the original page.
+ this.originalHostname = null;
+};
+
+ContactFinder.prototype.init = function(isPageWorker) {
+ if (isPageWorker) {
+ this.isPageWorker = true;
+ console.debug('visiting', document.location.href);
+ }
+
+ this.convertStringToRegexp();
+};
+
+/**
+ * searchForContactLink Main interface method to call from outside
+ * the object.
+ */
+ContactFinder.prototype.searchForContactLink = function (originalUrl) {
+ // find hostname of original page.
+ this.originalHostname = this.getHostname(originalUrl);
+
+ // initialize arrays of links to keep.
+ this.certainLinks = [];
+ this.probableLinks = [];
+ this.uncertainLinks = [];
+
+ // select all a tags.
+ this.pageLinks = $('a').get();
+
+ this.searchForUSPhoneNumber($('body').text());
+
+ // run through list of links.
+ this.processLinks();
+};
+
+/**
+ * loopThroughLanguages
+ * Select strings for all languages.
+ */
+ContactFinder.prototype.loopThroughLanguages = function (callback) {
+ var le;
+
+ for (var language in contactStr) {
+ for (var degree in contactStr[language]) {
+ le = contactStr[language][degree].length;
+ callback(degree, contactStr[language][degree], le);
+ }
+ }
+};
+
+/**
+ * convertStringToRegexp
+ *
+ */
+ContactFinder.prototype.convertStringToRegexp = function () {
+ var regexpList, i, le;
+ this.loopThroughLanguages(function (degreeName, arr, le) {
+ for (i = 0; i < le; i++) {
+ try {
+ arr[i] = new RegExp(arr[i], 'i');
+ } catch (e) {}
+ }
+ });
+};
+
+/**
+ * processLinks
+ *
+ * Run through the list of links in a page
+ * and call the method that checks the regexs
+ * for each of them.
+ *
+ */
+ContactFinder.prototype.processLinks = function () {
+ var start = Date.now();
+ var currentLink;
+
+ while (this.pageLinks.length) {
+ currentLink = this.pageLinks.pop();
+
+ if (currentLink !== undefined) {
+ this.matchContact(currentLink);
+ }
+
+ var end = Date.now();
+
+ if (this.pageLinks.length) {
+ if ((end - start) > 8) {
+ setTimeout(this.processLinks.bind(this), 100);
+ return;
+ }
+ } else if (this.isPageWorker) {
+ self.postMessage({event: 'destroy'});
+ return;
+ }
+ }
+};
+
+/**
+ * searchForUSPhoneNumber
+ *
+ */
+ContactFinder.prototype.searchForUSPhoneNumber = function (str) {
+ var phoneMatch, phone;
+ var regClutter = /[\(\)\-\. ]+/gm;
+
+ while ((phoneMatch = usaPhoneNumber.exec(str)) !== null) {
+ phone = $.trim(phoneMatch)
+ .replace(regClutter, '-').replace(/^\-/, '');
+ phone = phone.replace(/[^0-9]$/, '');
+
+ self.postMessage({
+ event: linkTypes.PHONE_NUMBER_FOUND,
+ contact: {
+ 'label': phone,
+ 'link': 'javascript:void("' + phone + '")'
+ }
+ });
+ }
+};
+
+/**
+ * searchForSocialMedia
+ *
+ * Match a Twitter or identi.ca url.
+ *
+ */
+ContactFinder.prototype.searchForSocialMedia = function (link) {
+ var elem = $(link),
+ eventType;
+
+ var text = this.notEmptyOrUri(link);
+
+ if (reTwitter.test(elem.attr('href'))) {
+ eventType = linkTypes.TWITTER_LINK_FOUND;
+ }
+
+ else if (reIdentiCa.test(elem.attr('href'))) {
+ eventType = linkTypes.IDENTICA_LINK_FOUND;
+ }
+
+ if (eventType) {
+ self.postMessage({
+ event: eventType,
+ contact: {
+ 'label': text,
+ 'link': elem.attr('href')
+ }
+ });
+ return true;
+ }
+
+ return false;
+};
+
+/**
+ * notEmptyOrUri
+ *
+ * If link has text, use it, if not,
+ * then return uri.
+ *
+ */
+ContactFinder.prototype.notEmptyOrUri = function (link) {
+
+ var elem = $(link);
+
+ if (/([^\s]*)]/.test(elem.text())) {
+ // contains something else than just space.
+ // It is valid.
+ return elem.text();
+ } else {
+ return link.href;
+ }
+};
+
+/**
+ * searchForContactEmail
+ *
+ * Sends a particular message if a matching email
+ * is found.
+ *
+ */
+ContactFinder.prototype.searchForContactEmail = function (link) {
+ var elem = $(link),
+ eventType;
+
+ if (reEmail.test(elem.attr('href'))) {
+ console.debug('found an email address', elem.attr('href'));
+ if (this.isSameHostname(elem.attr('href'))) {
+ // this is a good email with same hostname, priceless!
+ eventType = linkTypes.CERTAIN_EMAIL_ADDRESS_FOUND;
+ } else {
+ // not the same hostname... we'll keep it just in case.
+ eventType = linkTypes.UNCERTAIN_EMAIL_ADDRESS_FOUND;
+ }
+ } else if (reAnyEmail.test(elem.attr('href'))) {
+ if (this.isSameHostname(elem.attr('href'))) {
+ eventType = linkTypes.UNCERTAIN_EMAIL_ADDRESS_FOUND;
+ }
+ }
+
+ if (eventType) {
+ var label = elem.attr('href').replace('mailto:', '');
+ var myLink = elem.attr('href');
+
+ // Add customizable complaintEmailSubject and complaintEmailBody to
+ // mailto link
+ if (this.complaintEmailSubject && this.complaintEmailBody) {
+ myLink = myLink + '?subject=' + this.complaintEmailSubject +
+ '&body=' + this.complaintEmailBody;
+ }
+
+ // we found an email address.
+ // send message with whatever event type was found.
+ self.postMessage({
+ event: eventType,
+ contact: {
+ 'label': label,
+ 'link': myLink
+ }
+ });
+ return true;
+ } else {
+ // not an email address.
+ return false;
+ }
+};
+
+/**
+ * matchContact
+ *
+ * Loop through the regexp and try to find a match.
+ *
+ */
+ContactFinder.prototype.matchContact = function (currentLink) {
+ // search for an email address.
+ if (this.searchForContactEmail(currentLink)) {
+ return true;
+ }
+ if (this.searchForSocialMedia(currentLink)) {
+ return true;
+ }
+
+ // check all contact link strings.
+ this.matchContactLink(currentLink);
+
+ // this link is worth nothing.
+ //return false;
+
+};
+
+/**
+ * matchContactLink
+ *
+ * loop through regexp for a contact link.
+ * And send a message to trigger a page worker
+ * if not currently a page worker.
+ *
+ */
+ContactFinder.prototype.matchContactLink = function (currentLink) {
+
+ var that = this;
+
+ this.loopThroughLanguages(
+ function (degreeName, arr, le) {
+ var text, j, href;
+
+ for (j = 0; j < le; j++) {
+ text = $(currentLink).text();
+ href = currentLink.href;
+
+ if (arr[j].test(text)) {
+
+ if (degreeName === 'certain') {
+
+ self.postMessage({
+ event: linkTypes.CERTAIN_LINK_FOUND,
+ contact: {
+ 'label': text,
+ 'link': href
+ }
+ });
+
+ if (!that.isPageWorker) {
+ that.complaintSearch(linkTypes.CERTAIN_LINK_FOUND, href);
+ }
+
+ } else if (degreeName === 'probable'){
+
+ self.postMessage({
+ event: linkTypes.PROBABLE_LINK_FOUND,
+ contact: {
+ 'label': text,
+ 'link': href
+ }
+ });
+
+ if (!that.isPageWorker) {
+ that.complaintSearch(linkTypes.PROBABLE_LINK_FOUND, href);
+ }
+ } else if (degreeName === 'uncertain') {
+ self.postMessage({
+ event: linkTypes.UNCERTAIN_LINK_FOUND,
+ contact: {
+ 'label': text,
+ 'link': href
+ }
+ });
+
+ if (!that.isPageWorker) {
+ that.complaintSearch(
+ linkTypes.UNCERTAIN_LINK_FOUND, href);
+ }
+ }
+ }
+ }
+ });
+};
+
+/**
+ * complaintSearch
+ * returns to ui_info a link to open.
+ */
+ContactFinder.prototype.complaintSearch = function (linkType, link) {
+ if (!this.isEmailLink(link)) {
+ // we don't want to "visit" mailto links.
+ self.postMessage({
+ event: 'complaintSearch',
+ urlSearch: {
+ 'type': linkType,
+ 'linkValue': link
+ }
+ });
+ }
+};
+
+/**
+ * getHostname
+ * small regex taken from
+ * http://beardscratchers.com/journal/using-javascript-to-get-the-hostname-of-a-url
+ * to extract hostname from url.
+ * do not consider www as subdomain.
+ *
+ */
+ContactFinder.prototype.getHostname = function (str) {
+ // remove www, but not other kind of subdomains (which most likely
+ // may not be the same site than the domain itself.)
+ str = this.removeWWW(str);
+ var urlHostname = /^(?:f|ht)tp(?:s)?\:\/\/([^\/]+)/im;
+ var emailHostname = /^mailto:[A-Z0-9\.\_\+\-]+\@([A-Z0-9\.\-]+\.[A-Z]{2,6})$/im;
+ var match1 = urlHostname.exec(str);
+ var match2 = emailHostname.exec(str);
+
+ if (match1) {
+ return match1[1];
+ } else if (match2) {
+ return match2[1];
+ }
+
+ // no match.
+ return false;
+};
+
+/**
+ * isSameHostname
+ *
+ * Checks a link has the same hostname than the original url.
+ *
+ */
+ContactFinder.prototype.isSameHostname = function (url) {
+ return this.getHostname(url) === this.originalHostname;
+};
+
+/**
+ * remove www from hostname.
+ */
+ContactFinder.prototype.removeWWW = function (str) {
+ if (typeof str !== 'string') {
+ return '';
+ }
+ return str.replace("www.", "", 'i');
+};
+
+ContactFinder.prototype.isEmailLink = function (str) {
+ if (typeof str !== 'string') {
+ return '';
+ }
+ return /^mailto:/i.test(str);
+};
+
+var contactFinder = new ContactFinder();
diff --git a/data/complain/contact_regex.js b/data/complain/contact_regex.js
new file mode 100644
index 0000000..d91735b
--- /dev/null
+++ b/data/complain/contact_regex.js
@@ -0,0 +1,98 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+// email address regexp
+var reEmail = /^mailto\:(admin|feedback|webmaster|info|contact|support|comments|team|help)\@[a-z0-9.\-]+\.[a-z]{2,4}$/i;
+
+var reAnyEmail = /^mailto\:.*?\@[a-z0-9\.\-]+\.[a-z]{2,4}$/i;
+
+// twitter address regexp
+var reTwitter = /twitter\.com\/(\!?#\/)?[a-z0-9]*/i;
+
+// identi.ca address regexp
+var reIdentiCa = /identi\.ca\/(?!notice\/)[a-z0-9]*/i;
+
+/**
+ * contactSearchStrings
+ * Contains arrays of strings classified by language
+ * and by degree of certainty.
+ */
+var contactStr = {
+ 'da': {
+ 'certain': [
+ '^[\\s]*Kontakt os[\\s]*$',
+ '^[\\s]*Email Os[\\s]*$',
+ '^[\\s]*Kontakt[\\s]*$'
+ ],
+ 'probable': ['^[\\s]Kontakt', '^[\\s]*Email'],
+ 'uncertain': [
+ '^[\\s]*Om Us',
+ '^[\\s]*Om',
+ 'Hvem vi er'
+ ]
+ },
+ 'en': {
+ 'certain': [
+ '^[\\s]*Contact Us[\\s]*$',
+ '^[\\s]*Email Us[\\s]*$',
+ '^[\\s]*Contact[\\s]*$',
+ '^[\\s]*Feedback[\\s]*$',
+ '^[\\s]*Web.?site Feedback[\\s]*$'
+ ],
+ 'probable': ['^[\\s]Contact', '^[\\s]*Email'],
+ 'uncertain': [
+ '^[\\s]*About Us',
+ '^[\\s]*About',
+ 'Who we are',
+ 'Who I am',
+ 'Company Info',
+ 'Customer Service'
+ ]
+ },
+ 'es': {
+ 'certain': [
+ '^[\\s]*contáctenos[\\s]*$',
+ '^[\\s]*Email[\\s]*$'
+ ],
+ 'probable': ['^[\\s]contáctenos', '^[\\s]*Email'],
+ 'uncertain': [
+ 'Acerca de nosotros'
+ ]
+ },
+ 'fr': {
+ 'certain': [
+ '^[\\s]*Contactez nous[\\s]*$',
+ '^[\\s]*(Nous )?contacter[\\s]*$',
+ '^[\\s]*Email[\\s]*$',
+ '^[\\s]*Contact[\\s]*$',
+ '^[\\s]*Commentaires[\\s]*$'
+ ],
+ 'probable': ['^[\\s]Contact', '^[\\s]*Email'],
+ 'uncertain': [
+ '^[\\s]*(A|À) propos',
+ 'Qui nous sommes',
+ 'Qui suis(-| )?je',
+ 'Info',
+ 'Service Client(e|è)le'
+ ]
+ }
+};
+
+var usaPhoneNumber =
+ /(?:\+ ?1 ?)?\(?[2-9]{1}[0-9]{2}\)?(?:\-|\.| )?[0-9]{3}(?:\-|\.| )[0-9]{4}(?:[^0-9])/mg;
diff --git a/data/complain/link_types.js b/data/complain/link_types.js
new file mode 100644
index 0000000..fefd4fd
--- /dev/null
+++ b/data/complain/link_types.js
@@ -0,0 +1,42 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var linkTypes = {
+
+ // constants. Also available in lib/ui_info.js
+ 'CERTAIN_EMAIL_ADDRESS_FOUND': 'certainEmailAddressFound',
+ 'UNCERTAIN_EMAIL_ADDRESS_FOUND': 'uncertainEmailAddressFound',
+
+ // Looking for contact links
+ 'CERTAIN_LINK_FOUND': 'certainLinkFound',
+ 'PROBABLE_LINK_FOUND': 'probableLinkFound',
+ 'UNCERTAIN_LINK_FOUND': 'uncertainLinkFound',
+ 'LINK_NOT_FOUND': 'contactLinkNotFound',
+
+ // Looking for identi.ca and twitter accounts.
+ 'TWITTER_LINK_FOUND': 'twitterLinkFound',
+ 'IDENTICA_LINK_FOUND': 'identicaLinkFound',
+
+ // phone number and address
+ 'PHONE_NUMBER_FOUND': 'phoneNumberFound',
+ 'SNAIL_ADDRESS_FOUND': 'snailAddressFound'
+
+};
+
diff --git a/data/complain/pagemod_finder.js b/data/complain/pagemod_finder.js
new file mode 100644
index 0000000..e74bda6
--- /dev/null
+++ b/data/complain/pagemod_finder.js
@@ -0,0 +1,348 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * PageModFinder controls the complaint panel appearance.
+ * @class
+ */
+var PageModFinder = function() {
+ this.stylesheet = null;
+ this.displayPanel = false;
+ this.links = null;
+ this.$box = null;
+
+ this.$button = null;
+ this.buttonTop = 40;
+
+ this.$infoBox = null;
+
+ this.isMinimized = true;
+ this.isDragging = false;
+};
+
+PageModFinder.prototype.init = function() {
+ var that = this, le;
+
+ this.links = [];
+
+ var complaintEmailSubject;
+ var complaintEmailBody;
+
+ self.port.on('prefs', function(payload) {
+ if (payload.complaintEmailSubject) {
+ complaintEmailSubject = payload.complaintEmailSubject;
+ }
+ if (payload.complaintEmailBody) {
+ complaintEmailBody = payload.complaintEmailBody;
+ }
+ });
+
+ self.port.on('complaintLinkFound', function(payload) {
+ if (payload.contact !== undefined) {
+ that.displayLinkByPriority(payload);
+ }
+ });
+
+ self.port.on('assetsUri', function(payload) {
+ that.setComplaintPanel(payload.value);
+ });
+
+ self.port.on('pageUrl', function(payload) {
+ // search for contact list. Top level.
+ contactFinder = new ContactFinder({
+ complaintEmailSubject: complaintEmailSubject,
+ complaintEmailBody: complaintEmailBody
+ });
+ contactFinder.init();
+ contactFinder.searchForContactLink(payload.value);
+ });
+};
+
+/**
+ * setComplaintPanel
+ *
+ * Create complaint panel and assign properties to the
+ * dom elements.
+ *
+ */
+PageModFinder.prototype.setComplaintPanel = function (uri) {
+ // provide uri of stylesheet
+ this.stylesheet = uri + 'css/style.css';
+
+ // add stylesheet.
+ $('head').append($('<link/>').attr({
+ 'rel': 'stylesheet',
+ 'href': this.stylesheet,
+ 'type': 'text/css'
+ }));
+
+ $('body').prepend(
+ '<div id="librejs-complaint-box" style="display:none;">' +
+
+ '<div id="librejs-tab-button">' +
+ '<div class="librejs-complain-button" ' +
+ 'title="LibreJS -- Complain to this site"></div>' +
+ '<div class="librejs-complain-separator"></div>' +
+ '</div>' +
+
+ '<div id="librejs-complaint-info">' +
+ '<div class="librejs-hide-button" title="Hide">' +
+ '&times;</div>' +
+ '<h1 title="Nonfree JavaScript -- Complain">\n' +
+ 'Nonfree JavaScript Complain</h1>' +
+ '<p id="librejs-time-mention">' +
+ 'Searching for contact links in this website&hellip;</p>' +
+
+ '<div id="librejs-complaint-info-text">' +
+
+ '<h2>Emails you should use</h2>' +
+ '<ul id="librejs-certain-emails"></ul>' +
+
+ '<h2>Non-webmaster Emails you might want to use</h2>' +
+ '<ul id="librejs-uncertain-emails"></ul>' +
+
+ '<h2>Contact form or useful Contact Information</h2>' +
+ '<ul id="librejs-certain-links"></ul>' +
+
+ '<h2>Twitter Links</h2>' +
+ '<ul id="librejs-twitter-links"></ul>' +
+
+ '<h2>Identi.ca Links</h2>' +
+ '<ul id="librejs-identica-links"></ul>' +
+
+ '<h2>May be of interest</h2>' +
+ '<ul id="librejs-uncertain-links"></ul>' +
+
+ '<h2>May be of interest</h2>' +
+ '<ul id="librejs-probable-links"></ul>' +
+
+ '<h2>Phone Numbers</h2>' +
+ '<ul id="librejs-phone-numbers"></ul>' +
+
+ '<h2>Snail Mail Addresses</h2>' +
+ '<ul id="librejs-snail-addresses"></ul>' +
+
+ '</div>' + // end #librejs-complaint-info-text
+ '</div>' + // end #librejs-complaint-info
+ '</div>' // end #librejs-complaint-box
+ );
+
+ // main elements of the complaint panel.
+ this.$infoBox = $('#librejs-complaint-info');
+ this.$infoBoxText = $('#librejs-complaint-info-text');
+
+ // all lists.
+ this.$certainEmails = $("#librejs-certain-emails");
+ this.$uncertainEmails = $("#librejs-uncertain-emails");
+ this.$certainLinks = $("#librejs-certain-links");
+ this.$uncertainLinks = $("#librejs-uncertain-links");
+ this.$probablLinks = $("#librejs-probable-links");
+ this.$twitterLinks = $("#librejs-twitter-links");
+ this.$identicaLinks = $("#librejs-identica-links");
+ this.$phoneNumbers = $("#librejs-phone-numbers");
+ this.$snailAddresses = $("#librejs-snail-addresses");
+
+ this.$button = $('#librejs-tab-button');
+ this.$box = $('#librejs-complaint-box');
+
+ this.$infoBox.height($(window).height() - this.buttonTop);
+ this.$infoBoxText.height(this.$infoBox.height() - 154);
+};
+
+/**
+ * displayLinkByPriority
+ *
+ * Place the link in the correct list depending
+ * on the correct
+ */
+PageModFinder.prototype.displayLinkByPriority = function(respData) {
+ // we have a link to show. Add it to the button.
+ // first time finalLinkFound is triggered.
+ if (this.displayPanel === false) {
+
+ this.addComplaintOverlay();
+ this.displayPanel = true;
+ this.hideBox(true);
+ }
+
+ // check link isn't already added.
+ if (respData.contact !== undefined &&
+ !this.isInLinks(respData.contact.link)) {
+
+ // push link to list.
+ le = this.links.push(respData);
+
+ // making sure this is the latest link added.
+ this.addALinkToPanel(this.links[le -1]);
+ }
+};
+
+PageModFinder.prototype.isInLinks = function(searchValue) {
+ var i = 0,
+ le = this.links.length;
+
+ for (; i < le; i++) {
+ if (this.links[i].contact.link.replace(/\/$/, '') ===
+ searchValue.replace(/\/$/, '')
+ ) {
+ return true;
+ }
+ }
+
+ // no match has been found.
+ return false;
+};
+
+/**
+ * addALinkToPanel
+ *
+ * Check the type of link and place it in the
+ * appropriate list in the complaint panel.
+ */
+PageModFinder.prototype.addALinkToPanel = function(link) {
+ var listElem;
+
+ switch (link.event) {
+ case linkTypes.CERTAIN_EMAIL_ADDRESS_FOUND:
+ listElem = this.$certainEmails;
+ break;
+
+ case linkTypes.UNCERTAIN_EMAIL_ADDRESS_FOUND:
+ listElem = this.$uncertainEmails;
+ break;
+
+ case linkTypes.CERTAIN_LINK_FOUND:
+ listElem = this.$certainLinks;
+ break;
+
+ case linkTypes.PROBABLE_LINK_FOUND:
+ listElem = this.$probablLinks;
+ break;
+
+ case linkTypes.UNCERTAIN_LINK_FOUND:
+ listElem = this.$uncertainLinks;
+ break;
+
+ case linkTypes.TWITTER_LINK_FOUND:
+ listElem = this.$twitterLinks;
+ break;
+
+ case linkTypes.IDENTICA_LINK_FOUND:
+ listElem = this.$identicaLinks;
+ break;
+
+ case linkTypes.PHONE_NUMBER_FOUND:
+ listElem = this.$phoneNumbers;
+ break;
+
+ case linkTypes.SNAIL_ADDRESS_FOUND:
+ listElem = this.$snailAddresses;
+ break;
+ }
+
+ listElem.prev('h2').css({'display': 'block'});
+ listElem.append($('<li/>').append($('<a/>').attr({
+ 'href': link.contact.link,
+ 'target': '_blank'
+ }).text(link.contact.label)));
+};
+
+PageModFinder.prototype.addComplaintOverlay = function() {
+ var that = this;
+
+ this.$button.click(function() {
+ if (!that.isDragging) {
+ that.showBox();
+ }
+ return false;
+ });
+
+ this.$button.on('mousedown', function(e) {
+ var startPageY = e.pageY;
+ var baseY = that.$button.offset().top - startPageY;
+ var windowHeight = $(window).height();
+ var buttonHeight = that.$button.height();
+
+ $(document).on('mousemove.librejs', function(e2) {
+ if (that.isDragging || e2.pageY !== startPageY) {
+ var top = baseY + e2.clientY;
+ if (top < 0) {
+ top = 0;
+ } else if (
+ top + buttonHeight + that.buttonTop - 6 > windowHeight
+ ) {
+ top = windowHeight - buttonHeight - that.buttonTop + 6;
+ }
+ that.$button.css({top: top});
+ that.isDragging = true;
+ }
+ });
+ return false;
+ });
+
+ $(document).on('mouseup', function() {
+ $(document).off('mousemove.librejs');
+ if (that.isDragging) {
+ setTimeout(function() {
+ that.isDragging = false;
+ }, 10);
+ return false;
+ }
+ });
+
+ $(document).keyup(function(e) {
+ if (that.isMinimized === false) {
+ e.preventDefault();
+ if (e.which === 27) {
+ // Escape was pressed
+ that.hideBox();
+ }
+ }
+ });
+
+ this.$box.find('.librejs-hide-button').on('click', function() {
+ that.hideBox();
+ });
+
+ this.$button.on('focus', function() { that.showBox(); });
+ this.$box.on('blur', function() { that.hideBox(); });
+
+ this.$box.css({'display': 'block'});
+};
+
+PageModFinder.prototype.showBox = function() {
+ this.$box.css({right: '-2px'});
+ this.isMinimized = false;
+ this.$button.hide();
+
+ var that = this;
+ $('#librejs-complaint-info').mouseleave(function() {
+ that.hideBox();
+ });
+};
+
+PageModFinder.prototype.hideBox = function() {
+ this.$box.css({right: '-465px'});
+ this.isMinimized = true;
+ this.$button.show();
+ $('#librejs-complaint-info').off('mouseleave');
+};
+
+var pageModFinder = new PageModFinder();
diff --git a/data/complain/worker_finder.js b/data/complain/worker_finder.js
new file mode 100644
index 0000000..2cda32e
--- /dev/null
+++ b/data/complain/worker_finder.js
@@ -0,0 +1,35 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var workerFinder = {
+
+ init: function () {
+
+ var that = this;
+ console.debug('searching with pageworker');
+
+ contactFinder.init(true);
+ contactFinder.searchForContactLink(window.location.href);
+
+ }
+
+};
+
+workerFinder.init();
diff --git a/data/display_panel/content/README b/data/display_panel/content/README
new file mode 100644
index 0000000..a56ea46
--- /dev/null
+++ b/data/display_panel/content/README
@@ -0,0 +1,21 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+All images in this directory are free, released under the GPLv3 or later. \ No newline at end of file
diff --git a/data/display_panel/content/background-panel.png b/data/display_panel/content/background-panel.png
new file mode 100644
index 0000000..022ffb3
--- /dev/null
+++ b/data/display_panel/content/background-panel.png
Binary files differ
diff --git a/data/display_panel/content/display-panel.html b/data/display_panel/content/display-panel.html
new file mode 100644
index 0000000..09def90
--- /dev/null
+++ b/data/display_panel/content/display-panel.html
@@ -0,0 +1,65 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>Display JS Monitoring Panel</title>
+<link rel="stylesheet" type="text/css" href="./panel-styles.css"/>
+
+<!-- /**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+-->
+</head>
+
+<body>
+ <div class="title-area">
+ <a class="libre"
+ id="ljs-settings"
+ href="javascript:void"
+ title="LibreJS Whitelist Settings">
+ <h1 class="libre">LibreJS</h1>
+ </a>
+ <a target="_blank" href="https://www.gnu.org/software/librejs/"
+ id="librejs-web-link"
+ >gnu.org/software/librejs</a>
+ </div>
+
+ <div id="info">
+ <div id="dryrun">
+ <h2 class="dryrun-js"></h2>
+ <ul class="dryrun-js"></ul>
+ </div>
+
+ <div id="accepted">
+ <h2 class="accepted-js"></h2>
+ <ul class="accepted-js"></ul>
+ </div>
+
+ <div id="blocked">
+ <h2 class="blocked-js"></h2>
+ <ul class="blocked-js">
+ </div>
+
+ <div id="librejs-web-labels-pages">
+ <h2></h2>
+ <ul></ul>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/data/display_panel/content/librejs-title-old.png b/data/display_panel/content/librejs-title-old.png
new file mode 100644
index 0000000..8a11527
--- /dev/null
+++ b/data/display_panel/content/librejs-title-old.png
Binary files differ
diff --git a/data/display_panel/content/librejs-title.png b/data/display_panel/content/librejs-title.png
new file mode 100644
index 0000000..c1a911c
--- /dev/null
+++ b/data/display_panel/content/librejs-title.png
Binary files differ
diff --git a/data/display_panel/content/panel-styles.css b/data/display_panel/content/panel-styles.css
new file mode 100644
index 0000000..af14c0d
--- /dev/null
+++ b/data/display_panel/content/panel-styles.css
@@ -0,0 +1,193 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+html {
+ padding:10px;
+ color:#000 !important;
+ background:url('background-panel.png') !important;
+}
+document {
+ padding:10px;
+}
+body {
+ padding:10px;
+ font-size:67.5%;
+ overflow-x:hidden;
+ overflow-y:visible;
+ color:#000;
+}
+
+.libre {
+ width:230px;
+ height:104px;
+ display:block;
+ margin-bottom: 4px;
+}
+h1.libre {
+ font-size:1.5em;
+ font-weight:normal;
+ font-family:Arial;
+ margin:-20px 0 0 0;
+ padding:0;
+ font-weight:bold;
+ background:url('librejs-title.png') no-repeat top left;
+ text-indent:-1000px;
+ overflow:hidden;
+}
+h2 {
+ font-size:1.5em;
+ font-weight:bold;
+ font-family:arial;
+ border-bottom:4px solid #444;
+ padding-bottom:0;
+ margin:30px 0 0 0;
+ width:710px;
+ line-height:140%;
+}
+code {
+ font-size:1.2em;
+ margin:0;
+ padding:0;
+}
+ul {
+ margin:0;
+ padding:0;
+ list-style:none;
+}
+ul.blocked-js li, ul.accepted-js li, ul.dryrun-js li {
+ padding:5px;
+ border-bottom:2px solid #CCC;
+ margin:0;
+ width:700px;
+}
+
+ul ul {
+ margin:10px;
+ list-style:disc;
+}
+ul.blocked-js ul li, ul.accepted-js ul li, ul.dryrun-js ul li {
+ padding:5px;
+ border-bottom:0;
+ width:auto;
+}
+#info {
+ clear:both;
+}
+.button {
+ float:right;
+ padding:10px;
+ display:none;
+ clear:both;
+ margin:10px;
+}
+
+/*
+ Pure JS button styles below taken from:
+ http://webdesignerwall.com/tutorials/css3-gradient-buttons
+ */
+.button {
+ display: inline-block;
+ outline: none;
+ cursor: pointer;
+ text-align: center;
+ text-decoration: none;
+ font: 14px/100% Arial, Helvetica, sans-serif;
+ padding: .5em 2em .55em;
+ text-shadow: 0 1px 1px rgba(0,0,0,.3);
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ border-radius: .5em;
+ -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
+ -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
+ box-shadow: 0 1px 2px rgba(0,0,0,.2);
+}
+.small.button {
+ font-size:11px;
+ padding:.5em .5em;
+ margin-top:10px;
+}
+.button:hover {
+ text-decoration: none;
+}
+.button:active {
+ position: relative;
+ top: 1px;
+}
+.orange {
+ color: #fef4e9;
+ border: solid 1px #da7c0c;
+ background: #f78d1d;
+ background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
+ background: -moz-linear-gradient(top, #faa51a, #f47a20);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
+}
+.orange:hover {
+ background: #f47c20;
+ background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
+ background: -moz-linear-gradient(top, #f88e11, #f06015);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
+}
+.orange:active {
+ color: #fcd3a5;
+ background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a));
+ background: -moz-linear-gradient(top, #f47a20, #faa51a);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20', endColorstr='#faa51a');
+}
+.white {
+ background: -moz-linear-gradient(center top , #FFFFFF, #EDEDED) repeat scroll 0 0 transparent;
+ border: 1px solid #B7B7B7;
+ /* color: #606060;*/
+ color:#9d0d0d;
+}
+.white:hover {
+ background: -moz-linear-gradient(center top , #FFFFFF, #DCDCDC) repeat scroll 0 0 transparent;
+}
+.white:active {
+ background: -moz-linear-gradient(center top , #EDEDED, #FFFFFF) repeat scroll 0 0 transparent;
+/*color: #999999;*/
+
+}
+
+span.accepted, span.blocked {
+ color:#008e00;
+ font-size:145%;
+ font-variant:small-caps;
+ font-weight:bold;
+}
+ul.blocked-js li {
+ overflow:hidden;
+}
+span.blocked {
+ color:#8e0000;
+}
+
+.title-area {
+ width: 230px;
+ text-align: center;
+}
+
+.title-area #librejs-web-link {
+ font-size: 18px;
+}
+
+#librejs-web-labels-pages>ul {
+ margin-top: 8px;
+ font-size: 14px;
+ list-style-type: disc;
+} \ No newline at end of file
diff --git a/data/display_panel/main_panel.js b/data/display_panel/main_panel.js
new file mode 100644
index 0000000..4b3afe6
--- /dev/null
+++ b/data/display_panel/main_panel.js
@@ -0,0 +1,381 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+var displayPanel = {
+ complainButton: null,
+ button1: null,
+ button2: null,
+ pageURL: null,
+ urlData: null,
+ isComplainButtonSet: false,
+
+ init: function () {
+ // add the buttons to the panel dynamically.
+ $('body').prepend(
+ '<a id="complain-contact" class="button white" href="#">' +
+ '<span>Complain to site owner</span>' +
+ '</a>' +
+ '<a id="allow-button" class="button white" href="#">' +
+ '<span>Allow all scripts in this page</span>' +
+ '</a>' +
+ '<a id="disallow-button" class="button white" href="#">' +
+ '<span>' +
+ 'Block all nonfree/nontrivial scripts from this page</span>' +
+ '</a>' +
+ '<a id="open-in-tab" class="button white" href="#">' +
+ '<span>Open this report in a new tab</span>' +
+ '</a>'
+ );
+
+ // assign properties to these new elements.
+ this.complainButton = $('#complain-contact');
+ this.button1 = $('#allow-button');
+ this.button2 = $('#disallow-button');
+
+ // start listening for messages sent from modules.
+ this.messageListen();
+ this.startEventHandlers();
+ },
+
+ startEventHandlers: function () {
+ $('#open-in-tab').click(function (e) {
+ try {
+ var html = $("#info").html();
+ var text = window.btoa(unescape(encodeURIComponent(html)));
+ self.port.emit('openInTab', text);
+ } catch (x) {
+ console.debug("error", x.lineNumber, x.message);
+ }
+ return false;
+ });
+ $("#ljs-settings").click(function (e) {
+ e.preventDefault();
+ self.port.emit('openSesame');
+ });
+ $(document).on('click', 'a', function(e) {
+ self.port.emit('hideMainPanel');
+ });
+ },
+
+ messageListen: function () {
+ var that = this;
+ self.on('message', function (message) {
+ that.handleMessage(message);
+ });
+ },
+
+ getHostname: function (str) {
+ var re = new RegExp('^(http(?:s)?://[^/]+)', 'im');
+ return str.match(re)[1].toString();
+ },
+
+ /**
+ * formatListScript
+ * Depending on the type of script in the item,
+ * will return a preformatted code element with
+ * on-page JavaScript or a link to an external
+ * JavaScript file.
+ */
+ formatListScript: function (item, canWhitelist) {
+ var li, pre, code, a, reason = '';
+ li = $("<li/>");
+ if (item.reason !== undefined) {
+ reason = item.reason;
+ }
+ if (item.inline === true) {
+ pre = $('<pre/>');
+ pre.css('white-space', 'pre-wrap');
+ code = $('<code/>');
+ reason_obj = $('<span class="reason"/>').text(reason);
+ code.text(item.contents);
+ code.prepend($('<br/>'));
+ code.prepend(reason_obj);
+ pre.append(code);
+ li.append(pre);
+ } else {
+ console.debug("item url is %s", item.url);
+ reason_obj = $('<span class="reason"/>').text(reason);
+ li.text(item.contents);
+ li.prepend($('<br/>'));
+ li.prepend(reason_obj);
+ a = $('<a/>');
+ a.attr('href', item.url);
+ a.attr('target', '_blank');
+ a.text(item.url);
+ li.append(a);
+ }
+ var $el;
+ if (canWhitelist) {
+ $el = $(
+ '<a class="small button white whitelist">Whitelist</a>');
+ $el.data('librejs-hash', item.hash);
+ $el.data('librejs-url', item.url);
+ li.prepend($el);
+ } else if (item.reason.indexOf('whitelisted by user') > -1) {
+ // a hack until LibreJS version 6.1. Need to have a value attached
+ // to item.whitelisted for this.
+ $el = $(
+ '<a class="small button white rm-whitelist">' +
+ 'Remove from Whitelist</a>');
+ $el.data('librejs-hash', item.hash);
+ $el.data('librejs-url', item.url);
+ li.prepend($el);
+ }
+ return li;
+ },
+
+ resetButtons: function (message) {
+ if (!this.isComplainButtonSet) {
+ this.complainButton.hide();
+ }
+
+ if (message.contact === undefined) {
+ this.button1.hide();
+ this.button2.hide();
+ }
+ },
+
+ siteContactFound: function (url) {
+ this.complainButton.show();
+
+ this.isComplainButtonSet = true;
+ this.complainButton.off('click');
+ this.complainButton.click(function(e) {
+ e.preventDefault();
+ self.port.emit('hideMainPanel');
+ window.open(url, '_blank');
+ });
+ },
+
+ handleMessage: function (message) {
+ var removedLen, acceptedLen;
+
+ if (message.event === 'complaintSearch') {
+ return;
+ }
+
+ this.resetButtons(message);
+
+ // Add complain button with most certain link found
+ if (message.event === 'certainLinkFound' ||
+ message.event === 'contactLinkFound' ||
+ (!this.isComplainButtonSet &&
+ (message.event === 'probableLinkFound' ||
+ message.event === 'uncertainLinkFound'))
+ ) {
+ var url = false;
+
+ if (message.contact && message.contact.link) {
+ url = message.contact.link;
+ } else if (message.absolute) {
+ url = message.absolute;
+ }
+
+ if (url) {
+ this.siteContactFound(url);
+ }
+ return;
+ } else if (message.event === 'contactLinkNotFound') {
+ // no contact link was found.
+ this.complainButton.hide();
+ }
+
+ if (message.isAllowed !== undefined) {
+ this.button2.show();
+ } else if (message.contact === undefined) {
+ this.button1.show();
+ }
+
+ var li, code, pre, len, i;
+
+ if (message.pageURL !== undefined) {
+ // Unset complain button on a new site
+ this.complainButton.off('click').hide();
+ this.isComplainButtonSet = false;
+
+ this.button1.attr('href', message.pageURL);
+ this.button2.attr('href', message.pageURL);
+ if (message.pageURL ===
+ 'resource://jid1-ktlzuoiikvffew-at-jetpack/librejs/data/settings/index.html'
+ ) {
+ message.pageURL = "LibreJS Whitelist";
+ }
+ $('#info').css({'opacity': 0});
+ $('h2.blocked-js').html(
+ "List of <span class='blocked'>blocked</span> JavaScript in " +
+ $('<div/>').text(message.pageURL).html());
+ $('#dryrun').hide();
+ $('ul.blocked-js').empty();
+ $('ul.accepted-js').empty();
+ $('ul.dryrun-js').empty();
+
+ jsLabelsPagesVisited = message.urlData.jsLabelsPagesVisited;
+ removedLen = message.urlData.removed.length;
+ acceptedLen = message.urlData.accepted.length;
+ dryRunLen = message.urlData.dryRun.length;
+
+ // Add Web Labels info to main display panel
+ var $myList = $('#librejs-web-labels-pages>ul');
+ var idx = 0;
+ for (var key in jsLabelsPagesVisited) {
+ // Initialize and reset the element on first iteration
+ if (idx === 0) {
+ $('#librejs-web-labels-pages>h2')
+ .html('Web Labels pages being used for this session');
+ $myList.html('');
+ }
+
+ if (typeof key !== 'string') {
+ continue;
+ }
+
+ var myUrl = key.replace(/#librejs=true$/, '');
+ var $el = $(
+ '<li>' +
+ '<a target="_blank" href="' + myUrl + '">' +
+ myUrl +
+ '</a>' +
+ '</li>');
+ $myList.append($el);
+ idx++;
+ }
+
+ if (dryRunLen > 0) {
+ $dryRun = $("#dryrun");
+ $dryRun.show();
+ $('h2.dryrun-js')
+ .html("List of loaded <span class='blocked'>scripts that should be blocked</span> (but were allowed by you) in " +
+ $('<div/>').text(message.pageURL).html());
+ for (i = 0; i < dryRunLen; i++) {
+ li = this.formatListScript(message.urlData.dryRun[i],
+ true);
+ $('ul.dryrun-js').append(li);
+ }
+ }
+ if (removedLen > 0) {
+ $("#blocked").insertBefore($('#accepted'));
+ for (i = 0; i < removedLen; i++) {
+ this.button1.fadeIn();
+ li = this.formatListScript(message.urlData.removed[i],
+ true);
+ $('ul.blocked-js').append(li);
+ }
+ } else {
+ this.button1.hide();
+ $('ul.blocked-js').append('<li>LibreJS did not block any scripts on this page: \n\n<ul><li>There may be no scripts on this page (check source, C-u).</li><li>All the scripts on this page may be trivial and/or free.</li><li>You may have whitelisted this domain name or url from the preferences (Type about:addons in your location bar to check)</li><li>You may have clicked the "allow all scripts" button, which causes LibreJS to load all JavaScript on a page regardless of whether it is free, trivial, nontrivial or nonfree. This policy is effective for the entire duration of a Firefox session.</li><li>If for any reason you think LibreJS should have blocked JavaScript code on this page, please report this issue to: <a id="report" href="mailto:bug-librejs@gnu.org" target="_blank">bug-librejs@gnu.org</a></li></ul></li>');
+
+ $('#report').attr(
+ 'href',
+ 'mailto:bug-librejs@gnu.org' +
+ '?subject=LibreJS bug report' +
+ '&body=LibreJS issue with page: ' +
+ message.pageURL);
+ }
+
+ // get accepted scripts.
+ $('h2.accepted-js')
+ .html("List of <span class='accepted'>accepted</span> " +
+ "JavaScript in " +
+ $('<div/>').text(message.pageURL).html());
+
+ if (acceptedLen > 0) {
+ $('#accepted').insertBefore($('#blocked'));
+ for (i = 0; i < acceptedLen; i++) {
+
+ li = this.formatListScript(message.urlData.accepted[i],
+ false);
+ $('ul.accepted-js').append(li);
+
+ }
+
+ } else {
+ $('ul.accepted-js').append(
+ '<li>LibreJS did not allow the execution of any scripts on this page: \n\n\'' +
+ '<ul>' +
+ '<li>There may be no scripts on this page (check source, C-u)</li>' +
+ '<li>The inline and on-page JavaScript code may not be free and/or may not have proper license information and external scripts (if present) may have been removed by default.</li>' +
+ '<li>External scripts may not be free and/or may not have proper licensing and are not part of the whitelist of free JavaScript libraries.</li></ul></li>');
+ }
+
+ $('#info').animate({opacity: 1});
+
+ // emit allowAllClicked when button is clicked.
+ this.button1.click(function(e) {
+ console.debug('clicked allow button');
+ e.preventDefault();
+ var url = $(this).attr('href');
+
+ var urlForDisplay = (url.length > 100) ?
+ url.substr(0,100) + '…' : url;
+ var areYouSure = window.confirm(
+ "Allow all nonfree/nontrivial scripts on this page?\n\n" +
+ urlForDisplay);
+ if (areYouSure) {
+ self.port.emit('allowAllClicked', url);
+ }
+
+ });
+
+ this.button2.click(function(e) {
+ e.preventDefault();
+ var url = $(this).attr('href');
+ self.port.emit('disallowAllClicked', url);
+ });
+
+ var that = this;
+ // whitelist a script
+ $('.whitelist').click(function (e) {
+ e.preventDefault();
+ // get the url of the page from main button.
+ var url = that.button1.attr('href');
+ var hash = $(this).data('librejs-hash');
+
+ var reason = $(this).parent('li').children('.reason').text();
+
+ if (!reason) {
+ reason = $(this).parent('li').children('pre')
+ .find('.reason').text();
+ }
+
+ // URL of the JS file
+ var jsUrl = $(this).data('librejs-url');
+ var filename = '';
+ if (jsUrl) {
+ filename = jsUrl.split('/').pop();
+ }
+
+ self.port.emit('whitelistByHash',
+ hash, url, filename, reason);
+ $(this).parent().append(
+ $('<span style="font-weight:bold"/>')
+ .text("Reload page to load script"));
+ $(this).remove();
+ });
+
+ $('.rm-whitelist').click(function (e) {
+ e.preventDefault();
+ var hash = $(this).data('librejs-hash');
+ self.port.emit('removeFromWhitelistByHash', hash);
+ $(this).text("Reload page to take effect");
+ });
+ }
+ }
+};
+
+displayPanel.init();
diff --git a/data/images/gnu-icon-white.ico b/data/images/gnu-icon-white.ico
new file mode 100644
index 0000000..c053584
--- /dev/null
+++ b/data/images/gnu-icon-white.ico
Binary files differ
diff --git a/data/images/gnu-icon.ico b/data/images/gnu-icon.ico
new file mode 100644
index 0000000..709de01
--- /dev/null
+++ b/data/images/gnu-icon.ico
Binary files differ
diff --git a/data/images/gnu-icon.png b/data/images/gnu-icon.png
new file mode 100644
index 0000000..7c603f0
--- /dev/null
+++ b/data/images/gnu-icon.png
Binary files differ
diff --git a/data/librejs-settings.html b/data/librejs-settings.html
new file mode 100644
index 0000000..1292280
--- /dev/null
+++ b/data/librejs-settings.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<html>
+<head>
+<meta charset=utf-8 />
+<title>LibreJS - Settings</title>
+<link rel="icon"
+ type="image/icon"
+ href="images/gnu-icon.ico">
+<style>
+body {
+ background:#e3dedb;
+ color:#1b1615;
+ font-family:Sans-Serif;
+
+}
+h1 {
+ font-family:Georgia;
+}
+</style>
+</head>
+<body>
+</body>
+</html>
diff --git a/data/licenses/Boost-1.0.txt b/data/licenses/Boost-1.0.txt
new file mode 100644
index 0000000..36b7cd9
--- /dev/null
+++ b/data/licenses/Boost-1.0.txt
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/data/licenses/ISC.txt b/data/licenses/ISC.txt
new file mode 100644
index 0000000..9f68299
--- /dev/null
+++ b/data/licenses/ISC.txt
@@ -0,0 +1,12 @@
+Permission to use, copy, modify, and/or distribute this software for
+any purpose with or without fee is hereby granted, provided that the
+above copyright notice and this permission notice appear in all
+copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
+SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/data/licenses/IntelACPI.txt b/data/licenses/IntelACPI.txt
new file mode 100644
index 0000000..8152ad6
--- /dev/null
+++ b/data/licenses/IntelACPI.txt
@@ -0,0 +1,116 @@
+ACPI - Software License Agreement
+
+
+Software License Agreement IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING.
+
+Do not use or load this software and any associated materials
+(collectively, the "Software") until you have carefully read the
+following terms and conditions. By loading or using the Software, you
+agree to the terms of this Agreement. If you do not wish to so agree,
+do not install or use the Software.
+
+1. COPYRIGHT NOTICE Some or all of this work - Copyright © 1999-2005,
+Intel Corp. All rights reserved.
+
+2. LICENSE
+
+2.1. This is your license from Intel Corp. under its intellectual
+property rights. You may have additional license terms from the party
+that provided you this software, covering your right to use that
+party's intellectual property rights.
+
+2.2. Intel grants, free of charge, to any person ("Licensee")
+obtaining a copy of the source code appearing in this file ("Covered
+Code") an irrevocable, perpetual, worldwide license under Intel's
+copyrights in the base code distributed originally by Intel ("Original
+Intel Code") to copy, make derivatives, distribute, use and display
+any portion of the Covered Code in any form, with the right to
+sublicense such rights; and
+
+2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+license (with the right to sublicense), under only those claims of
+Intel patents that are infringed by the Original Intel Code, to make,
+use, sell, offer to sell, and import the Covered Code and derivative
+works thereof solely to the minimum extent necessary to exercise the
+above copyright license, and in no event shall the patent license
+extend to any additions to or modifications of the Original Intel
+Code. No other license or right is granted directly or by implication,
+estoppel or otherwise; The above copyright and patent license is
+granted only if the following conditions are met:
+
+3. CONDITIONS
+
+3.1. Redistribution of Source with Rights to Further Distribute
+Source. Redistribution of source code of any substantial portion of
+the Covered Code or modification with rights to further distribute
+source must include the above Copyright Notice, the above License,
+this list of Conditions, and the following Disclaimer and Export
+Compliance provision. In addition, Licensee must cause all Covered
+Code to which Licensee contributes to contain a file documenting the
+changes Licensee made to create that Covered Code and the date of any
+change. Licensee must include in that file the documentation of any
+changes made by any predecessor Licensee. Licensee must include a
+prominent statement that the modification is derived, directly or
+indirectly, from Original Intel Code.
+
+3.2. Redistribution of Source with no Rights to Further Distribute
+Source. Redistribution of source code of any substantial portion of
+the Covered Code or modification without rights to further distribute
+source must include the following Disclaimer and Export Compliance
+provision in the documentation and/or other materials provided with
+distribution. In addition, Licensee may not authorize further
+sublicense of source of any portion of the Covered Code, and must
+include terms to the effect that the license from Licensee to its
+licensee is limited to the intellectual property embodied in the
+software Licensee provides to its licensee, and not to intellectual
+property embodied in modifications its licensee may make.
+
+3.3. Redistribution of Executable. Redistribution in executable form
+of any substantial portion of the Covered Code or modification must
+reproduce the above Copyright Notice, and the following Disclaimer and
+Export Compliance provision in the documentation and/or other
+materials provided with the distribution.
+
+3.4. Intel retains all right, title, and interest in and to the
+Original Intel Code.
+
+3.5. Neither the name Intel nor any other trademark owned or
+controlled by Intel shall be used in advertising or otherwise to
+promote the sale, use or other dealings in products derived from or
+relating to the Covered Code without prior written authorization from
+Intel.
+
+4. DISCLAIMER AND EXPORT COMPLIANCE
+
+4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE
+PROVIDED HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM
+INTEL SOFTWARE IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY
+SUPPORT, ASSISTANCE, INSTALLATION, TRAINING OR OTHER SERVICES. INTEL
+WILL NOT PROVIDE ANY UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL
+SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+NONINFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+
+4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS
+LICENSEES OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA,
+LOSS OF USE OR COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
+OR FOR ANY INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF
+THIS AGREEMENT, UNDER ANY CAUSE OF ACTION OR THEORY OF LIABILITY, AND
+IRRESPECTIVE OF WHETHER INTEL HAS ADVANCE NOTICE OF THE POSSIBILITY OF
+SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING THE
+FAILURE OF THE ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.
+
+4.3. Licensee shall not export, either directly or indirectly, any of
+this software or system incorporating such software without first
+obtaining any required license or other approval from the
+U. S. Department of Commerce or any other agency or department of the
+United States Government. In the event Licensee exports any such
+software from the United States or re-exports any such software from a
+foreign destination, Licensee shall ensure that the distribution and
+export/re-export of the software is in compliance with all laws,
+regulations, orders, or other restrictions of the U.S. Export
+Administration Regulations. Licensee agrees that neither it nor any of
+its subsidiaries will export/re-export any technical data, process,
+software, or service, directly or indirectly, to any country for which
+the United States government or any agency thereof requires an export
+license, other governmental approval, or letter of assurance, without
+first obtaining such license, approval or letter.
diff --git a/data/licenses/agpl-3.0.txt b/data/licenses/agpl-3.0.txt
new file mode 100644
index 0000000..dba13ed
--- /dev/null
+++ b/data/licenses/agpl-3.0.txt
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
diff --git a/data/licenses/apache-2.0.txt b/data/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/data/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/data/licenses/artistic-2.0.txt b/data/licenses/artistic-2.0.txt
new file mode 100644
index 0000000..ddb9a46
--- /dev/null
+++ b/data/licenses/artistic-2.0.txt
@@ -0,0 +1,201 @@
+ The Artistic License 2.0
+
+ Copyright (c) 2000-2006, The Perl Foundation.
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+This license establishes the terms under which a given free software
+Package may be copied, modified, distributed, and/or redistributed.
+The intent is that the Copyright Holder maintains some artistic
+control over the development of that Package while still keeping the
+Package available as open source and free software.
+
+You are always permitted to make arrangements wholly outside of this
+license directly with the Copyright Holder of a given Package. If the
+terms of this license do not permit the full use that you propose to
+make of the Package, you should contact the Copyright Holder and seek
+a different licensing arrangement.
+
+Definitions
+
+ "Copyright Holder" means the individual(s) or organization(s)
+ named in the copyright notice for the entire Package.
+
+ "Contributor" means any party that has contributed code or other
+ material to the Package, in accordance with the Copyright Holder's
+ procedures.
+
+ "You" and "your" means any person who would like to copy,
+ distribute, or modify the Package.
+
+ "Package" means the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection and/or of
+ those files. A given Package may consist of either the Standard
+ Version, or a Modified Version.
+
+ "Distribute" means providing a copy of the Package or making it
+ accessible to anyone else, or in the case of a company or
+ organization, to others outside of your company or organization.
+
+ "Distributor Fee" means any fee that you charge for Distributing
+ this Package or providing support for this Package to another
+ party. It does not mean licensing fees.
+
+ "Standard Version" refers to the Package if it has not been
+ modified, or has been modified only in ways explicitly requested
+ by the Copyright Holder.
+
+ "Modified Version" means the Package, if it has been changed, and
+ such changes were not explicitly requested by the Copyright
+ Holder.
+
+ "Original License" means this Artistic License as Distributed with
+ the Standard Version of the Package, in its current version or as
+ it may be modified by The Perl Foundation in the future.
+
+ "Source" form means the source code, documentation source, and
+ configuration files for the Package.
+
+ "Compiled" form means the compiled bytecode, object code, binary,
+ or any other form resulting from mechanical transformation or
+ translation of the Source form.
+
+
+Permission for Use and Modification Without Distribution
+
+(1) You are permitted to use the Standard Version and create and use
+Modified Versions for any purpose without restriction, provided that
+you do not Distribute the Modified Version.
+
+
+Permissions for Redistribution of the Standard Version
+
+(2) You may Distribute verbatim copies of the Source form of the
+Standard Version of this Package in any medium without restriction,
+either gratis or for a Distributor Fee, provided that you duplicate
+all of the original copyright notices and associated disclaimers. At
+your discretion, such verbatim copies may or may not include a
+Compiled form of the Package.
+
+(3) You may apply any bug fixes, portability changes, and other
+modifications made available from the Copyright Holder. The resulting
+Package will still be considered the Standard Version, and as such
+will be subject to the Original License.
+
+
+Distribution of Modified Versions of the Package as Source
+
+(4) You may Distribute your Modified Version as Source (either gratis
+or for a Distributor Fee, and with or without a Compiled form of the
+Modified Version) provided that you clearly document how it differs
+from the Standard Version, including, but not limited to, documenting
+any non-standard features, executables, or modules, and provided that
+you do at least ONE of the following:
+
+ (a) make the Modified Version available to the Copyright Holder
+ of the Standard Version, under the Original License, so that the
+ Copyright Holder may include your modifications in the Standard
+ Version.
+
+ (b) ensure that installation of your Modified Version does not
+ prevent the user installing or running the Standard Version. In
+ addition, the Modified Version must bear a name that is different
+ from the name of the Standard Version.
+
+ (c) allow anyone who receives a copy of the Modified Version to
+ make the Source form of the Modified Version available to others
+ under
+
+ (i) the Original License or
+
+ (ii) a license that permits the licensee to freely copy,
+ modify and redistribute the Modified Version using the same
+ licensing terms that apply to the copy that the licensee
+ received, and requires that the Source form of the Modified
+ Version, and of any works derived from it, be made freely
+ available in that license fees are prohibited but Distributor
+ Fees are allowed.
+
+
+Distribution of Compiled Forms of the Standard Version
+or Modified Versions without the Source
+
+(5) You may Distribute Compiled forms of the Standard Version without
+the Source, provided that you include complete instructions on how to
+get the Source of the Standard Version. Such instructions must be
+valid at the time of your distribution. If these instructions, at any
+time while you are carrying out such distribution, become invalid, you
+must provide new instructions on demand or cease further distribution.
+If you provide valid instructions or cease distribution within thirty
+days after you become aware that the instructions are invalid, then
+you do not forfeit any of your rights under this license.
+
+(6) You may Distribute a Modified Version in Compiled form without
+the Source, provided that you comply with Section 4 with respect to
+the Source of the Modified Version.
+
+
+Aggregating or Linking the Package
+
+(7) You may aggregate the Package (either the Standard Version or
+Modified Version) with other packages and Distribute the resulting
+aggregation provided that you do not charge a licensing fee for the
+Package. Distributor Fees are permitted, and licensing fees for other
+components in the aggregation are permitted. The terms of this license
+apply to the use and Distribution of the Standard or Modified Versions
+as included in the aggregation.
+
+(8) You are permitted to link Modified and Standard Versions with
+other works, to embed the Package in a larger work of your own, or to
+build stand-alone binary or bytecode versions of applications that
+include the Package, and Distribute the result without restriction,
+provided the result does not expose a direct interface to the Package.
+
+
+Items That are Not Considered Part of a Modified Version
+
+(9) Works (including, but not limited to, modules and scripts) that
+merely extend or make use of the Package, do not, by themselves, cause
+the Package to be a Modified Version. In addition, such works are not
+considered parts of the Package itself, and are not subject to the
+terms of this license.
+
+
+General Provisions
+
+(10) Any use, modification, and distribution of the Standard or
+Modified Versions is governed by this Artistic License. By using,
+modifying or distributing the Package, you accept this license. Do not
+use, modify, or distribute the Package, if you do not accept this
+license.
+
+(11) If your Modified Version has been derived from a Modified
+Version made by someone other than you, you are nevertheless required
+to ensure that your Modified Version complies with the requirements of
+this license.
+
+(12) This license does not grant you the right to use any trademark,
+service mark, tradename, or logo of the Copyright Holder.
+
+(13) This license includes the non-exclusive, worldwide,
+free-of-charge patent license to make, have made, use, offer to sell,
+sell, import and otherwise transfer the Package with respect to any
+patent claims licensable by the Copyright Holder that are necessarily
+infringed by the Package. If you institute patent litigation
+(including a cross-claim or counterclaim) against any party alleging
+that the Package constitutes direct or contributory patent
+infringement, then this Artistic License to you shall terminate on the
+date that such litigation is filed.
+
+(14) Disclaimer of Warranty:
+THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
+IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
+LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/data/licenses/bsd-3-clause.txt b/data/licenses/bsd-3-clause.txt
new file mode 100644
index 0000000..0a0fa15
--- /dev/null
+++ b/data/licenses/bsd-3-clause.txt
@@ -0,0 +1,27 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ (1) Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ (2) Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ (3)The name of the author may not be used to
+ endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/data/licenses/cc0.txt b/data/licenses/cc0.txt
new file mode 100644
index 0000000..bdfff7a
--- /dev/null
+++ b/data/licenses/cc0.txt
@@ -0,0 +1,118 @@
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT
+ PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT
+ CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES
+ THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO
+ WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION
+ OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES
+ RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR
+ WORKS PROVIDED HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically
+confer exclusive Copyright and Related Rights (defined below) upon the
+creator and subsequent owner(s) (each and all, an "owner") of an
+original work of authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work
+for the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without
+fear of later claims of infringement build upon, modify, incorporate
+in other works, reuse and redistribute as freely as possible in any
+form whatsoever and for any purposes, including without limitation
+commercial purposes. These owners may contribute to the Commons to
+promote the ideal of a free culture and the further production of
+creative, cultural and scientific works, or to gain reputation or
+greater distribution for their Work in part through the use and
+efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or
+she is an owner of Copyright and Related Rights in the Work,
+voluntarily elects to apply CC0 to the Work and publicly distribute
+the Work under its terms, with knowledge of his or her Copyright and
+Related Rights in the Work and the meaning and intended legal effect
+of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may
+be protected by copyright and related or neighboring rights
+("Copyright and Related Rights"). Copyright and Related Rights
+include, but are not limited to, the following:
+
+ the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work; moral rights retained by the
+ original author(s) and/or performer(s); publicity and privacy
+ rights pertaining to a person's image or likeness depicted in a
+ Work; rights protecting against unfair competition in regards to a
+ Work, subject to the limitations in paragraph 4(a), below; rights
+ protecting the extraction, dissemination, use and reuse of data in
+ a Work; database rights (such as those arising under Directive
+ 96/9/EC of the European Parliament and of the Council of 11 March
+ 1996 on the legal protection of databases, and under any national
+ implementation thereof, including any amended or successor version
+ of such directive); and other similar, equivalent or corresponding
+ rights throughout the world based on applicable law or treaty, and
+ any national implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in
+contravention of, applicable law, Affirmer hereby overtly, fully,
+permanently, irrevocably and unconditionally waives, abandons, and
+surrenders all of Affirmer's Copyright and Related Rights and
+associated claims and causes of action, whether now known or unknown
+(including existing as well as future claims and causes of action), in
+the Work (i) in all territories worldwide, (ii) for the maximum
+duration provided by applicable law or treaty (including future time
+extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"Waiver"). Affirmer makes the Waiver for the benefit of each member of
+the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal
+or equitable action to disrupt the quiet enjoyment of the Work by the
+public as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any
+reason be judged legally invalid or ineffective under applicable law,
+then the Waiver shall be preserved to the maximum extent permitted
+taking into account Affirmer's express Statement of Purpose. In
+addition, to the extent the Waiver is so judged Affirmer hereby grants
+to each affected person a royalty-free, non transferable, non
+sublicensable, non exclusive, irrevocable and unconditional license to
+exercise Affirmer's Copyright and Related Rights in the Work (i) in
+all territories worldwide, (ii) for the maximum duration provided by
+applicable law or treaty (including future time extensions), (iii) in
+any current or future medium and for any number of copies, and (iv)
+for any purpose whatsoever, including without limitation commercial,
+advertising or promotional purposes (the "License"). The License shall
+be deemed effective as of the date CC0 was applied by Affirmer to the
+Work. Should any part of the License for any reason be judged legally
+invalid or ineffective under applicable law, such partial invalidity
+or ineffectiveness shall not invalidate the remainder of the License,
+and in such case Affirmer hereby affirms that he or she will not (i)
+exercise any of his or her remaining Copyright and Related Rights in
+the Work or (ii) assert any associated claims and causes of action
+with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ No trademark or patent rights held by Affirmer are waived,
+ abandoned, surrendered, licensed or otherwise affected by this
+ document. Affirmer offers the Work as-is and makes no
+ representations or warranties of any kind concerning the Work,
+ express, implied, statutory or otherwise, including without
+ limitation warranties of title, merchantability, fitness for a
+ particular purpose, non infringement, or the absence of latent or
+ other defects, accuracy, or the present or absence of errors,
+ whether or not discoverable, all to the greatest extent
+ permissible under applicable law. Affirmer disclaims
+ responsibility for clearing rights of other persons that may apply
+ to the Work or any use thereof, including without limitation any
+ person's Copyright and Related Rights in the Work. Further,
+ Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work. Affirmer understands and acknowledges that Creative Commons
+ is not a party to this document and has no duty or obligation with
+ respect to this CC0 or use of the Work.
diff --git a/data/licenses/clear-bsd.txt b/data/licenses/clear-bsd.txt
new file mode 100644
index 0000000..550cf5b
--- /dev/null
+++ b/data/licenses/clear-bsd.txt
@@ -0,0 +1,33 @@
+The Clear BSD License
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the
+ distribution.
+
+ * Neither the name of <Owner Organization> nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/data/licenses/cpal-1.0.txt b/data/licenses/cpal-1.0.txt
new file mode 100644
index 0000000..c7ca984
--- /dev/null
+++ b/data/licenses/cpal-1.0.txt
@@ -0,0 +1,105 @@
+Common Public Attribution License Version 1.0 (CPAL)
+1. "Definitions"
+1.0.1 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party.
+1.1 "Contributor" means each entity that creates or contributes to the creation of Modifications.
+1.2 "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.
+1.3 "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.
+1.4 "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data.
+1.5 "Executable" means Covered Code in any form other than Source Code.
+1.6 "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.
+1.7 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.
+1.8 "License" means this document.
+1.8.1 "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
+1.9 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is:
+A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.
+B. Any new file that contains any part of the Original Code or previous Modifications.
+1.10 "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.
+1.10.1 "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
+1.11 "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.
+1.12 "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
+2. Source Code License.
+2.1 The Initial Developer Grant.
+The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
+(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and
+(b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof).
+(c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License.
+(d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices.
+2.2 Contributor Grant.
+Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license
+(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and
+(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
+(c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code.
+(d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.
+3. Distribution Obligations.
+3.1 Application of License.
+The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.
+3.2 Availability of Source Code.
+Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.
+3.3 Description of Modifications.
+You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.
+3.4 Intellectual Property Matters
+(a) Third Party Claims.
+If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.
+(b) Contributor APIs.
+If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file.
+(c) Representations.
+Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License.
+3.5 Required Notices.
+You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
+3.6 Distribution of Executable Versions.
+You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer, Original Developer or any Contributor. You hereby agree to indemnify the Initial Developer, Original Developer and every Contributor for any liability incurred by the Initial Developer, Original Developer or such Contributor as a result of any such terms You offer.
+3.7 Larger Works.
+You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.
+4. Inability to Comply Due to Statute or Regulation.
+If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
+5. Application of this License.
+This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code.
+6. Versions of the License.
+6.1 New Versions.
+Socialtext, Inc. ("Socialtext") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.
+6.2 Effect of New Versions.
+Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Socialtext. No one other than Socialtext has the right to modify the terms applicable to Covered Code created under this License.
+6.3 Derivative Works.
+If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "Socialtext", "CPAL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the CPAL. (Filling in the name of the Initial Developer, Original Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)
+7. DISCLAIMER OF WARRANTY.
+COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER, ORIGINAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+8. TERMINATION.
+8.1 This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
+8.2 If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer, Original Developer or a Contributor (the Initial Developer, Original Developer or Contributor against whom You file such action is referred to as "Participant") alleging that:
+(a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above.
+(b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant.
+8.3 If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.
+8.4 In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination.
+9. LIMITATION OF LIABILITY.
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ORIGINAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+10. U.S. GOVERNMENT END USERS.
+The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
+11. MISCELLANEOUS.
+This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
+12. RESPONSIBILITY FOR CLAIMS.
+As between Initial Developer, Original Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer, Original Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
+13. MULTIPLE-LICENSED CODE.
+Initial Developer may designate portions of the Covered Code as Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the CPAL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A.
+14. ADDITIONAL TERM: ATTRIBUTION
+(a) As a modest attribution to the organizer of the development of the Original Code ("Original Developer"), in the hope that its promotional value may help justify the time, money and effort invested in writing the Original Code, the Original Developer may include in Exhibit B ("Attribution Information") a requirement that each time an Executable and Source Code or a Larger Work is launched or initially run (which includes initiating a session), a prominent display of the Original Developer's Attribution Information (as defined below) must occur on the graphic user interface employed by the end user to access such Covered Code (which may include display on a splash screen), if any. The size of the graphic image should be consistent with the size of the other elements of the Attribution Information. If the access by the end user to the Executable and Source Code does not create a graphic user interface for access to the Covered Code, this obligation shall not apply. If the Original Code displays such Attribution Information in a particular form (such as in the form of a splash screen, notice at login, an "about" display, or dedicated attribution area on user interface screens), continued use of such form for that Attribution Information is one way of meeting this requirement for notice.
+(b) Attribution information may only include a copyright notice, a brief phrase, graphic image and a URL ("Attribution Information") and is subject to the Attribution Limits as defined below. For these purposes, prominent shall mean display for sufficient duration to give reasonable notice to the user of the identity of the Original Developer and that if You include Attribution Information or similar information for other parties, You must ensure that the Attribution Information for the Original Developer shall be no less prominent than such Attribution Information or similar information for the other party. For greater certainty, the Original Developer may choose to specify in Exhibit B below that the above attribution requirement only applies to an Executable and Source Code resulting from the Original Code or any Modification, but not a Larger Work. The intent is to provide for reasonably modest attribution, therefore the Original Developer cannot require that You display, at any time, more than the following information as Attribution Information: (a) a copyright notice including the name of the Original Developer; (b) a word or one phrase (not exceeding 10 words); (c) one graphic image provided by the Original Developer; and (d) a URL (collectively, the "Attribution Limits").
+(c) If Exhibit B does not include any Attribution Information, then there are no requirements for You to display any Attribution Information of the Original Developer.
+(d) You acknowledge that all trademarks, service marks and/or trade names contained within the Attribution Information distributed with the Covered Code are the exclusive property of their owners and may only be used with the permission of their owners, or under circumstances otherwise permitted by law or as expressly set out in this License.
+15. ADDITIONAL TERM: NETWORK USE.
+The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2.
+EXHIBIT A. Common Public Attribution License Version 1.0.
+"The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at _____________. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
+Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
+The Original Code is______________________.
+The Original Developer is not the Initial Developer and is __________. If left blank, the Original Developer is the Initial Developer.
+The Initial Developer of the Original Code is ____________. All portions of the code written by ___________ are Copyright (c) _____. All Rights Reserved.
+Contributor ______________________.
+Alternatively, the contents of this file may be used under the terms of the _____ license (the (___) License), in which case the provisions of (______) License are applicable instead of those above.
+If you wish to allow use of your version of this file only under the terms of the (____) License and not to allow others to use your version of this file under the CPAL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the (___) License. If you do not delete the provisions above, a recipient may use your version of this file under either the CPAL or the (___) License."
+(NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.)
+EXHIBIT B. Attribution Information
+Attribution Copyright Notice: _______________________
+Attribution Phrase (not exceeding 10 words): _______________________
+Attribution URL: _______________________
+Graphic Image as provided in the Covered Code, if any.
+Display of Attribution Information is (required/not required) in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL.
diff --git a/data/licenses/create-magnets.sh b/data/licenses/create-magnets.sh
new file mode 100755
index 0000000..b20be4b
--- /dev/null
+++ b/data/licenses/create-magnets.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This file is part of GNU LibreJS.
+#
+# GNU LibreJS is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU LibreJS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+
+# this script requires transmission-daemon. Install it as a package.
+echo "" > magnet-links.txt
+curtorrent=""
+for f in *.txt
+do
+ echo "Processing $f"
+ curtorrent="torrents/$f.torrent"
+ echo "Creating $curtorrent"
+ transmission-create -o "$curtorrent" "$f"
+ transmission-show --magnet "$curtorrent" >> magnet-links.txt
+done
diff --git a/data/licenses/epl-1.0.txt b/data/licenses/epl-1.0.txt
new file mode 100644
index 0000000..6d2f006
--- /dev/null
+++ b/data/licenses/epl-1.0.txt
@@ -0,0 +1,231 @@
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+ a) in the case of the initial Contributor, the initial code and
+ documentation distributed under this Agreement, and
+
+ b) in the case of each subsequent Contributor:
+
+ i) changes to the Program, and
+
+ ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's
+behalf. Contributions do not include additions to the Program which:
+(i) are separate modules of software distributed in conjunction with
+the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents" mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free
+ copyright license to reproduce, prepare derivative works of,
+ publicly display, publicly perform, distribute and sublicense the
+ Contribution of such Contributor, if any, and such derivative
+ works, in source code and object code form.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such
+ Contributor, if any, in source code and object code form. This
+ patent license shall apply to the combination of the Contribution
+ and the Program if, at the time the Contribution is added by the
+ Contributor, such addition of the Contribution causes such
+ combination to be covered by the Licensed Patents. The patent
+ license shall not apply to any other combinations which include
+ the Contribution. No hardware per se is licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe
+ the patent or other intellectual property rights of any other
+ entity. Each Contributor disclaims any liability to Recipient for
+ claims brought by any other entity based on infringement of
+ intellectual property rights or otherwise. As a condition to
+ exercising the rights and licenses granted hereunder, each
+ Recipient hereby assumes sole responsibility to secure any other
+ intellectual property rights needed, if any. For example, if a
+ third party patent license is required to allow Recipient to
+ distribute the Program, it is Recipient's responsibility to
+ acquire that license before distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+ a) it complies with the terms and conditions of this Agreement; and
+
+ b) its license agreement:
+
+ i) effectively disclaims on behalf of all Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and fitness
+ for a particular purpose;
+
+ ii) effectively excludes on behalf of all Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+
+ iii) states that any provisions which differ from this Agreement
+ are offered by that Contributor alone and not by any other
+ party; and
+
+ iv) states that source code for the Program is available from such
+ Contributor, and informs licensees how to obtain it in a
+ reasonable manner on or through a medium customarily used for
+ software exchange.
+
+When the Program is made available in source code form:
+
+ a) it must be made available under this Agreement; and
+
+ b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property
+infringement. In order to qualify, an Indemnified Contributor must: a)
+promptly notify the Commercial Contributor in writing of such claim,
+and b) allow the Commercial Contributor to control, and cooperate with
+the Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably
+practicable. However, Recipient's obligations under this Agreement and
+any licenses granted by Recipient relating to the Program shall
+continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
diff --git a/data/licenses/expat.txt b/data/licenses/expat.txt
new file mode 100644
index 0000000..1f95d26
--- /dev/null
+++ b/data/licenses/expat.txt
@@ -0,0 +1,5 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/data/licenses/freebsd.txt b/data/licenses/freebsd.txt
new file mode 100644
index 0000000..29b4d8e
--- /dev/null
+++ b/data/licenses/freebsd.txt
@@ -0,0 +1,25 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer. Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution. THIS SOFTWARE IS
+PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation
+are those of the authors and should not be interpreted as representing
+official policies, either expressed or implied, of the FreeBSD
+Project.
diff --git a/data/licenses/gpl-2.0.txt b/data/licenses/gpl-2.0.txt
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/data/licenses/gpl-2.0.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/data/licenses/gpl-3.0.txt b/data/licenses/gpl-3.0.txt
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/data/licenses/gpl-3.0.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/data/licenses/illinois-NCSA.txt b/data/licenses/illinois-NCSA.txt
new file mode 100644
index 0000000..4f2da6c
--- /dev/null
+++ b/data/licenses/illinois-NCSA.txt
@@ -0,0 +1,24 @@
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+“Softwareâ€), to deal with the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimers.
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimers in the
+documentation and/or other materials provided with the distribution.
+Neither the names of <Name of Development Group, Name of Institution>,
+nor the names of its contributors may be used to endorse or promote
+products derived from this Software without specific prior written
+permission. THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
diff --git a/data/licenses/imlib2.txt b/data/licenses/imlib2.txt
new file mode 100644
index 0000000..5fc3f71
--- /dev/null
+++ b/data/licenses/imlib2.txt
@@ -0,0 +1,31 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies of the Software and its Copyright notices. In addition publicly
+documented acknowledgment must be given that this software has been used if no
+source code of this software is made available publicly. Making the source
+available publicly means including the source for this software with the
+distribution, or a method to get this software via some reasonable mechanism
+(electronic transfer via a network or media) as well as making an offer to
+supply the source on request. This Copyright notice serves as an offer to
+supply the source on on request as well. Instead of this, supplying
+acknowledgments of use of this software in either Copyright notices, Manuals,
+Publicity and Marketing documents or any documentation provided with any
+product containing this software. This License does not apply to any software
+that links to the libraries provided by this software (statically or
+dynamically), but only to the software provided.
+
+Please see the COPYING-PLAIN for a plain-english explanation of this notice
+and its intent.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/data/licenses/lgpl-2.0.txt b/data/licenses/lgpl-2.0.txt
new file mode 100644
index 0000000..5bc8fb2
--- /dev/null
+++ b/data/licenses/lgpl-2.0.txt
@@ -0,0 +1,481 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/data/licenses/lgpl-2.1.txt b/data/licenses/lgpl-2.1.txt
new file mode 100644
index 0000000..4362b49
--- /dev/null
+++ b/data/licenses/lgpl-2.1.txt
@@ -0,0 +1,502 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/data/licenses/lgpl-3.0.txt b/data/licenses/lgpl-3.0.txt
new file mode 100644
index 0000000..65c5ca8
--- /dev/null
+++ b/data/licenses/lgpl-3.0.txt
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/data/licenses/magnet-links.txt b/data/licenses/magnet-links.txt
new file mode 100644
index 0000000..9a69a2f
--- /dev/null
+++ b/data/licenses/magnet-links.txt
@@ -0,0 +1,28 @@
+
+magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt
+magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt
+magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&dn=artistic-2.0.txt
+magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&dn=Boost-1.0.txt
+magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt
+magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt
+magnet:?xt=urn:btih:e8823381a12cbaec8042d8f5928ed9ca427ae6ed&dn=clear-bsd.txt
+magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&dn=cpal-1.0.txt
+magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&dn=epl-1.0.txt
+magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
+magnet:?xt=urn:btih:0c9737ee7c3f64a549ae792605960b900d0bab7f&dn=freebsd.txt
+magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt
+magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt
+magnet:?xt=urn:btih:035da57b2e51467406d7f737ce130844ceb555e1&dn=illinois-NCSA.txt
+magnet:?xt=urn:btih:34b1392ce6108db166bd9ee4a37e655c67891e5b&dn=imlib2.txt
+magnet:?xt=urn:btih:3254dcf4f9d9dadad8dfb4951177854d5d0e2491&dn=IntelACPI.txt
+magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&dn=ISC.txt
+magnet:?xt=urn:btih:fcd495f3ca5fb96b147041401bcf213eec0a6439&dn=lgpl-2.0.txt
+magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt
+magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt
+magnet:?xt=urn:btih:2f25cfbac271643d1e41a754034e8daedeb8a281&dn=magnet-links.txt
+magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt
+magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt
+magnet:?xt=urn:btih:5866afca5f37889c0c1fdd108f4922d4fcdb5e3d&dn=unlicense.txt
+magnet:?xt=urn:btih:723febf9f6185544f57f0660a41489c7d6b4931b&dn=wtfpl.txt
+magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt
+magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&dn=xfree86.txt
diff --git a/data/licenses/mpl-2.0.txt b/data/licenses/mpl-2.0.txt
new file mode 100644
index 0000000..14e2f77
--- /dev/null
+++ b/data/licenses/mpl-2.0.txt
@@ -0,0 +1,373 @@
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
diff --git a/data/licenses/public-domain.txt b/data/licenses/public-domain.txt
new file mode 100644
index 0000000..68cf1a8
--- /dev/null
+++ b/data/licenses/public-domain.txt
@@ -0,0 +1,18 @@
+Being in the public domain is not a license; rather, it means the
+material is not copyrighted and no license is needed. Practically
+speaking, though, if a work is in the public domain, it might as well
+have an all-permissive non-copyleft free software license. Public
+domain material is compatible with the GNU GPL.
+
+If you want to release your work to the public domain, we encourage
+you to use formal tools to do so. We ask people who make small
+contributions to GNU to sign a disclaimer form; that's one
+solution. If you're working on a project that doesn't have formal
+contribution policies like that, CC0 is a good tool that anyone can
+use. It formally dedicates your work to the public domain, and
+provides a fallback license for cases where that is not legally
+possible.
+
+http://directory.fsf.org/wiki/License:CC0
+
+Source: http://www.gnu.org/licenses/license-list.html#PublicDomain
diff --git a/data/licenses/torrents/Boost-1.0.txt.torrent b/data/licenses/torrents/Boost-1.0.txt.torrent
new file mode 100644
index 0000000..d859c22
--- /dev/null
+++ b/data/licenses/torrents/Boost-1.0.txt.torrent
@@ -0,0 +1,2 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343399e8:encoding5:UTF-84:infod6:lengthi1338e4:name13:Boost-1.0.txt12:piece lengthi32768e6:pieces20:<º)â¹ÕŸbÖú
+8k-½7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/ISC.txt.torrent b/data/licenses/torrents/ISC.txt.torrent
new file mode 100644
index 0000000..c221f05
--- /dev/null
+++ b/data/licenses/torrents/ISC.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343405e8:encoding5:UTF-84:infod6:lengthi683e4:name7:ISC.txt12:piece lengthi32768e6:pieces20:_9tq””ø…ç-°ä~.ŽÎw 7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/IntelACPI.txt.torrent b/data/licenses/torrents/IntelACPI.txt.torrent
new file mode 100644
index 0000000..8de0ded
--- /dev/null
+++ b/data/licenses/torrents/IntelACPI.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343405e8:encoding5:UTF-84:infod6:lengthi6080e4:name13:IntelACPI.txt12:piece lengthi32768e6:pieces20: ¹×æo°Ÿ†ê*-|í_(7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/agpl-3.0.txt.torrent b/data/licenses/torrents/agpl-3.0.txt.torrent
new file mode 100644
index 0000000..21f7000
--- /dev/null
+++ b/data/licenses/torrents/agpl-3.0.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343398e8:encoding5:UTF-84:infod6:lengthi34520e4:name12:agpl-3.0.txt12:piece lengthi32768e6:pieces40:‚¥¢öIß='5íN?bý¨¤.ÐÅİNʯÈúï¸ÕJ¡”6ÿœ7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/apache-2.0.txt.torrent b/data/licenses/torrents/apache-2.0.txt.torrent
new file mode 100644
index 0000000..f0b13ab
--- /dev/null
+++ b/data/licenses/torrents/apache-2.0.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343398e8:encoding5:UTF-84:infod6:lengthi11358e4:name14:apache-2.0.txt12:piece lengthi32768e6:pieces20:+‹R)ªŠaäƒûK X‹‹lI7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/artistic-2.0.txt.torrent b/data/licenses/torrents/artistic-2.0.txt.torrent
new file mode 100644
index 0000000..5bb11db
--- /dev/null
+++ b/data/licenses/torrents/artistic-2.0.txt.torrent
Binary files differ
diff --git a/data/licenses/torrents/bsd-3-clause.txt.torrent b/data/licenses/torrents/bsd-3-clause.txt.torrent
new file mode 100644
index 0000000..9dfc19a
--- /dev/null
+++ b/data/licenses/torrents/bsd-3-clause.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343400e8:encoding5:UTF-84:infod6:lengthi1373e4:name16:bsd-3-clause.txt12:piece lengthi32768e6:pieces20:ëÒP©`ïã‰ôZ†Œó#ô²°à‰7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/cc0.txt.torrent b/data/licenses/torrents/cc0.txt.torrent
new file mode 100644
index 0000000..02991e9
--- /dev/null
+++ b/data/licenses/torrents/cc0.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343400e8:encoding5:UTF-84:infod6:lengthi6982e4:name7:cc0.txt12:piece lengthi32768e6:pieces20:¢&Nq˜L/bQV¾ ÕÊ–™\Â7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/clear-bsd.txt.torrent b/data/licenses/torrents/clear-bsd.txt.torrent
new file mode 100644
index 0000000..5f56d34
--- /dev/null
+++ b/data/licenses/torrents/clear-bsd.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343401e8:encoding5:UTF-84:infod6:lengthi1633e4:name13:clear-bsd.txt12:piece lengthi32768e6:pieces20:Ÿ ”1m? „Á§[>$k™Ž7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/cpal-1.0.txt.torrent b/data/licenses/torrents/cpal-1.0.txt.torrent
new file mode 100644
index 0000000..93e5631
--- /dev/null
+++ b/data/licenses/torrents/cpal-1.0.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343401e8:encoding5:UTF-84:infod6:lengthi28079e4:name12:cpal-1.0.txt12:piece lengthi32768e6:pieces20:Î*²T#Ѹ X;ÀhÔ è?ÚÛæ…7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/expat.txt.torrent b/data/licenses/torrents/expat.txt.torrent
new file mode 100644
index 0000000..62f134f
--- /dev/null
+++ b/data/licenses/torrents/expat.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343402e8:encoding5:UTF-84:infod6:lengthi1023e4:name9:expat.txt12:piece lengthi32768e6:pieces20:©ó|+®þDàݶî( ¡²¹ï957:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/freebsd.txt.torrent b/data/licenses/torrents/freebsd.txt.torrent
new file mode 100644
index 0000000..8d07cb1
--- /dev/null
+++ b/data/licenses/torrents/freebsd.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343402e8:encoding5:UTF-84:infod6:lengthi1426e4:name11:freebsd.txt12:piece lengthi32768e6:pieces20: ÛS­ VuÓ;¦´‡™3àÜöGí7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/gpl-2.0.txt.torrent b/data/licenses/torrents/gpl-2.0.txt.torrent
new file mode 100644
index 0000000..55830d3
--- /dev/null
+++ b/data/licenses/torrents/gpl-2.0.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343403e8:encoding5:UTF-84:infod6:lengthi18092e4:name11:gpl-2.0.txt12:piece lengthi32768e6:pieces20:LÇ{¯‘æ¦JàH“ýÿ§“¸L7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/gpl-3.0.txt.torrent b/data/licenses/torrents/gpl-3.0.txt.torrent
new file mode 100644
index 0000000..b101841
--- /dev/null
+++ b/data/licenses/torrents/gpl-3.0.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343403e8:encoding5:UTF-84:infod6:lengthi35147e4:name11:gpl-3.0.txt12:piece lengthi32768e6:pieces40:N@ˆ˜ã™Þšmýê¢Íô’M焎š¥F–)f"&"`ÕHŠå~üw7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/illinois-NCSA.txt.torrent b/data/licenses/torrents/illinois-NCSA.txt.torrent
new file mode 100644
index 0000000..3ce156a
--- /dev/null
+++ b/data/licenses/torrents/illinois-NCSA.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343404e8:encoding5:UTF-84:infod6:lengthi1462e4:name17:illinois-NCSA.txt12:piece lengthi32768e6:pieces20:Wá¢1úíõiÐé$±F¸´J–*Ê7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/imlib2.txt.torrent b/data/licenses/torrents/imlib2.txt.torrent
new file mode 100644
index 0000000..5975ed3
--- /dev/null
+++ b/data/licenses/torrents/imlib2.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343404e8:encoding5:UTF-84:infod6:lengthi1987e4:name10:imlib2.txt12:piece lengthi32768e6:pieces20:÷´Øpi.§Ó»?ÉßtRî7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/lgpl-2.0.txt.torrent b/data/licenses/torrents/lgpl-2.0.txt.torrent
new file mode 100644
index 0000000..fe8e055
--- /dev/null
+++ b/data/licenses/torrents/lgpl-2.0.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343406e8:encoding5:UTF-84:infod6:lengthi25383e4:name12:lgpl-2.0.txt12:piece lengthi32768e6:pieces20:º‰fâG:™i½Ê³Ü‚'L|ý˜¡7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/lgpl-2.1.txt.torrent b/data/licenses/torrents/lgpl-2.1.txt.torrent
new file mode 100644
index 0000000..ae6e06b
--- /dev/null
+++ b/data/licenses/torrents/lgpl-2.1.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343406e8:encoding5:UTF-84:infod6:lengthi26530e4:name12:lgpl-2.1.txt12:piece lengthi32768e6:pieces20:¦´¿y¬©µV‚&jú¸nŒO¿7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/lgpl-3.0.txt.torrent b/data/licenses/torrents/lgpl-3.0.txt.torrent
new file mode 100644
index 0000000..c518b15
--- /dev/null
+++ b/data/licenses/torrents/lgpl-3.0.txt.torrent
@@ -0,0 +1,2 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343407e8:encoding5:UTF-84:infod6:lengthi7651e4:name12:lgpl-3.0.txt12:piece lengthi32768e6:pieces20:ô^áÇedh´BÊXÞrâ
+d§Ýº7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/magnet-links.txt.torrent b/data/licenses/torrents/magnet-links.txt.torrent
new file mode 100644
index 0000000..9e7641b
--- /dev/null
+++ b/data/licenses/torrents/magnet-links.txt.torrent
Binary files differ
diff --git a/data/licenses/torrents/mpl-2.0.txt.torrent b/data/licenses/torrents/mpl-2.0.txt.torrent
new file mode 100644
index 0000000..cbe4ec0
--- /dev/null
+++ b/data/licenses/torrents/mpl-2.0.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343408e8:encoding5:UTF-84:infod6:lengthi16726e4:name11:mpl-2.0.txt12:piece lengthi32768e6:pieces20:—DÎÜà™÷'³'Í™¡ýÅŠU™7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/public-domain.txt.torrent b/data/licenses/torrents/public-domain.txt.torrent
new file mode 100644
index 0000000..a1efd8a
--- /dev/null
+++ b/data/licenses/torrents/public-domain.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343408e8:encoding5:UTF-84:infod6:lengthi889e4:name17:public-domain.txt12:piece lengthi32768e6:pieces20:â§JaHûã2’IÛO‡4 ó¾(7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/unlicense.txt.torrent b/data/licenses/torrents/unlicense.txt.torrent
new file mode 100644
index 0000000..c77ff26
--- /dev/null
+++ b/data/licenses/torrents/unlicense.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343409e8:encoding5:UTF-84:infod6:lengthi1212e4:name13:unlicense.txt12:piece lengthi32768e6:pieces20:§y’¯FAÞm¡†@$š² Žm— 7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/wtfpl.txt.torrent b/data/licenses/torrents/wtfpl.txt.torrent
new file mode 100644
index 0000000..7819326
--- /dev/null
+++ b/data/licenses/torrents/wtfpl.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343409e8:encoding5:UTF-84:infod6:lengthi432e4:name9:wtfpl.txt12:piece lengthi32768e6:pieces20:ÔHÙÿ’šÂ·O.KªßýUi7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/x11.txt.torrent b/data/licenses/torrents/x11.txt.torrent
new file mode 100644
index 0000000..f6239e2
--- /dev/null
+++ b/data/licenses/torrents/x11.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343410e8:encoding5:UTF-84:infod6:lengthi1293e4:name7:x11.txt12:piece lengthi32768e6:pieces20:&×¾;T‚#¢+j‹¶H,uÜq7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/torrents/xfree86.txt.torrent b/data/licenses/torrents/xfree86.txt.torrent
new file mode 100644
index 0000000..b4c430e
--- /dev/null
+++ b/data/licenses/torrents/xfree86.txt.torrent
@@ -0,0 +1 @@
+d10:created by25:Transmission/2.82 (14160)13:creation datei1408343411e8:encoding5:UTF-84:infod6:lengthi2297e4:name11:xfree86.txt12:piece lengthi32768e6:pieces20:)~ŽSÅÿHu¤×í–;y0°h>7:privatei0eee \ No newline at end of file
diff --git a/data/licenses/unlicense.txt b/data/licenses/unlicense.txt
new file mode 100644
index 0000000..471f09f
--- /dev/null
+++ b/data/licenses/unlicense.txt
@@ -0,0 +1,25 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
+
diff --git a/data/licenses/wtfpl.txt b/data/licenses/wtfpl.txt
new file mode 100644
index 0000000..0557e73
--- /dev/null
+++ b/data/licenses/wtfpl.txt
@@ -0,0 +1,11 @@
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
diff --git a/data/licenses/x11.txt b/data/licenses/x11.txt
new file mode 100644
index 0000000..e133cb3
--- /dev/null
+++ b/data/licenses/x11.txt
@@ -0,0 +1,26 @@
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+X Window System is a trademark of X Consortium, Inc.
+
diff --git a/data/licenses/xfree86.txt b/data/licenses/xfree86.txt
new file mode 100644
index 0000000..b41fc74
--- /dev/null
+++ b/data/licenses/xfree86.txt
@@ -0,0 +1,43 @@
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions, and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution,
+and in the same place and form as other copyright, license and
+disclaimer information.
+
+3. The end-user documentation included with the redistribution, if
+any, must include the following acknowledgment: "This product includes
+software developed by The XFree86 Project, Inc
+(http://www.xfree86.org/) and its contributors", in the same place and
+form as other third-party acknowledgments. Alternately, this
+acknowledgment may appear in the software itself, in the same form and
+location as other such third-party acknowledgments.
+
+4. Except as contained in this notice, the name of The XFree86
+Project, Inc shall not be used in advertising or otherwise to promote
+the sale, use or other dealings in this Software without prior written
+authorization from The XFree86 Project, Inc.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/data/loading/loader.gif b/data/loading/loader.gif
new file mode 100644
index 0000000..22a5bb3
--- /dev/null
+++ b/data/loading/loader.gif
Binary files differ
diff --git a/data/loading/loading-panel.html b/data/loading/loading-panel.html
new file mode 100644
index 0000000..4db4709
--- /dev/null
+++ b/data/loading/loading-panel.html
@@ -0,0 +1,31 @@
+<!doctype html>
+
+<html>
+<head>
+<!-- /**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+-->
+</head>
+
+<body>
+<h1>LibreJS: Analyzing JavaScript</h1>
+<img src="./loader.gif"/>
+</body>
+</html>
diff --git a/data/preferences_panel/contentscript.js b/data/preferences_panel/contentscript.js
new file mode 100644
index 0000000..8d79fe1
--- /dev/null
+++ b/data/preferences_panel/contentscript.js
@@ -0,0 +1,67 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * Handle messages sent from add-on to the content script
+ */
+self.on('message', function (message) {
+ var reason = message[0];
+
+ if (reason == "INCOMINGPREFS") {
+ // These are the prefs we need to set up the pref panel
+ initPanel(message);
+ }
+});
+
+function initPanel(prefObject) {
+ for (var i in prefObject) {
+ if (prefObject[i]) {
+ if (prefObject[i].split(":")[1]) {
+ try {
+ var item = this.document.getElementById(
+ "pref_" + prefObject[i].split(":")[0]);
+ item.checked = prefObject[i].split(":")[1] == "true";
+ } catch(e) {
+ //"ERROR: " + //console.log(i);
+ }
+ }
+ }
+ }
+
+
+ var inputs = this.document.getElementsByTagName("input");
+
+ for (i in inputs) {
+ input = inputs[i]; // correct version
+
+ if (input) {
+ if (input.nodeName == "INPUT") {
+ input.onclick = function() {
+ self.postMessage(
+ "SETPREF:" +
+ this.id.split("pref_")[1] +
+ ":" + this.checked);
+ };
+ }
+ }
+ }
+
+ prefObject = null;
+}
diff --git a/data/preferences_panel/preferences_panel.html b/data/preferences_panel/preferences_panel.html
new file mode 100644
index 0000000..51a4c8e
--- /dev/null
+++ b/data/preferences_panel/preferences_panel.html
@@ -0,0 +1,71 @@
+<html>
+ <head>
+<!-- /**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+-->
+ <title>
+ LibreJS preferences
+ </title>
+ <style>
+ body > div {
+ border: 1px black;
+ }
+ div.choice {
+ background: #555;
+ color:#c4c4c4;
+ margin:10px;
+
+ padding:10px;
+ font-size:13px;
+ clear:both;
+ overflow:hidden;
+ }
+ input {
+ float:left;
+ display:inline;
+ }
+ div.choice p {
+ display:block;
+ width:200px;
+ float:left;
+ margin-left:0;
+ }
+ span.notdone {
+ color:red;
+ }
+ #pref_whitelist {
+ width:240px;
+ }
+ </style>
+
+ </head>
+
+ <body>
+ <h3>
+ LibreJS Preferences
+ </h3>
+ <div>
+ <div>
+ <div class="choice">
+ <input id="pref_nolazy" type="checkbox"/><p>Do not consider lazy license mentions as free (e.g.: dual-licensed under MIT and GPL, ...)</p>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/data/script_detector/script_detector.js b/data/script_detector/script_detector.js
new file mode 100644
index 0000000..8c96cc4
--- /dev/null
+++ b/data/script_detector/script_detector.js
@@ -0,0 +1,359 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// array reflects valid types as listed in
+// http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsScriptLoader.cpp#437
+// anything appended to end of strings is considered valid:
+var jsValidTypes = [
+ /^text\/javascript/i,
+ /^text\/ecmascript/i,
+ /^application\/javascript/i,
+ /^application\/ecmascript/i,
+ /^application\/x-javascript/i
+];
+
+// the list of all available event attributes
+var intrinsicEvents = [
+ "onload",
+ "onunload",
+ "onclick",
+ "ondblclick",
+ "onmousedown",
+ "onmouseup",
+ "onmouseover",
+ "onmousemove",
+ "onmouseout",
+ "onfocus",
+ "onblur",
+ "onkeypress",
+ "onkeydown",
+ "onkeyup",
+ "onsubmit",
+ "onreset",
+ "onselect",
+ "onchange"];
+
+
+/**
+ * scriptHasInvalidType
+ *
+ * Checks that a script does not have a js "template" type.
+ * Normally any script that has a type attribute other than the
+ * few allowed ones is not interpreted. But by security, we only
+ * discard a few of them.
+ *
+ * @param script obj The script element.
+ * @return returns true if it matches a template type.
+ *
+ */
+var scriptHasInvalidType = function (type) {
+
+ var i = 0,
+ le = jsValidTypes.length;
+
+ if (type === 'librejs/blocked') {
+ // js has already been blocked.
+ return true;
+ }
+
+ if (!type) {
+ // type isn't set, don't look further.
+ return false;
+ }
+
+ for (; i < le; i++) {
+ if (jsValidTypes[i].test(type)) {
+ return false;
+ }
+ }
+
+ // type is invalid and
+ // hence cannot be executed.
+ return true;
+
+};
+
+
+/**
+ * scriptDetector
+ * Detects all scripts (inline, onpage, and external)
+ * and checks whether they have been blocked or if they
+ * are being executed.
+ */
+
+var scriptDetector = {
+ contactLink: null,
+ blockedScripts: null,
+ acceptedScripts: null,
+ dryRunScripts: null,
+ acceptedAttributes: null,
+ acceptedCode: [],
+ blockedCode: [],
+ dryRunCode: [],
+
+ init: function() {
+ if (typeof $ !== 'function') {
+ return;
+ }
+ this.blockedScripts = $('script[type="librejs/blocked"]');
+ this.acceptedScripts = $('script[type!="librejs/blocked"]')
+ .not('script[data-librejs-dryrun]');
+ this.dryRunScripts = $('script[data-librejs-dryrun]');
+ console.debug(this.dryRunScripts);
+ this.fetchAllNonScriptTags();
+
+ if (this.blockedScripts.length) {
+ // display noscript tags if applicable.
+ this.displayNoScriptTags();
+ try {
+ // initialize the page mod code.
+ pageModFinder.init();
+ } catch (e) {
+ // fail silently.
+ }
+ this.fetchBlockedScripts();
+ }
+
+ if (this.acceptedScripts.length) {
+ this.fetchAcceptedScripts();
+ }
+ if (this.dryRunScripts.length) {
+ this.fetchDryRunScripts();
+ }
+
+ self.postMessage({
+ 'event': 'scriptsFetched',
+ 'value': {
+ 'blocked': this.blockedCode,
+ 'accepted': this.acceptedCode,
+ 'dryRun': this.dryRunCode
+ }
+ });
+ },
+
+ /**
+ * fetchBlockedScripts
+ *
+ * Gather blocked scripts.
+ *
+ */
+ fetchBlockedScripts: function () {
+ var that = this,
+ singleton = '', reason;
+
+ this.blockedScripts.each(function() {
+ singleton = '';
+ reason = "";
+
+
+ if ($(this).data('librejs-reason') && $(this).data('librejs-reason').length > 9) {
+ reason = $(this).data('librejs-reason') + ': ';
+ }
+
+ if ($(this).text()) {
+
+ if ($(this).data('singleton') === true) {
+ singleton = 'This script was removed before LibreJS analysis: ';
+ }
+
+ that.blockedCode.push({'contents': singleton + reason + that.truncateText($(this).text()),
+ 'inline': true});
+ }
+
+ if ($(this).data('librejs-blocked-src')) {
+
+ that.blockedCode.push({'url': $(this).data('librejs-blocked-src'), 'contents': reason, 'inline': false});
+ }
+
+ });
+ },
+
+ /**
+ * fetchAcceptedScripts
+ *
+ * Gather accepted scripts.
+ *
+ */
+ fetchAcceptedScripts: function () {
+
+ var that = this, typeMessage = '', reason = "";
+
+ this.acceptedScripts.each(function() {
+ reason = "";
+
+ if ($(this).data('librejs-reason') && $(this).data('librejs-reason').length > 9) {
+ reason = $(this).data('librejs-reason') + ':';
+ }
+
+ if ($(this).attr('type') &&
+ scriptHasInvalidType($(this).attr('type'))) {
+ typeMessage = 'script type is not valid (js is not executed): '+ $(this).attr('type') + ' ';
+ }
+
+ if ($(this).text()) {
+ that.acceptedCode.push({'contents': reason + typeMessage + that.truncateText($(this).text()),
+ 'inline': true});
+ }
+
+ if ($(this).attr('src')) {
+ that.acceptedCode.push({'url': $(this).attr('src'), 'contents': reason + typeMessage,
+ 'inline': false});
+ }
+
+ });
+
+ },
+
+ /**
+ * fetchDryRunScripts
+ *
+ * Gather accepted scripts.
+ *
+ */
+ fetchDryRunScripts: function () {
+ var that = this, typeMessage = '', reason = "";
+ this.dryRunScripts.each(function() {
+ reason = "";
+ if ($(this).data('librejs-reason') && $(this).data('librejs-reason').length > 9) {
+ reason = $(this).data('librejs-reason') + ':';
+ }
+
+ if ($(this).attr('type') &&
+ scriptHasInvalidType($(this).attr('type'))) {
+ typeMessage = 'script type is not valid (js is not executed): '+ $(this).attr('type') + ' ';
+ }
+
+ if ($(this).text()) {
+ that.dryRunCode.push({'contents': reason + typeMessage + that.truncateText($(this).text()),
+ 'inline': true});
+ }
+
+ if ($(this).attr('src')) {
+ that.dryRunCode.push({'url': $(this).attr('src'), 'contents': reason + typeMessage,
+ 'inline': false});
+ }
+
+ });
+
+ },
+
+ fetchAllNonScriptTags: function () {
+ var that = this;
+ var blockedAnchors = $('*[data-librejs="rejected"]').not('script');
+ var acceptedAnchors = $('*[data-librejs="accepted"]').not('script');
+ var i = 0, le, attributes;
+
+ acceptedAnchors.each(function () {
+
+ var content = "";
+
+ if ($(this).attr('href')) {
+
+ content = $(this).attr('href');
+
+ }
+
+ else {
+ content = that.findOnAttributeContent($(this));
+ }
+
+ that.acceptedCode.push(
+ {contents: 'in attribute: ' + content,
+ inline: true}
+ );
+
+ });
+
+ blockedAnchors.each(function () {
+
+ var content = "";
+
+ if ($(this).attr('href')) {
+ content = $(this).attr('href');
+ } else if ($(this).data('librejs-blocked-event')) {
+ attributes = $(this).data('librejs-blocked-event');
+ le = attributes.length;
+ for (i = 0; i < le; i++) {
+ content += attributes[i].attribute + ":" + attributes[i].value + ";\n";
+ }
+ }
+
+ that.blockedCode.push(
+ {contents: 'in attribute: ' + content,
+ inline: true}
+ );
+ });
+ },
+
+ findOnAttributeContent: function (elem) {
+ var i = 0,
+ le = intrinsicEvents.length,
+ content = "";
+
+ for (; i < le; i++) {
+
+ if (elem.attr(intrinsicEvents[i])) {
+
+ content += elem.attr(intrinsicEvents[i]) + " -- ";
+
+ }
+
+ }
+ return content;
+ },
+
+ /**
+ * displayNoScriptTags
+ * Whenever blocked scripts are found, deep clone noscript tags
+ * and place them in a new div.
+ */
+ displayNoScriptTags: function () {
+
+ var noscripts = $('body noscript'),
+ div, content;
+
+ noscripts.each(function (index) {
+ div = $('<div/>');
+
+
+ content = $(this).contents();
+ content = $("<div>").html(content).text();
+
+ div.append(content);
+ div.children('style, script, meta').remove();
+
+
+ // insert noscript content right after the
+ // original noscript tag.
+ div.insertAfter($(this));
+ });
+
+ },
+ truncateText: function (str) {
+
+ if (str.length > 1000) {
+ str = str.slice(0, 1000) + '…';
+ }
+ return str;
+ }
+
+};
+
+scriptDetector.init();
diff --git a/data/script_libraries/gethash.sh b/data/script_libraries/gethash.sh
new file mode 100755
index 0000000..21381ac
--- /dev/null
+++ b/data/script_libraries/gethash.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+#
+# gethash.sh
+#
+# Get the hash of a js file for use in the librejs database.
+# Output a JSON object to be included in script-libraries.json
+
+url=$1
+t=$(mktemp)
+wget --quiet -O $t $url
+if [ $? -ne 0 ]
+then
+ echo $url not found
+ exit 1
+fi
+s=$(iconv -f LATIN1 -t UTF8 $t | sha1sum | awk '{print $1}')
+cat <<EOF
+ "$s": {
+ "filename": "$url",
+ "result": "[freelib"]
+ }
+EOF
+
+rm -f $t
diff --git a/data/script_libraries/script-libraries.json b/data/script_libraries/script-libraries.json
new file mode 100644
index 0000000..ea66460
--- /dev/null
+++ b/data/script_libraries/script-libraries.json
@@ -0,0 +1,1511 @@
+{
+ "9d6f8bdcadd59eba977e9e31066bf393c9fdf8a4": {
+ "filename": "http://code.jquery.com/jquery-1.0.4.js",
+ "result": "[freelib]"
+ },
+ "31555f340a206de7622fb760718ef4a1b296ed44": {
+ "filename": "http://code.jquery.com/jquery-1.1.js",
+ "result": "[freelib]"
+ },
+ "88c03b5c437ac3551661ecfbe6e1de155c3099c4": {
+ "filename": "http://code.jquery.com/jquery-1.0.pack.js",
+ "result": "[freelib]"
+ },
+ "08341cd159e29f561ca0ec16c99bf4b85e43d30f": {
+ "filename": "http://code.jquery.com/jquery-1.0.1.pack.js",
+ "result": "[freelib]"
+ },
+ "84b1514a01def3bc0b52f6fa03d0d9fa349bef72": {
+ "filename": "http://code.jquery.com/jquery-1.0.2.pack.js",
+ "result": "[freelib]"
+ },
+ "d3b30b0fead39e4c40fb0c91408e74439020a279": {
+ "filename": "http://code.jquery.com/jquery-1.0.2.js",
+ "result": "[freelib]"
+ },
+ "fa05290dadfb7d2659a55c50b77595e23f999a74": {
+ "filename": "http://code.jquery.com/jquery-1.0.1.js",
+ "result": "[freelib]"
+ },
+ "4a2c9fd552e1ca9ad66feaaad365990b1e664a8f": {
+ "filename": "http://code.jquery.com/jquery-1.0.4.pack.js",
+ "result": "[freelib]"
+ },
+ "ddb4126bf4713cb4e0f2310401e58cb9e3f98997": {
+ "filename": "http://code.jquery.com/jquery-1.0.3.pack.js",
+ "result": "[freelib]"
+ },
+ "4c12e01d990bd2b1075812d9f28e3ffa50ca59df": {
+ "filename": "http://code.jquery.com/jquery-1.0.3.js",
+ "result": "[freelib]"
+ },
+ "16306f8187df578589821e6eb6b807ac4d467d1f": {
+ "filename": "http://code.jquery.com/jquery-1.1.pack.js",
+ "result": "[freelib]"
+ },
+ "24dd74d65d2e02aae973af97ebbb31b9820a5bbb": {
+ "filename": "http://code.jquery.com/jquery-1.1.1.pack.js",
+ "result": "[freelib]"
+ },
+ "24fdaa88685c8b2dadcc94559ceef318fdcd115b": {
+ "filename": "http://code.jquery.com/jquery-1.1.1.js",
+ "result": "[freelib]"
+ },
+ "07c089df7b7a5da16f434870087d6b0e1c45d3b5": {
+ "filename": "http://code.jquery.com/jquery-1.1.2.pack.js",
+ "result": "[freelib]"
+ },
+ "788bb58005b75a004cd7abbd26f942eea0391f47": {
+ "filename": "http://code.jquery.com/jquery-1.1.2.js",
+ "result": "[freelib]"
+ },
+ "a7e07121debf460f86aa77073676c1e936478c22": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.1.3.js",
+ "result": "[freelib]"
+ },
+ "d0d4200eedc83fe692dd65aeab5a548bfe840d06": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.1.3.1.pack.js",
+ "result": "[freelib]"
+ },
+ "e1c9252b3e60673e4fa1bb1648cb18cd33139535": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.1.3.1.js",
+ "result": "[freelib]"
+ },
+ "0c80055d513ce3103bb70ca956be005f63e32922": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.1.4.pack.js",
+ "result": "[freelib]"
+ },
+ "5af7abb29b3b091080db17e53ef6ddcfa555dbe6": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.1.4.js",
+ "result": "[freelib]"
+ },
+ "e0c497fc264d7706da23235266ed52acf2c7b89a": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.min.js",
+ "result": "[freelib]"
+ },
+ "3aca6488dfb65cf0e600a7a70376ca1354b7377c": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.js",
+ "result": "[freelib]"
+ },
+ "0cafb88edcaebad82c207cdf124de1889364c9f3": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.1.min.js",
+ "result": "[freelib]"
+ },
+ "384cbfe95d92a30d7c86ac07ea5de56f79c15f6a": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.1.js",
+ "result": "[freelib]"
+ },
+ "2710cce192fcc4dc676d9572cd852f104ea59387": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.2.pack.js",
+ "result": "[freelib]"
+ },
+ "6869cb783670d6a4923aaccfe4331015961ed8d6": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.4.pack.js",
+ "result": "[freelib]"
+ },
+ "55c7f265deba4afc1335071fafbbf7fda8f02bbe": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.6.js",
+ "result": "[freelib]"
+ },
+ "f3abd53f3725675e3e049c414749e16df11951ba": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.3.js",
+ "result": "[freelib]"
+ },
+ "7b9e8594368d30387059e5fdef9d662095dbbf7a": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.3.min.js",
+ "result": "[freelib]"
+ },
+ "6be187a67b639b65dc8427eb8e790e42bbe4d7dd": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.3.1.js",
+ "result": "[freelib]"
+ },
+ "fed603a4db640b82de54b246de4be7a1cffa8780": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js",
+ "result": "[freelib]"
+ },
+ "f0b95e99225f314fbe37ccf6b74ce2f916c517de": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.3.2.js",
+ "result": "[freelib]"
+ },
+ "3dc9f7c2642efff4482e68c9d9df874bf98f5bcb": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js",
+ "result": "[freelib]"
+ },
+ "ea6cc893792569fdbb344181034eb668261f2b24": {
+ "filename": "http://code.jquery.com/jquery-1.5.1.js",
+ "result": "[freelib]"
+ },
+ "fe7b4d1b72fc22fc397f3df3f1fd891c78f8fc96": {
+ "filename": "http://code.jquery.com/jquery-1.5.2.min.js",
+ "result": "[freelib]"
+ },
+ "b509dd44ba3f9c72cf8bba6fcb5f06fae15cabf6": {
+ "filename": "http://code.jquery.com/jquery-1.5.2.js",
+ "result": "[freelib]"
+ },
+ "22c1eefcce5be20a3e0966f5bcdf88ed81e9f5e7": {
+ "filename": "http://code.jquery.com/jquery-1.6.1.js",
+ "result": "[freelib]"
+ },
+ "7fa300666dadade0d006e4c496bf1c85f4b0ab0c": {
+ "filename": "http://code.jquery.com/jquery-1.6.2.min.js",
+ "result": "[freelib]"
+ },
+ "eeee9d4604e71f2e01b818fc1439f7b5baf1be7a": {
+ "filename": "http://code.jquery.com/jquery-1.6.2.js",
+ "result": "[freelib]"
+ },
+ "aee58a81bea80c20176c61ff03caaf0aa273f9a1": {
+ "filename": "http://code.jquery.com/jquery-1.6.3.min.js",
+ "result": "[freelib]"
+ },
+ "61a11f601d70a331de6444c11e72eab2ffd86427": {
+ "filename": "http://code.jquery.com/jquery-1.6.4.min.js",
+ "result": "[freelib]"
+ },
+ "3e5c6d7c6e09965d36df8c1e3d9dca6462c41ec1": {
+ "filename": "http://code.jquery.com/jquery-1.6.3.js",
+ "result": "[freelib]"
+ },
+ "921e7702ac9e4c4a4bca052b7bc83b0304440ee3": {
+ "filename": "http://code.jquery.com/jquery-1.6.4.js",
+ "result": "[freelib]"
+ },
+ "13184e03cd6a0fc0020cf5ad4eee3d8cb3fadac1": {
+ "filename": "http://code.jquery.com/jquery-1.7.min.js",
+ "result": "[freelib]"
+ },
+ "7f389928e5f9d3cb2ae273ae1a6913741d18f0a6": {
+ "filename": "http://code.jquery.com/jquery-1.7.js",
+ "result": "[freelib]"
+ },
+ "b47730ffaec4272a8a01756af2ef13ecea1c4e92": {
+ "filename": "http://code.jquery.com/jquery-1.7.1.js",
+ "result": "[freelib]"
+ },
+ "0b6da89c21e1dd2093fb26366dd90ffeea635c6a": {
+ "filename": "http://code.jquery.com/jquery-1.7.1.min.js",
+ "result": "[freelib]"
+ },
+ "7c64f79dbeeebaa7accd13bf68302c7adb195d7d": {
+ "filename": "http://code.jquery.com/jquery-1.7.2.min.js",
+ "result": "[freelib]"
+ },
+ "0d7896e2bb23f88e26e52b22a075350b354df447": {
+ "filename": "http://code.jquery.com/jquery-1.7.2.js",
+ "result": "[freelib]"
+ },
+ "0eaabd478dd9538ac53334276b8ff784180140a6": {
+ "filename": "http://code.jquery.com/jquery-1.8.0.js",
+ "result": "[freelib]"
+ },
+ "b567b6dd8cb0cb5c1183e55d2f2d1466f32edb39": {
+ "filename": "http://code.jquery.com/jquery-1.8.2.min.js",
+ "result": "[freelib]"
+ },
+ "229d5537173d1f006b744b014a28f64912988c61": {
+ "filename": "http://code.jquery.com/jquery-1.8.2.js",
+ "result": "[freelib]"
+ },
+ "8b6babff47b8a9793f37036fd1b1a3ad41d38423": {
+ "filename": "http://code.jquery.com/jquery-1.8.3.min.js",
+ "result": "[freelib]"
+ },
+ "49a6d1346f3d5a167331a8a5de4f34b5fcc1f6d0": {
+ "filename": "http://code.jquery.com/jquery-1.8.3.js",
+ "result": "[freelib]"
+ },
+ "002da8cbe90fcf32fbdebb72386125079e3805ee": {
+ "filename": "http://code.jquery.com/jquery-1.9.0.min.js",
+ "result": "[freelib]"
+ },
+ "bfc05b695dfa4f23e11d04b84993585da7a764bf": {
+ "filename": "http://code.jquery.com/jquery-1.9.0.js",
+ "result": "[freelib]"
+ },
+ "6c6f10e003ad0c7f462802c0e6422971577c3532": {
+ "filename": "http://code.jquery.com/jquery-1.8.1.min.js",
+ "result": "[freelib]"
+ },
+ "45efe8797f5a875878fec7fdaaa90d99532dbf16": {
+ "filename": "http://code.jquery.com/jquery-1.8.1.js",
+ "result": "[freelib]"
+ },
+ "ebc4e804054a68c177e9c67cc58e7960d3a8706f": {
+ "filename": "http://code.jquery.com/jquery-1.8.0.min.js",
+ "result": "[freelib]"
+ },
+ "ae49e56999d82802727455f0ba83b63acd90a22b": {
+ "filename": "http://code.jquery.com/jquery-1.9.1.min.js",
+ "result": "[freelib]"
+ },
+ "9257afd2d46c3a189ec0d40a45722701d47e9ca5": {
+ "filename": "http://code.jquery.com/jquery-1.9.1.js",
+ "result": "[freelib]"
+ },
+ "348ab13488f5ab45e048dfb39bb4bc8ed9d840c2": {
+ "filename": "http://code.jquery.com/jquery-1.10.0.js",
+ "result": "[freelib]"
+ },
+ "19715ffee604b54e95a0e9db76f6de2b5125c29e": {
+ "filename": "http://code.jquery.com/jquery-1.10.0.min.js",
+ "result": "[freelib]"
+ },
+ "b39b6f7d8c5f62a40960ded5c40cc288c10b438d": {
+ "filename": "http://code.jquery.com/jquery-1.10.1.js",
+ "result": "[freelib]"
+ },
+ "161b78ec52f28657a835e4a5423f03782fd35806": {
+ "filename": "http://code.jquery.com/jquery-1.10.1.min.js",
+ "result": "[freelib]"
+ },
+ "1d85f0f3464e5e49b0522744bf7314e176ac76d9": {
+ "filename": "http://code.jquery.com/jquery-1.10.2.js",
+ "result": "[freelib]"
+ },
+ "0511abe9863c2ea7084efa7e24d1d86c5b3974f1": {
+ "filename": "http://code.jquery.com/jquery-1.10.2.min.js",
+ "result": "[freelib]"
+ },
+ "6945741107601d402c70a13ce46eb72fd1168bc8": {
+ "filename": "http://code.jquery.com/jquery-1.11.0.js",
+ "result": "[freelib]"
+ },
+ "b66ed708717bf0b4a005a4d0113af8843ef3b8ff": {
+ "filename": "http://code.jquery.com/jquery-1.11.0.min.js",
+ "result": "[freelib]"
+ },
+ "73e5d044bd153dd912930e8be433059454ce19cd": {
+ "filename": "http://code.jquery.com/jquery-1.11.1.js",
+ "result": "[freelib]"
+ },
+ "d6c1f41972de07b09bfa63d2e50f9ab41ec372bd": {
+ "filename": "http://code.jquery.com/jquery-1.11.1.min.js",
+ "result": "[freelib]"
+ },
+ "0be05c714a7e6cf28fe692629ece5b3769901dca": {
+ "filename": "http://code.jquery.com/jquery-2.0.0.min.js",
+ "result": "[freelib]"
+ },
+ "79db35e3a94da9ce724c4d3c8ccc5d1864b23a95": {
+ "filename": "http://code.jquery.com/jquery-2.0.0.js",
+ "result": "[freelib]"
+ },
+ "d193cc22196566fce6b7a54d483f8ca55b38a2f5": {
+ "filename": "http://code.jquery.com/jquery-2.0.1.js",
+ "result": "[freelib]"
+ },
+ "2a35d61baf7dde4a800b08fd7b495a62a8a1e620": {
+ "filename": "http://code.jquery.com/jquery-2.0.1.min.js",
+ "result": "[freelib]"
+ },
+ "37fc3e651159cf6b9353a3f6f3bfe6e5e63e0092": {
+ "filename": "http://code.jquery.com/jquery-2.0.2.js",
+ "result": "[freelib]"
+ },
+ "1e0331b6dd11e6b511d2e3d75805f5ccdb3b83df": {
+ "filename": "http://code.jquery.com/jquery-2.0.2.min.js",
+ "result": "[freelib]"
+ },
+ "ad73590c92b4c3f08d02a0751ba4e4aef658daa0": {
+ "filename": "http://code.jquery.com/jquery-2.0.3.js",
+ "result": "[freelib]"
+ },
+ "fbf9c77d0c4e3c34a485980c1e5316b6212160c8": {
+ "filename": "http://code.jquery.com/jquery-2.0.3.min.js",
+ "result": "[freelib]"
+ },
+ "0fe3e567e0776226ee98326ba8cae7680683c112": {
+ "filename": "http://code.jquery.com/jquery-2.1.0.js",
+ "result": "[freelib]"
+ },
+ "98884258cbdb0d939fa2c5e74fc7ac9e56d8170f": {
+ "filename": "http://code.jquery.com/jquery-2.1.0.min.js",
+ "result": "[freelib]"
+ },
+ "8d55aabf2b76486cc311fdc553a3613cad46aa3f": {
+ "filename": "http://code.jquery.com/jquery-2.1.1.js",
+ "result": "[freelib]"
+ },
+ "afb90752e0a90c24b7f724faca86c5f3d15d1178": {
+ "filename": "http://code.jquery.com/jquery-2.1.1.min.js",
+ "result": "[freelib]"
+ },
+
+ "0b327b43256da9f57b78e3134aaecc2a4a5a3bad": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "01100f829bce3f074adcb6ae5309d9e769ef29fe": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "5f99079e4564f94a1d5e45d22d6dc18acbb148da": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "a2035b74876c5212cfe3e4e35dfd070e74e8c3fd": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "2a3fa481079f9e02043810cbeee6b5481abf51c0": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "0881516b541abe68d79724c08c1a665872f8f2c2": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "85b15aef55b1eede971c7febd0c00ba04dc16edf": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "d9b48fef067caa58d4e1dec54801c22fe0ea7449": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "990dbb08231ef9c9c59653051f5ac7c1e2185d46": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "2e140b943f459e383f569227b3e5569f0dbc6f34": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "53dd39212504739ac18790a4461b9a67c50f2728": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "5cd73db8238d48c08c88f12fe9e5b99b6fa644f7": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "0c3d725fac553c73368496769ff77c3045103704": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "e5de581f09ac990adae2b4aede35264f1dc5cd72": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "e1e87320b2d14e36a9bba1b637b5247645df7185": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "8b71e136c6275d0eeed2b55b9e718a54ce343015": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "c71ddb1b3843c24e909a31595b7e873d7e6da45d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "d5203dbbb97db1a68ca5a3adf265f17cdaea738d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "1b96be82b697e835b903c6c22799c8e4e55e285c": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "2804fac51308f459c3eb9c3d20e7ee009a8ba31c": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "5d61b19cbee2f8047f518a58ceff7fdaeeb24921": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "7f7859e006f0644a43a7294b50b39e7e9159b3a2": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "842cb8f83614f6de98f70fa7de2f866eecae7ab4": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "90fab357529f510e5134ad0dcdad3f654894d4fc": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "960e36796c42dadf66fafb63bba6087c7d6e1d85": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "1f102103bea71c5e173a916137c563dc62a97cdb": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "61c88c8898ae6bd653737a9dae52209a98998def": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "b87f7150da2b0811ed143443af4038e3e2d41eda": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "9927afbb31df93a76977a676a933b7e3696d61ba": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "7b6f5c747c19ad6fbe28957e4318559b45d89111": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "429282063ca7f3bae9797d70a6f09f2e3e05458a": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "e398b87b98ae72cbee9f7d3044189ea638f3f80c": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "e9b5baec45507c35477aac5d19afbca8cad92426": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "431b7ebb5e36d5af5e7890b782789ac983e28d00": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "680f1bd5b4021dbac8b82d68a818d3a94f097ffd": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "fc4c1a4691f3819ecd16eaefa68f96f764538f1e": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "1d97dd4111b504abc8f6dee45daf6f358aa40140": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "aff393e11d2122a6026df1e2f75d46de4ead89ff": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "d81b246f0f221f4d9a6eb74a8994c4041d2b7215": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.6.0/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "8e8b0dccbacc70dc6406023be9e35dfa4f3a944e": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "67070ff953d6b0f886083edba723f6d66fa6cbca": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "6952564ff6404bd93cb523f1634b451ac1cc8fec": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "b48e01c35c1e6ad622386b9a3161bd1bf02723c8": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "34d32c47711aa10bdeb196c55d489962296a64c4": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "33f5808531e82f2f6e8859da3a765c4d8a0073d2": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "973e1554af7d9240e059e38165f2e7b5fc7aa0a5": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "ae74362cdb2fadb2eee6c962f47f1e33af51c79d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "31d0cb90f7b82088df6c4e00b5765f9dccc48329": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.js",
+ "result": "[freelib]"
+ },
+ "a192b2ef3371febba192179ff86e3da3f633160d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "db895a7ed5c8b42e27de2b3ef3199d038a259fdb": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "06adc576409427237ce3c269bb9a568d3cd53c9b": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "8fdfbe7ccaf0bdcde4c0b34738c0cd73b4587a45": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "02d2e4a524b0da52c3cb236619ad065fec44d69a": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "42936431058c6c4663e64e2c07931b9159083c31": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "bbf7ce8f5ce8d8f9d207f8973328527ac0093b17": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "09fdd3d9aebc9086b27b45b3fb051ebded272b39": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "e002b335c75b5edefcd251962f61f53a2ab8e0f2": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "b5f2733aac4e257929a5f1ff93410ee0bda311b6": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "f978dcb9ea6ecfbc7f8a2f9948bacd679c0cd1b4": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "f78ae3cdaf4a6a21dfb2565491f5d295462d8be3": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "5ed6bdacae842fc530dbc83aabb9a466c7f2b5a1": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.6.0/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "fe810f47883364fbc4dc2c61e03a3aca0f74fed7": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "da851ac384c279992d1855d59257f8d98c603063": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+ "5b59bc1a7087c3a83abd5b9ff559a88428ceab0a": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.min.js",
+ "result": "[freelib]"
+ },
+
+ "0a2054143eddc76447bacf3da455ffc1c726e304": {
+ "filename": "http://yui.yahooapis.com/3.6.0/build/yui-base/yui-base.js",
+ "result": "[freelib]"
+ },
+ "5f47da5d3c8902e763ef6ae02e9307a63a95ae5a": {
+ "filename": "http://yui.yahooapis.com/2.6.0/build/yuiloader/yuiloader-min.js",
+ "result": "[freelib]"
+ },
+ "52ebc252c54e6cdaa9e349e1fea37a2950f6af96": {
+ "filename": "http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader-min.js",
+ "result": "[freelib]"
+ },
+ "e77f9c1022bb48425d63cbaf309d7718ff5d3fbd": {
+ "filename": "http://yui.yahooapis.com/2.8.0r4/build/yuiloader/yuiloader-min.js",
+ "result": "[freelib]"
+ },
+ "8f1cfeefecc782f53f411de1bf64c77b48b8ba56": {
+ "filename": "http://yui.yahooapis.com/2.8.1/build/yuiloader/yuiloader-min.js",
+ "result": "[freelib]"
+ },
+ "aa113da84ddbad46a8002ea22393a238eccf9ee4": {
+ "filename": "http://yui.yahooapis.com/2.9.0/build/yuiloader/yuiloader-min.js",
+ "result": "[freelib]"
+ },
+ "a4fadcd6f68d7823a9fd9d1f6089025041a3212a": {
+ "filename": "http://yui.yahooapis.com/2.8.2/build/yuiloader/yuiloader-min.js",
+ "result": "[freelib]"
+ },
+ "c398b7eab95bfe84816f60311eaf91194f3bfec8": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/aes.js",
+ "result": "[freelib]"
+ },
+ "a7eba31001379f751d1a54b988ccdb500d873ec1": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/enc-base64.js",
+ "result": "[freelib]"
+ },
+ "9bdf0dfad487422fd36693d4119b59175f0112ee": {
+ "filename": "http://yui.yahooapis.com/2.8.1/build/yuiloader/yuiloader.js",
+ "result": "[freelib]"
+ },
+ "d9f710afddaba467707c0d6e7b187a8beae1e1f2": {
+ "filename": "http://yui.yahooapis.com/2.8.2/build/yuiloader/yuiloader.js",
+ "result": "[freelib]"
+ },
+ "5f8d372d7b385588f61dd53c588608f47a3c3b60": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/enc-utf16.js",
+ "result": "[freelib]"
+ },
+ "4dc6c77a03258ee7fbe5e877a1ed97311bc45652": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js",
+ "result": "[freelib]"
+ },
+ "5847ed101f55d51c53538a7078971e7de8fb6762": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
+ "result": "[freelib]"
+ },
+ "fe91b37266d1cdb4b4f51297f69326e271704f35": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "493afa22594fdff6e6fc4f21f99c626533c35b06": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "9fa29ea8f3ec6714b3b6236eb2ce6e1ce905c560": {
+ "filename": "http://yui.yahooapis.com/2.6.0/build/yuiloader/yuiloader.js",
+ "result": "[freelib]"
+ },
+ "1523029ce227a35976407408c5d08039c8fe4f0e": {
+ "filename": "http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader.js",
+ "result": "[freelib]"
+ },
+ "9514b1927292acf4c670fae6492e9ce2e263472f": {
+ "filename": "http://yui.yahooapis.com/2.8.0r4/build/yuiloader/yuiloader.js",
+ "result": "[freelib]"
+ },
+ "6b911b0dc178423b946b0299851d9661004c21ef": {
+ "filename": "http://code.jquery.com/jquery-1.4.1.js",
+ "result": "[freelib]"
+ },
+ "65cbff4e9d95d47a6f31d96ab4ea361c1f538a7b": {
+ "filename": "http://code.jquery.com/jquery-1.4.2.min.js",
+ "result": "[freelib]"
+ },
+ "f02e1f7f1bb966d5fcf16b03daa79ee077a993f8": {
+ "filename": "http://code.jquery.com/jquery-1.4.js",
+ "result": "[freelib]"
+ },
+ "b9c72aa78de3c124248f30234c64bf6f3b1a7cb5": {
+ "filename": "http://code.jquery.com/jquery-1.1.3.pack.js",
+ "result": "[freelib]"
+ },
+ "bff995d3a845903f281b0b51fea421059459a808": {
+ "filename": "http://code.jquery.com/jquery-1.4.1.min.js",
+ "result": "[freelib]"
+ },
+ "b5efe44645f5358e3d785091af3440f80afa85e3": {
+ "filename": "http://code.jquery.com/jquery-1.4.min.js",
+ "result": "[freelib]"
+ },
+ "0e9545b59077541c44f521769243a8b717d83aae": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.5/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "e80905e4a45e31075b89189f5ba4913fc0451fdf": {
+ "filename": "http://yui.yahooapis.com/2.9.0/build/yuiloader/yuiloader.js",
+ "result": "[freelib]"
+ },
+ "80494ad8eb98e317ffec3671b00944cdc30cee02": {
+ "filename": "http://yui.yahooapis.com/3.4.0/build/yui-base/yui-base-min.js",
+ "result": "[freelib]"
+ },
+ "83d1b489e30275a03f568f7e3fa6537d695e0197": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.pack.js",
+ "result": "[freelib]"
+ },
+ "e956e4de8f223992e2d1362d78c5b5bb33e27497": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "3c737636f4789a45b73f5365cd4cfc8c0922f458": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/hmac.js",
+ "result": "[freelib]"
+ },
+ "42a8029d12e24767778fc1c6d978b4696b445524": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/mode-cfb.js",
+ "result": "[freelib]"
+ },
+ "14682f01c5c15f8656cb01425487ad675676df8e": {
+ "filename": "http://yui.yahooapis.com/3.5.1/build/yui-base/yui-base-min.js",
+ "result": "[freelib]"
+ },
+ "e1ae2c72f8c5e1b6c423c015349a476f8a908b22": {
+ "filename": "http://yui.yahooapis.com/3.4.1/build/yui-base/yui-base-min.js",
+ "result": "[freelib]"
+ },
+ "ca0aea084a63d0a56e1bbf17fde5061f631b391f": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.1.pack.js",
+ "result": "[freelib]"
+ },
+ "265a86a9d9df5dfdbad77e06c85605bec4beb32a": {
+ "filename": "http://code.jquery.com/jquery-1.4.2.js",
+ "result": "[freelib]"
+ },
+ "a2358d630d1a5dad24b679d52e9777b7349910b2": {
+ "filename": "http://yui.yahooapis.com/3.5.0/build/yui-base/yui-base-min.js",
+ "result": "[freelib]"
+ },
+ "65fe3b80fae349ecb3acd6541ef651d1ff4961f6": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "66851ab2133e27b97c4f3048416b947aa7ed82c5": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js",
+ "result": "[freelib]"
+ },
+ "08f37f8169e620c6ecd87635c18fc2b22e3e850e": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js",
+ "result": "[freelib]"
+ },
+ "28780fdb8fc54bf7d80b1f223abca4f77cd89e85": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject_src.js",
+ "result": "[freelib]"
+ },
+ "00a5e26ff9ed4b84fc93c764225684c33588a41e": {
+ "filename": "http://yui.yahooapis.com/3.6.0/build/yui-base/yui-base-min.js",
+ "result": "[freelib]"
+ },
+ "fe56013bb04c602e676feb34bb49add4da2e0225": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js",
+ "result": "[freelib]"
+ },
+ "6c445baf655cccb16ee2788714827ab186ed94bf": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js",
+ "result": "[freelib]"
+ },
+ "74974f9dc0810ea359367589cb273dd5174d80df": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/scriptaculous.js",
+ "result": "[freelib]"
+ },
+ "c7e9c7f2fb17e0d2ca2391e33007bf3547fec465": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js",
+ "result": "[freelib]"
+ },
+ "d97ecac3f1b3ccf1f0f68434e8406f87f5acc907": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.2.min.js",
+ "result": "[freelib]"
+ },
+ "97be02d1785b7bb4f41ae116a6a9bef74cb018d6": {
+ "filename": "http://code.jquery.com/jquery-1.4.3.min.js",
+ "result": "[freelib]"
+ },
+ "6a7a7d88fa4e7369003de24164f5961852731e0e": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/mode-ctr.js",
+ "result": "[freelib]"
+ },
+ "d65a39fc4b09df061a30172f080019ef9d800ca4": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/mode-ecb.js",
+ "result": "[freelib]"
+ },
+ "427300f82762288c5af967dbf642fbec58c201ea": {
+ "filename": "http://code.jquery.com/jquery-1.4.4.js",
+ "result": "[freelib]"
+ },
+ "94ec4a3bcd6b30353584026c0e109e79fb21b6ad": {
+ "filename": "http://code.jquery.com/jquery-1.5.min.js",
+ "result": "[freelib]"
+ },
+ "71adcc2cae87e412e521e4a7276efeaee2347927": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.2.js",
+ "result": "[freelib]"
+ },
+ "677c1ad6d84705c818d63a43298ee3a12959c1b3": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.3.pack.js",
+ "result": "[freelib]"
+ },
+ "3d542e33a9f3eb3cb45e06fe93d08dd4b7490496": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js",
+ "result": "[freelib]"
+ },
+ "e70997dd3dbadadebf375908515617059d0c597e": {
+ "filename": "http://yui.yahooapis.com/3.4.1/build/yui-base/yui-base.js",
+ "result": "[freelib]"
+ },
+ "b3db6906c1c0641b7a3098e547e0a8039accd80a": {
+ "filename": "http://yui.yahooapis.com/3.5.0/build/yui-base/yui-base.js",
+ "result": "[freelib]"
+ },
+ "cc66556593e147584f19b41b697405f828f7562e": {
+ "filename": "http://code.jquery.com/jquery-1.5.js",
+ "result": "[freelib]"
+ },
+ "c147a1a86a2c33e60f160b8861501f43f4638c8d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js",
+ "result": "[freelib]"
+ },
+ "d45787e64e233eb17f3f1492b12a682f294f866a": {
+ "filename": "http://code.jquery.com/jquery-1.5.1.min.js",
+ "result": "[freelib]"
+ },
+ "278d68b8e9edad4895836e272fbc8f78ec4f2f3e": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js",
+ "result": "[freelib]"
+ },
+ "b98bb654c88a9b7da659fe8dad95a5c7376bb166": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/md5.js",
+ "result": "[freelib]"
+ },
+ "6463e558dd79d51a2e8464806824c7bbc18c77fd": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js",
+ "result": "[freelib]"
+ },
+ "5cc87d3fcd5cb3c5913c08bad17ff80f4d0d7f46": {
+ "filename": "http://yui.yahooapis.com/3.4.0/build/yui-base/yui-base.js",
+ "result": "[freelib]"
+ },
+ "333b6d92a99eac873b1de2045c670fbdb61970ab": {
+ "filename": "http://yui.yahooapis.com/3.5.1/build/yui-base/yui-base.js",
+ "result": "[freelib]"
+ },
+ "522f0852b91775306ca47138c1d6ceeb87677880": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/mode-ofb.js",
+ "result": "[freelib]"
+ },
+ "4407f7b9602539e80f1569ae734696fd92deeff0": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-ansix923.js",
+ "result": "[freelib]"
+ },
+ "c82ea9768b18696832408b6cc729e2e121def691": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.3.js",
+ "result": "[freelib]"
+ },
+ "0d2bc9db63acd9cc238a4925e79f9a3079490970": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.4.min.js",
+ "result": "[freelib]"
+ },
+ "5900300a75ed7917eaa6f75077afe9ef49e66986": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js",
+ "result": "[freelib]"
+ },
+ "2cc787ebd4d29f2e24646f76f9c525336949783e": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools.js",
+ "result": "[freelib]"
+ },
+ "a965003ea3313be11a02743f4807411c9eb71f04": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-iso10126.js",
+ "result": "[freelib]"
+ },
+ "3bb92e84642c03cf0fe49174d0e1c420d46d2e18": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.4.js",
+ "result": "[freelib]"
+ },
+ "325edd57857f7a3160cfe2512dff5526d7e647db": {
+ "filename": "http://code.jquery.com/jquery-1.6.min.js",
+ "result": "[freelib]"
+ },
+ "034970f98cb529c779c8f961b2b7c09ecb499240": {
+ "filename": "http://code.jquery.com/jquery-1.6.js",
+ "result": "[freelib]"
+ },
+ "341a7a52109c3abfb23d5a5b4f363fd8d6a52f6c": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-iso97971.js",
+ "result": "[freelib]"
+ },
+ "c654cdaa3ca1184d9b18d0c31f8369a04c63f7f5": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-nopadding.js",
+ "result": "[freelib]"
+ },
+ "20860bad9c83c3890be57052f009b9d97848c9ec": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.5.min.js",
+ "result": "[freelib]"
+ },
+ "6111fcf6c2277eba8821ca365dbbea472a3206e7": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.4/mootools.js",
+ "result": "[freelib]"
+ },
+ "9025fe9334566eb919ddca85a8f949b01c7d837d": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.5.pack.js",
+ "result": "[freelib]"
+ },
+ "0e9a07ee104153a459cdbcb9fa28293b4bbb429f": {
+ "filename": "http://code.jquery.com/jquery-1.6.1.min.js",
+ "result": "[freelib]"
+ },
+ "e55462193a857ffe36e42bfcbecfebf1ca33d0b8": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools.js",
+ "result": "[freelib]"
+ },
+ "7df0e9aae795337db012b3efd0b9ee9cc7719b56": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools.js",
+ "result": "[freelib]"
+ },
+ "8963108fa84c2033a1052d47079d7f75a7e5b60e": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.5.js",
+ "result": "[freelib]"
+ },
+ "aa7020d6c8d5475ae588640954caa9e4cdd7eca0": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-zeropadding.js",
+ "result": "[freelib]"
+ },
+ "1be9c3684054001f53fa7ff6d85ec3cb573a9cd2": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js",
+ "result": "[freelib]"
+ },
+ "e0f3225498158bc63af7bfba636b091ea4ee5fcd": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pbkdf2.js",
+ "result": "[freelib]"
+ },
+ "c415b533f7edda8b9de417cc0517904f86e9fe1f": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/rabbit.js",
+ "result": "[freelib]"
+ },
+ "c10dbe0c2b23444d0794f3376398702d84f41583": {
+ "filename": "http://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js",
+ "result": "[freelib]"
+ },
+ "f4d4125bcd5151aad69dd849a11fc1ca589cc64b": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools.js",
+ "result": "[freelib]"
+ },
+ "4ee6675ca57dda3255aa669d8ec4d35760eb47c3": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.0/mootools.js",
+ "result": "[freelib]"
+ },
+ "0c89448016629bb2ea758f4e98529c2e166a122d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools.js",
+ "result": "[freelib]"
+ },
+ "b4096385cad3144e81c255aa6e4b7dabb30bc19f": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/rc4.js",
+ "result": "[freelib]"
+ },
+ "037f4fadbc2020ccb4935384b8ae5af62bdd0145": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha1.js",
+ "result": "[freelib]"
+ },
+ "bc018ec49a5c7757577bb63e5d5f8a99be0e3954": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.2/mootools.js",
+ "result": "[freelib]"
+ },
+ "aa5c283b9e094eeacdd080b44951406abbc9e58c": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha224.js",
+ "result": "[freelib]"
+ },
+ "6dc7644a54d5cc254a1f6d7cb7154128b2b6570a": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.3/mootools.js",
+ "result": "[freelib]"
+ },
+ "c0c37b7d3119f29d3759fdaf7eb8bc4670ea9e7f": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.1.1/mootools.js",
+ "result": "[freelib]"
+ },
+ "b38f741b43f6ddcce3f1b47274d1683cca9f07a8": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha256.js",
+ "result": "[freelib]"
+ },
+ "e29701dd85d792bddbf52d1e1fc3d1ada41b6192": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha384.js",
+ "result": "[freelib]"
+ },
+ "cc019ac09f68258ee3442fe7cc440adf78a3cef2": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "e88bb2c302b41a4cc5b97604354a48d068e3e1eb": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha512.js",
+ "result": "[freelib]"
+ },
+ "fc39ed8ca4a58668124471e509506443de4467f2": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.4/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "b1a271458ae47d0b47c9e0996956091a93dec16f": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "86f0df8662b511142dfc4e0ce9c81d805c8d7a7e": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.0/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "e0bfed3ffc741a9f4e59e6004a1dec9c71241a59": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/x64-core.js",
+ "result": "[freelib]"
+ },
+ "fc21f8084ad4040ddbf620ba79acd3998fb3dc7b": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "1e8f9e1614db771782bc9e871fb712b06610b9f4": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.2/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "c7e2076a3af9997731499bc1f7dc3941b522c1eb": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.4.3/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "dd7783b4c8d4ecaad4091d1d32df2f97d7b10ddc": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.1.2/mootools.js",
+ "result": "[freelib]"
+ },
+ "55bba460dcbb70562536ddd5c8734b311f38c42d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools.js",
+ "result": "[freelib]"
+ },
+ "3c1ddf62af20a1f5c5de7a3af180b32528dc47db": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools.js",
+ "result": "[freelib]"
+ },
+ "c43a38fce1aa745d59b1a6f7ab7def81f28701a4": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools.js",
+ "result": "[freelib]"
+ },
+ "e5335c2a82f26e49b1324edc21e452de040d5cdc": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js",
+ "result": "[freelib]"
+ },
+ "ccf015fcd45618c6b116977c96539d93ee10b542": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/tripledes.js",
+ "result": "[freelib]"
+ },
+ "3d9fc65389ce7de16f87909039aa2e728c693b3d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.5/mootools.js",
+ "result": "[freelib]"
+ },
+ "5f970c3c8ca26a94c14a1ae1e7321621cf4eae0c": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.1.2/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "03a65e56fc95caea1b85a591c984e9b6c080726d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.1.1/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "669d164e3bff6156b21084cf035979d62433df75": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "f3e20ad41082a93dbd09202590717da71aebd316": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools-yui-compressed.js",
+ "result": "[freelib]"
+ },
+ "8dda5f159c9bedee9f4a6b7a7a6028a554977994": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.4.3/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "15c3f73c75bb3ab87040fe55240f9dd5ea69b6bf": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core-debug.js",
+ "result": "[freelib]"
+ },
+ "5c83aac1a3409dc1ec3a228e4c765292eb4434d4": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/ext-core/3.0.0/ext-core-debug.js",
+ "result": "[freelib]"
+ },
+ "7dc1b4f3e358c58030c4676c990eff60a0fc838f": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js",
+ "result": "[freelib]"
+ },
+ "d19d40a20252730e9fd9af1c7867c0f5417ebe32": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/ext-core/3.0.0/ext-core.js",
+ "result": "[freelib]"
+ },
+ "e1db767afb82018ab6a695fe52334f2f5d81a0e3": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "a90b5f6afb6c78b30c3539392d49e45fd9dfe3d9": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.5.1/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "0a0a820f2bc4f2dac8dcfde2282411275e2dc697": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "b6d2c0b655b327407966b52303449dedce084ded": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.4.3/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "4cc838a3be933fda21bbbfc8f52b01e14a1e70a5": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "2ef4341a4ca0b9a0fc1aea422d85b5d9771fde87": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "df435b881e8364ddfbd44d5f786b10c75f964175": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "19214655c4152b79f204e222a481d1e18da84972": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.3.1/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "f444ee6b041735ee6109dd2fe3c3a7755fa949f7": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.3.0/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "c7f5b42b2306a79f67988ee073ac98c2a1d5782f": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "d8afec39893c1a99139212feb40888847f8a5253": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "a6edefef305d9164212fa140426629c7d8a58c93": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.1.1/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "a3e5c42f93722ad28cda811f8635bddf213819ed": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "741b8eeb65774256a8a76ea1af91f976357fcd81": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.5.1/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "911a35988b8540414cfbc990fbc112eb124fd968": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "c753cf372377ef0b5a18204cd86df8d4792fa8f5": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "8b95d59f6b28b072ceb4228a6db107b934500a02": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "8c135fc57355fe5d5a18f3dbe5736bc772bb20a7": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "70b1fe9dd4ebec0b5d417647e549bca8f9200020": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.3.1/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "8980e43d4750c63eb57cfff5f0723f118d243c67": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.3.0/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "d2fc56e1b9f2014fb7710d186a355a57e3acd283": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "2bab42610adee25cdc0d3a4ba96b94f1e9ccd115": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "6bb906d86dd239add79d0779a9fcdf9740aa7e3b": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.1.1/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "3d96f61e48510cbe595081ef8b2d5c8479f95d3e": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "1e4cb0dcb97df9a15433477f9f8a666914eedc3c": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "47732fb5e03d251aff1a7c0b550a3af74c7ceea5": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "85399dd9527026afc66a6fb43ad5c0d4ea97f83e": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "147eab514dfe1d88506a5e158b782cb5c504c056": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.xd.js.uncompressed.js",
+ "result": "[freelib]"
+ },
+ "229e4025f71b0b94d98505f56c5cfd7cd41d06aa": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "135ade1e60da3e3b79fd73c3a6a005a250e2a7f7": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "135188b624daae8f4b015b0b8b75875a6132aa3d": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "fac80a6188865418344d4b6c5d4955ee7e7362c2": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "311d8f38b12a09f16f5a19e1dfb6575b5ce0f83c": {
+ "filename": "https://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.xd.js",
+ "result": "[freelib]"
+ },
+ "ca2868985811d45cfbad118a297869707572e0bb": {
+ "filename": "https://raw.github.com/voldsoftware/toolbarbutton-jplib/stable/lib/toolbarbutton.js",
+ "result": "[freelib]"
+ },
+ "32d542564913a016f1cea340ba8ac164c160004d": {
+ "filename": "http://yui.yahooapis.com/3.3.0/build/yui-base/yui-base.js",
+ "result": "[freelib]"
+ },
+ "012cc186912c473552a341b2eaffb71240688ccd": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/cipher-core.js",
+ "result": "[freelib]"
+ },
+ "d1c9d4d91c1c3c76f601778cb5e0489e0f80a10d": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/evpkdf.js",
+ "result": "[freelib]"
+ },
+ "794503310ed31a11f233e1acdddc10f2ce91748e": {
+ "filename": "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/core.js",
+ "result": "[freelib]"
+ },
+ "5717e22c3b2c7caf870fc0772a64344962b59ee6": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.6/underscore.js",
+ "result": "[freelib]"
+ },
+ "7e0294019938a772f4ddd7799501496074e0f0fb": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.7/underscore.js",
+ "result": "[freelib]"
+ },
+ "28e41c3ce9232633468013342c49fd62a4f5f6bd": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.2/underscore.js",
+ "result": "[freelib]"
+ },
+ "8d84b347dfe4f5b75f7b5f670326ca5c8041b7a9": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.3/underscore.js",
+ "result": "[freelib]"
+ },
+ "9564fa7a6a001e4e56b0244ccda03eef3940813e": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.3/underscore.js",
+ "result": "[freelib]"
+ },
+ "058cbd179f032f667823545519aa2d10b0b69508": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.2/underscore.js",
+ "result": "[freelib]"
+ },
+ "868141351efa758d031779c776e608e3a049d823": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.4/underscore.js",
+ "result": "[freelib]"
+ },
+ "2fee700150a7de876acc21403f77e57dae2f5618": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.5/underscore.js",
+ "result": "[freelib]"
+ },
+ "40946800c5c8bee189ca3e7f8017661f9456e490": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.0/underscore.js",
+ "result": "[freelib]"
+ },
+ "b842a8ca5e996e001e648fc8c73316cd55e496ed": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.4/underscore.js",
+ "result": "[freelib]"
+ },
+ "f2fa9179d764f6a688dc0c99b1b5283f1b680249": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.1/underscore.js",
+ "result": "[freelib]"
+ },
+ "c1dff1c5dbb68af6e22bd401afd28aab970a8aff": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.3/underscore.js",
+ "result": "[freelib]"
+ },
+ "5846c870e0f1daca152db22277915adb6520ffa3": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.0/underscore.js",
+ "result": "[freelib]"
+ },
+ "cdacc2b0045fa1b920b64664b88b155d0c0df169": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.2/underscore.js",
+ "result": "[freelib]"
+ },
+ "baa693e82387a328abccf9694c6d2db571ac8aca": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.3.3/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "e67cf6a985999c7ef5595772e4ffefeacd0c6ac3": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.1/underscore.js",
+ "result": "[freelib]"
+ },
+ "0a15952061f6fb7a5493281f6ff8eb916a417e2f": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.3.1/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "bd9624f882f7d3d29292ddc7f484987b3e991cb5": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.3.0/underscore.js",
+ "result": "[freelib]"
+ },
+ "ede1d022640f26eaa6109da9e924670f6ed14cce": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.3.2/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "63f6a94752e5fde78627529763e67ecd4ef78f12": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.4/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "1185da1043863517c6aa0a4e0a3bc433dfb98313": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.2/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "86752ba2e4f3855a8a5e45d5f07567ea70a9cc98": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.3.0/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "cfbc3fa20d685d100308e123c3310dc9600ef0fd": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.3/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "083bbcd739b7b1336f13c72603e1704b164c02bd": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.1/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "f665459959c5167c0905974a62ffe923f2c19813": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.5/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "2de2ecea5ba12e7235ffb44d6892cc77fe6f4abe": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.4/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "81afb4cd3755671fea5e74d7118d7d460c475308": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.7/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "9e389ede8ed7f782c5ecf2f87c3afa3b1e309bff": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.3/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "703d6a61f31ddb45252c55813556a92e8cc2ee22": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.6/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "7d6e352b0d26655ba851863561b5d912cc24caa7": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.0/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "5de53da57fc8b7ab6c77d597c22875d747352fef": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.1/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "bcdd63e18a8a7cf728253f738556ad3b88d74649": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.2/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "ee68308411c690cd51cc8a43fe6ae60d3d1678af": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.4/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "49a747d3284b1d04f3eb823a4188f7725004f823": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.1.0/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "97f93241957893ebd7febc5b5bac9a7bd1d94a0f": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.3/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "710c3a99f0bd456c2fd6dcbcbd1e500e0646ec19": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.1/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "7361e8afa72bd0098e2520584786474c9c4a5064": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.2/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "ad0775c89a87111019840dc7bbf902d832e4ccdf": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.0.0/underscore-min.js",
+ "result": "[freelib]"
+ },
+ "34454bfed864addf8ec4aacdd9adf872f8360ed3": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.3.1/underscore.js",
+ "result": "[freelib]"
+ },
+ "07916c0b7274275f916fe288d01b254545b17d9a": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.4/underscore.js",
+ "result": "[freelib]"
+ },
+ "133de2283d03193cb06f62f92c494afe098460a5": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.0/underscore.js",
+ "result": "[freelib]"
+ },
+ "4c977634c87efbd2b7113993d36dad603b8dcf2f": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.2.1/underscore.js",
+ "result": "[freelib]"
+ },
+ "3fa74bb289537fcdee796b26968e47d53d38f903": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.3.2/underscore.js",
+ "result": "[freelib]"
+ },
+ "772b2587aa2fa345fb760eff9ebe5acd97937243": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.3.3/underscore.js",
+ "result": "[freelib]"
+ },
+ "562c6c44b39809ec07c047f4ed6c591f3ae7c034": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.4.0/underscore.js",
+ "result": "[freelib]"
+ },
+ "063a7d75792dff2b46eee81cc12de63def672911": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.4.1/underscore.js",
+ "result": "[freelib]"
+ },
+ "47479149fe12fc56685a9de90c5a9903390cb451": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.4.2/underscore.js",
+ "result": "[freelib]"
+ },
+ "d53fbd7308ae3d7eeb4a536c2cbfe739648850b4": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.4.3/underscore.js",
+ "result": "[freelib]"
+ },
+ "6d9ee62759cb911ec03b21078c9f92f0f2afa25c": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.4.4/underscore.js",
+ "result": "[freelib]"
+ },
+ "5d42ed92480d3a88efa270449f38c6d88d653af5": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.5.0/underscore.js",
+ "result": "[freelib]"
+ },
+ "9ee15c1f1a84a258ba5f48de72da3538c8b7c375": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.5.1/underscore.js",
+ "result": "[freelib]"
+ },
+ "c9ae7b502c521d2f53b9065ef4fc7d7cc97dce4c": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.5.2/underscore.js",
+ "result": "[freelib]"
+ },
+ "fe1b87838b7328273812380d26837f58348103b0": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.6.0/underscore.js",
+ "result": "[freelib]"
+ },
+ "92d29762b3d85d123d593f14b113d4fb6385598f": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.7.0/underscore.js",
+ "result": "[freelib]"
+ },
+ "fb26909af4ad2a6c240b9aa4b35bb983cf4b20e4": {
+ "filename": "https://raw.github.com/documentcloud/underscore/1.7.0/underscore-min.js",
+ "result": "[freelib]"
+ },
+
+ "63a001665725b35d2bc4a6212385a746584c1a3b": {
+ "filename": "http://cdn.jsdelivr.net/jquery.fancytree/2.6.0/jquery.fancytree-all.min.js",
+ "result": "[freelib]"
+ },
+ "d6469e3aa15a6107ad5783a96e3c8fa3f5ce21ca": {
+ "filename": "http://cdn.jsdelivr.net/jquery.fancytree/2.5.0/jquery.fancytree-all.min.js",
+ "result": "[freelib]"
+ },
+ "2de56a2ec01b0aa170754bd6ed7485576f16f165": {
+ "filename": "http://cdn.jsdelivr.net/jquery.fancytree/2.4.1/jquery.fancytree-all.min.js",
+ "result": "[freelib]"
+ },
+
+ "5ada7c103fc1deabc925cc1fdbbb6e451c21fc70": {
+ "filename": "http://netdna.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js",
+ "result": "[freelib]"
+ },
+ "afa7af2bc7cbe37eeccb9b65577744c08219c5a9": {
+ "filename": "http://netdna.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.js",
+ "result": "[freelib]"
+ },
+ "5814e91bb6276f4de8b7951c965f2f190a03978d": {
+ "filename": "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js",
+ "result": "[freelib]"
+ },
+ "fd607f85d598503b24d7799722db29fec4de1ef6": {
+ "filename": "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.js",
+ "result": "[freelib]"
+ },
+ "c6a8a0f02ee0ecd975226ae4b38e9660750d1f93": {
+ "filename": "http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js",
+ "result": "[freelib]"
+ },
+ "539e456bb40d9e98244060186f5f131b1a7f4b33": {
+ "filename": "http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.js",
+ "result": "[freelib]"
+ },
+
+ "128273a9c66a32d7d59a6f290deb6cc4a2b2ee5a": {
+ "filename": "http://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.7.1/js/lightbox.min.js",
+ "result": "[freelib]"
+ },
+ "250d7c160f17c13e89cee0e1dcd1debb2e940ed2": {
+ "filename": "http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js",
+ "result": "[freelib]"
+ }
+}
diff --git a/data/settings/images/button-download.png b/data/settings/images/button-download.png
new file mode 100644
index 0000000..5ca5430
--- /dev/null
+++ b/data/settings/images/button-download.png
Binary files differ
diff --git a/data/settings/images/libre.png b/data/settings/images/libre.png
new file mode 100644
index 0000000..8042caa
--- /dev/null
+++ b/data/settings/images/libre.png
Binary files differ
diff --git a/data/settings/images/logo-medium.png b/data/settings/images/logo-medium.png
new file mode 100644
index 0000000..0bb6eb2
--- /dev/null
+++ b/data/settings/images/logo-medium.png
Binary files differ
diff --git a/data/settings/index.html b/data/settings/index.html
new file mode 100644
index 0000000..c6ab163
--- /dev/null
+++ b/data/settings/index.html
@@ -0,0 +1,113 @@
+<!doctype html>
+<html lang="en">
+
+ <head>
+ <meta charset="utf-8" />
+ <title>LibreJS | Whitelist </title>
+
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+
+
+ <!-- Your styles -->
+ <link rel="stylesheet" href="styles/styles.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ /**
+ *
+ * @licstart The following is the entire license notice for the
+ * JavaScript code in this page.
+ *
+ *
+ * Copyright (C) 2011, 2014 Loic J. Duros
+ *
+ * The JavaScript code in this page is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GNU GPL) as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option)
+ * any later version. The code is distributed WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+ *
+ * As additional permission under GNU GPL version 3 section 7, you
+ * may distribute non-source (e.g., minimized or compacted) forms of
+ * that code without the copy of the GNU GPL normally required by
+ * section 4, provided you include this license notice and a URL
+ * through which recipients can access the Corresponding Source.
+ *
+ *
+ *
+ * @licend The above is the entire license notice
+ * for the JavaScript code in this page.
+ *
+ *
+ *
+ */
+ </script>
+ <link href="third-party/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+ <link media="screen" rel="stylesheet" href="styles/form.css">
+
+ <script src="third-party/jquery/jquery.min.js"></script>
+ <!--<script src="js/form-types.js"></script>-->
+ <script src="js/form-row.js"></script>
+ </head>
+
+ <body>
+ <header id="site-header">
+ <div class="container">
+ <hgroup class="row">
+ <div>
+ <a id="logo" target="_blank"
+ href="https://www.gnu.org/s/librejs/"
+ title="LibreJS - Free JavaScript in your browser"
+ >LibreJS - Free JavaScript in your browser</a>
+ </div>
+ </hgroup>
+ </div>
+ </header>
+
+ <div id="main">
+ <div id="promotional">
+ <div class="container">
+ <div class="row">
+ <div class="span12">
+ <div class="page-header">
+ <h1>LibreJS | Whitelist</h1>
+ </div>
+ <div>
+ <div class="btn-group librejs-controls">
+ <button class="librejs-whitelist-reset btn btn-default">
+ Reset whitelist to default
+ </button>
+ </div>
+ <table id="whitelist"
+ class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th class="info rule-type">Hash</th>
+ <th class="info url">URL</th>
+ <th class="info">Info</th>
+ <th class="info delete-rule">Actions</th>
+ </tr>
+ </thead>
+ <tbody></tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ <div id="loadingBox"><img src="images/ajax-loader.gif"/></div>
+ </div>
+ <div class="librejs-banners">
+ <a href="http://www.gnu.org/philosophy/free-sw.html"
+ ><img src="images/libre.png"></a>
+ </div>
+ </div>
+ <footer>
+ <p class="copyrights">
+ Copyright &copy; 2011, 2012, 2013, 2014 Loic J. Duros<br/>
+ </p>
+ </footer>
+
+ </body>
+
+</html>
diff --git a/data/settings/js/form-row.js b/data/settings/js/form-row.js
new file mode 100644
index 0000000..35ac85e
--- /dev/null
+++ b/data/settings/js/form-row.js
@@ -0,0 +1,118 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var GenerateForm = {
+ $trContainer: null, // will jQuery element for rules table tboby
+ le: 0,
+ init: function () {
+ var that = this;
+ $(document).ready(function (e) {
+ that.$trContainer = $("#whitelist").children('tbody');
+
+ // listen for when data is ready to populate form.
+ document.documentElement.addEventListener(
+ "populate-form",
+ function (event) {
+ that.populateForm(event.detail.data);
+ }, false);
+ that.$trContainer.on("click", ".delete", function (event) {
+ that.deleteRow($(this));
+ });
+ $('.librejs-whitelist-reset').click(function (e) {
+ that.deleteAll();
+ });
+ });
+ },
+
+ deleteAll: function () {
+ var event = document.createEvent("CustomEvent");
+ event.initCustomEvent(
+ "librejs-settings-change", true, true, {
+ event: 'rules-form-delete-all'
+ });
+ document.documentElement.dispatchEvent(event);
+ location.reload();
+ },
+
+ deleteRow: function ($button) {
+ var hash = $button.parents('tr').children('.hash').text();
+ this.le--;
+ this.changeTitle();
+ $button.parents('tr').remove();
+ var event = document.createEvent("CustomEvent");
+ event.initCustomEvent(
+ "librejs-settings-change", true, true, {
+ event: 'rules-form-delete', value: hash
+ });
+ document.documentElement.dispatchEvent(event);
+ },
+
+ createRow: function (key, url, reason) {
+
+ var $tr = $("<tr/>");
+ var $td = $('<td/>').addClass('hash').text(key);
+ var $delete, $button;
+ $tr.append($td);
+ $td = $('<td/>').append($('<a/>').attr({
+ "href": url,
+ "target": "_blank"
+ }).text(url));
+ $tr.append($td);
+ $td = $('<td/>').text(reason);
+ $tr.append($td);
+
+ $delete = $("<td/>");
+ $button = $('<button/>');
+ $button.addClass("delete btn btn-danger")
+ .attr({'value': 'delete'}).text("Delete");
+ $delete.append($button);
+ $tr.append($delete);
+ return $tr;
+ },
+
+ appendNewRow: function (key, rowData) {
+ if (key && rowData !== undefined) {
+ this.$trContainer.append(
+ this.createRow(
+ key,
+ (rowData.filename || rowData.url),
+ (rowData.result.reason || "no reason recorded")));
+ }
+ },
+ clearForm: function () {
+ $('#whitelist').children('tbody').empty();
+ },
+ changeTitle: function () {
+ var tt = this.le + " scripts whitelisted";
+ $('div.page-header h1').text(tt);
+ $('title').text(tt + ' | LibreJS');
+ },
+ populateForm: function (data) {
+ var key;
+ this.le = Object.keys(data).length;
+ this.changeTitle();
+ this.clearForm();
+ for (key in data) {
+ this.appendNewRow(key, data[key]);
+ }
+ }
+};
+
+GenerateForm.init();
diff --git a/data/settings/js/form-types.js b/data/settings/js/form-types.js
new file mode 100644
index 0000000..588cec0
--- /dev/null
+++ b/data/settings/js/form-types.js
@@ -0,0 +1,145 @@
+/**
+ * Permafrost - Protect your privacy!
+ * *
+ * Copyright (C) 2012 2013 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var FORM_TYPES;
+
+/* constructor for form types options */
+function FormType(options) {
+ "use strict";
+ var item;
+ for (item in options) {
+ this[item] = options[item];
+ }
+}
+
+FormType.prototype = {
+ onblur: 'submit',
+ showbuttons: true,
+ pk: null,
+ name: null,
+ value: null,
+ url: function (params) {
+ "use strict";
+ // see https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/guides/content-scripts/communicating-with-other-scripts.html#Using%20Custom%20DOM%20Events for information on this.
+ FORM_TYPES.triggerEvent({'event': 'rules-form-update', 'value': params});
+
+ }
+};
+
+
+FORM_TYPES = {
+
+ patternPlaceholder: 'Enter wildcard patterns or regular expression ' +
+ 'patterns, one per line',
+
+ ruleType: null,
+
+ requestOrigin: null,
+
+ visitingSite: null,
+
+ contentType: null,
+
+ blockUI: function () {
+ "use strict";
+ $.blockUI({
+ message: null,
+ overlayCSS: { backgroundColor: 'none' }});
+ },
+
+ unblockUI: function () {
+ "use strict";
+ window.setTimeout($.unblockUI, 500);
+ },
+
+ triggerEvent: function (msg) {
+ "use strict";
+ var event = document.createEvent("CustomEvent");
+ var that = this;
+ event.initCustomEvent("permafrost-settings-change", true, true, msg);
+ document.documentElement.dispatchEvent(event);
+ this.blockUI();
+
+ var success = function (event) {
+ that.unblockUI();
+ document.documentElement.removeListener("rules-form-data-written", success, false);
+ };
+
+ document.documentElement.addEventListener("rules-form-data-written", success, false);
+
+ },
+
+ init: function () {
+ "use strict";
+
+ var formTypesHelper = this;
+
+ // these four objects will be used to represent all the
+ // form items in the table, and will hold different values
+ // depending on the last active html form object.
+
+ this.ruleType = new FormType({
+ type: 'select',
+ name: 'rule',
+ source: [
+ {value: 'block', text: 'Block'},
+ {value: 'allow', text: 'Allow'}
+ ]
+ });
+
+ this.requestOrigin = new FormType({
+ type: 'textarea',
+ name: 'content-location',
+ title: 'Requests originating from',
+ placeholder: formTypesHelper.patternPlaceholder
+ });
+
+ this.visitingSite = new FormType({
+ type: 'textarea',
+ name: 'request-origin',
+ title: 'when visiting (referrer)',
+ placeholder: formTypesHelper.patternPlaceholder
+ });
+
+ this.contentType = new FormType({
+ type: 'checklist',
+ name: 'content-type',
+ title: 'and are of type',
+ separator: ',',
+ source: [
+ { value: 'script', text: 'scripts' },
+ { value: 'image', text: 'images' },
+ { value: 'stylesheet', text: 'stylesheets' },
+ { value: 'object', text: 'objects and plugin contents' },
+ { value: 'object-request', text: 'requests made by plugins' },
+ { value: 'subdocument', text: 'subdocuments (iframes, frames, and objects)' },
+ { value: 'font', text: 'web font (@font-face)' },
+ { value: 'media', text: 'video or audio content' },
+ { value: 'xbl', text: 'XBL binding request' },
+ { value: 'dtd', text: 'DTD loaded by an XML document' },
+ { value: 'xrh', text: 'Ajax requests (XMLHttpRequests)' },
+ { value: 'others', text: 'miscellaneous content' }
+ ]
+ });
+
+
+ }
+
+};
diff --git a/data/settings/js/pagescript-emitter.js b/data/settings/js/pagescript-emitter.js
new file mode 100644
index 0000000..105c1ab
--- /dev/null
+++ b/data/settings/js/pagescript-emitter.js
@@ -0,0 +1,14 @@
+// listen for addon script emit and pass on the object to the page script.
+self.port.on("populate-form", function (data) {
+ // custom DOM event
+ var event = document.createEvent('CustomEvent');
+ event.initCustomEvent("populate-form", true, true, { data: data });
+ document.documentElement.dispatchEvent(event);
+});
+
+/*self.port.on("rules-form-data-written", function (data) {
+ // custom DOM event
+ var event = document.createEvent('CustomEvent');
+ event.initCustomEvent("rules-form-data-written", true, true, {});
+ document.documentElement.dispatchEvent(event);
+});*/
diff --git a/data/settings/js/pagescript-listener.js b/data/settings/js/pagescript-listener.js
new file mode 100644
index 0000000..48cd629
--- /dev/null
+++ b/data/settings/js/pagescript-listener.js
@@ -0,0 +1,51 @@
+/**
+ * Permafrost - Protect your privacy!
+ * *
+ * Copyright (C) 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// listen for a message from the pagescript
+document.documentElement.addEventListener("librejs-settings-change", function (event) {
+ "use strict";
+
+ switch (event.detail.event) {
+
+ case 'rules-form-update':
+ self.port.emit('rules-form-update', event.detail.value);
+ break;
+
+ case 'rules-form-delete':
+ self.port.emit('rules-form-delete', event.detail.value);
+ break;
+
+ case 'rules-form-delete-all':
+ self.port.emit('rules-form-delete-all');
+ break;
+
+ case 'rules-form-reorder':
+ self.port.emit('rules-form-reorder', event.detail.value);
+ break;
+
+ case 'rules-form-add-empty-row':
+ self.port.emit('rules-form-add-empty-row', event.detail.value);
+ break;
+
+ }
+
+}, false);
+
+
diff --git a/data/settings/js/permafrost-info-box.js b/data/settings/js/permafrost-info-box.js
new file mode 100644
index 0000000..51c33cb
--- /dev/null
+++ b/data/settings/js/permafrost-info-box.js
@@ -0,0 +1,21 @@
+/**
+ * Permafrost - Protect your privacy!
+ * *
+ * Copyright (C) 2012 2013 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var box = '<div id="permafrost-info-panel" style="width: 250px; height: auto; padding: 20px; background-color: rgba(255, 255, 255, 0.9); box-shadow: 0px 0px 50px rgb(255, 255, 255); margin: 2%; border-radius: 15px 15px 0 0; font-family: Droid Sans,Helvetica,Arial,Sans; font-size: 12px; z-index: 20000; position: fixed; right: 3%; bottom: -10px; margin-bottom:0;;"> <ul> <li>test 1</li> <li>test 2</li> <li>test 3</li> <li>test 4</li><li>blah</li><li>blobl</li> </ul></div>';
diff --git a/data/settings/styles/form.css b/data/settings/styles/form.css
new file mode 100644
index 0000000..7f077d3
--- /dev/null
+++ b/data/settings/styles/form.css
@@ -0,0 +1,33 @@
+tr.ui-sortable-helper > td {
+ background: #229ac1 !important;
+}
+
+#whitelist td {
+ max-width: 800px;
+ max-width:350px;
+ word-wrap: break-word;
+}
+
+table#whitelist th {
+ vertical-align: middle;
+}
+
+#rules button {
+ margin-top:0 !important;
+}
+
+.drag-handle {
+ cursor:pointer;
+}
+
+#loadingBox {
+ display:none;
+}
+
+.librejs-banners {
+ text-align: center;
+}
+
+.librejs-controls {
+ margin-bottom: 8px;
+} \ No newline at end of file
diff --git a/data/settings/styles/styles.css b/data/settings/styles/styles.css
new file mode 100644
index 0000000..abf6977
--- /dev/null
+++ b/data/settings/styles/styles.css
@@ -0,0 +1,130 @@
+body {
+ font-size:67.5%;
+ background:#CCC;
+}
+
+#site-header {
+ min-height:130px;
+ position:relative;
+ overflow:hidden;
+}
+
+#logo {
+ background:url('../images/logo-medium.png') top left no-repeat;
+ width:269px;
+ height:119px;
+ display:block;
+ text-indent:-1000em;
+ overflow:hidden;
+ margin:10px 0;
+}
+
+#ribbon {
+ position:absolute;
+ right:-50px;
+ top:-15px;
+ z-index:2;
+}
+
+header nav {
+ position:absolute;
+ bottom:0;
+ right:3em;
+ z-index:3;
+}
+
+header nav ul li {
+ display:inline;
+}
+header nav ul li a {
+ display:block;
+ float:left;
+ background:#916f6f;
+ width:auto;
+ height:10px;
+ padding:10px;
+ text-align:center;
+ margin:0 0.5em;
+ text-decoration:none;
+ color:#000;
+ font-family:Georgia Serif;
+ font-weight:bold;
+ font-size:1.1em;
+}
+header nav ul li a:visited {
+ color:#000;
+}
+
+#main {
+ padding-bottom: 1em;
+ background-color: #ccc;
+}
+div.screenshot img {
+ float:right;
+ display:block;
+}
+.description {
+ padding-top:5px;
+ font-family:Georgia, Serif;
+ font-size:1.2em;
+ line-height:2em;
+}
+article p, article ul {
+ padding-top:1em;
+}
+article li {
+ padding-top:0.7em;
+}
+
+a.download {
+ background:url('../images/button-download.png') top left no-repeat;
+ width:192px;
+ height:57px;
+ display:block;
+ margin:20px auto;
+ overflow:hidden;
+ text-indent:-10000em;
+}
+
+#main ul {
+ list-style-type:disc;
+}
+
+#main h1 {
+ color:#453B35;
+ font-family:arial, sans-serif;
+ font-size:3.5em;
+}
+#main h2 {
+ color:#453B35;
+ font-size:2em;
+ margin:1.5em 0 0;
+}
+#banners {
+ text-align:center;
+ padding:3em 0;
+}
+#banners a {
+ margin:0 5em;
+}
+
+footer p.copyrights {
+ text-align:center;
+ padding:2em 0;
+
+}
+
+figcaption {
+ font-style:italic;
+ font-size:1em;
+ padding:0 3em;
+}
+
+div.intro {
+ padding-top:2em;
+}
+.announcement {
+ color:#453B35;
+ font-size:1.2em;
+ margin:1em 0;
+} \ No newline at end of file
diff --git a/data/settings/third-party/bootstrap/css/bootstrap.min.css b/data/settings/third-party/bootstrap/css/bootstrap.min.css
new file mode 100644
index 0000000..b6fe4e0
--- /dev/null
+++ b/data/settings/third-party/bootstrap/css/bootstrap.min.css
@@ -0,0 +1,5 @@
+/*!
+ * Bootstrap v3.3.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ *//*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:before,:after{color:#000!important;text-shadow:none!important;background:transparent!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before,.glyphicon-eur:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:hover,a:focus{color:#23527c;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;color:#777}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}mark,.mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px}input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{position:absolute;margin-top:4px \9;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],input[type=radio].disabled,input[type=checkbox].disabled,fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm,.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm,select.form-group-sm .form-control{height:30px;line-height:30px}textarea.input-sm,textarea.form-group-sm .form-control,select[multiple].input-sm,select[multiple].form-group-sm .form-control{height:auto}.input-lg,.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg,select.form-group-lg .form-control{height:46px;line-height:46px}textarea.input-lg,textarea.form-group-lg .form-control,select[multiple].input-lg,select[multiple].form-group-lg .form-control{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline,.has-success.radio label,.has-success.checkbox label,.has-success.radio-inline label,.has-success.checkbox-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline,.has-warning.radio label,.has-warning.checkbox label,.has-warning.radio-inline label,.has-warning.checkbox-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline,.has-error.radio label,.has-error.checkbox label,.has-error.radio-inline label,.has-error.checkbox-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.3px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn:focus,.btn:active:focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn.active.focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus,.btn.focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default.focus,.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled.focus,.btn-default[disabled].focus,fieldset[disabled] .btn-default.focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary:hover,.btn-primary:focus,.btn-primary.focus,.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled.focus,.btn-primary[disabled].focus,fieldset[disabled] .btn-primary.focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success.focus,.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled.focus,.btn-success[disabled].focus,fieldset[disabled] .btn-success.focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info.focus,.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled.focus,.btn-info[disabled].focus,fieldset[disabled] .btn-info.focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning.focus,.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled.focus,.btn-warning[disabled].focus,fieldset[disabled] .btn-warning.focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger.focus,.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled.focus,.btn-danger[disabled].focus,fieldset[disabled] .btn-danger.focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link:active,.btn-link.active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#777;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none;visibility:hidden}.collapse.in{display:block;visibility:visible}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#777}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=radio],[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none;visibility:hidden}.tab-content>.active{display:block;visibility:visible}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important;visibility:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#333}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#fff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:hover,.label-default[href]:focus{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px 15px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding:48px 0}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-left,.media-right,.media-body{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table caption,.panel>.table-responsive>.table caption,.panel>.panel-collapse>.table caption{padding-right:15px;padding-left:15px}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body,.panel-group .panel-heading+.panel-collapse>.list-group{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:absolute;top:0;right:0;left:0;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-weight:400;line-height:1.4;visibility:visible;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-weight:400;line-height:1.42857143;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;perspective:1000}.carousel-inner>.item.next,.carousel-inner>.item.active.right{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.prev,.carousel-inner>.item.active.left{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right,.carousel-inner>.item.active{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{display:table;content:" "}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} \ No newline at end of file
diff --git a/data/settings/third-party/jquery/jquery.min.js b/data/settings/third-party/jquery/jquery.min.js
new file mode 100644
index 0000000..25714ed
--- /dev/null
+++ b/data/settings/third-party/jquery/jquery.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v2.1.3 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.3",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=mb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=nb(b);function qb(){}qb.prototype=d.filters=d.pseudos,d.setFilters=new qb,g=gb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?gb.error(a):z(a,i).slice(0)};function rb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)
+},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))
+},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec=/#.*$/,fc=/([?&])_=[^&]*/,gc=/^(.*?):[ \t]*([^\r\n]*)$/gm,hc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ic=/^(?:GET|HEAD)$/,jc=/^\/\//,kc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lc={},mc={},nc="*/".concat("*"),oc=a.location.href,pc=kc.exec(oc.toLowerCase())||[];function qc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function rc(a,b,c,d){var e={},f=a===mc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function sc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function tc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function uc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:oc,type:"GET",isLocal:hc.test(pc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?sc(sc(a,n.ajaxSettings),b):sc(n.ajaxSettings,a)},ajaxPrefilter:qc(lc),ajaxTransport:qc(mc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=gc.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||oc)+"").replace(ec,"").replace(jc,pc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pc[1]&&h[2]===pc[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pc[3]||("http:"===pc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rc(lc,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ic.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=fc.test(d)?d.replace(fc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+nc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=rc(mc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=tc(k,v,f)),u=uc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vc=/%20/g,wc=/\[\]$/,xc=/\r?\n/g,yc=/^(?:submit|button|image|reset|file)$/i,zc=/^(?:input|select|textarea|keygen)/i;function Ac(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wc.test(a)?d(a,e):Ac(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ac(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Ac(c,a[c],b,e);return d.join("&").replace(vc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&zc.test(this.nodeName)&&!yc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(xc,"\r\n")}}):{name:b.name,value:c.replace(xc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bc=0,Cc={},Dc={0:200,1223:204},Ec=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cc)Cc[a]()}),k.cors=!!Ec&&"withCredentials"in Ec,k.ajax=Ec=!!Ec,n.ajaxTransport(function(a){var b;return k.cors||Ec&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Cc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Dc[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Cc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Fc=[],Gc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Fc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Gc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Gc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Fc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Hc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Hc)return Hc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Ic=a.document.documentElement;function Jc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Jc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Ic;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ic})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Jc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kc=a.jQuery,Lc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Lc),b&&a.jQuery===n&&(a.jQuery=Kc),n},typeof b===U&&(a.jQuery=a.$=n),n});
diff --git a/data/widget/images/README b/data/widget/images/README
new file mode 100644
index 0000000..e442861
--- /dev/null
+++ b/data/widget/images/README
@@ -0,0 +1,21 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+All images in this directory are free, released under the GPLv3 or later. \ No newline at end of file
diff --git a/data/widget/images/librejs-32.png b/data/widget/images/librejs-32.png
new file mode 100644
index 0000000..96bfa23
--- /dev/null
+++ b/data/widget/images/librejs-32.png
Binary files differ
diff --git a/data/widget/images/librejs-64.png b/data/widget/images/librejs-64.png
new file mode 100644
index 0000000..82ac632
--- /dev/null
+++ b/data/widget/images/librejs-64.png
Binary files differ
diff --git a/data/widget/images/librejs-off.png b/data/widget/images/librejs-off.png
new file mode 100644
index 0000000..abb7b95
--- /dev/null
+++ b/data/widget/images/librejs-off.png
Binary files differ
diff --git a/data/widget/images/librejs.png b/data/widget/images/librejs.png
new file mode 100644
index 0000000..ee6a59b
--- /dev/null
+++ b/data/widget/images/librejs.png
Binary files differ
diff --git a/doc/fdl.texi b/doc/fdl.texi
new file mode 100644
index 0000000..fc19ddd
--- /dev/null
+++ b/doc/fdl.texi
@@ -0,0 +1,506 @@
+@c The GNU Free Documentation License.
+@center Version 1.3, 3 November 2008
+
+@c This file is intended to be included within another document,
+@c hence no sectioning command or @node.
+
+@display
+Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+@uref{http://fsf.org/}
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The ``Document'', below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as ``you''. You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not ``Transparent'' is called ``Opaque''.
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, La@TeX{} input
+format, SGML or XML using a publicly available
+DTD, and standard-conforming simple HTML,
+PostScript or PDF designed for human modification. Examples
+of transparent image formats include PNG, XCF and
+JPG. Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, SGML or
+XML for which the DTD and/or processing tools are
+not generally available, and the machine-generated HTML,
+PostScript or PDF produced by some word processors for
+output purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+The ``publisher'' means any person or entity that distributes copies
+of the Document to the public.
+
+A section ``Entitled XYZ'' means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as ``Acknowledgements'',
+``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
+of such a section when you modify the Document means that it remains a
+section ``Entitled XYZ'' according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+@item
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+@item
+COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+@item
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+@enumerate A
+@item
+Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document). You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
+@item
+List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
+@item
+State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
+@item
+Preserve all the copyright notices of the Document.
+
+@item
+Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
+@item
+Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
+@item
+Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document's license notice.
+
+@item
+Include an unaltered copy of this License.
+
+@item
+Preserve the section Entitled ``History'', Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page. If
+there is no section Entitled ``History'' in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
+@item
+Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on. These may be placed in the ``History'' section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
+@item
+For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
+@item
+Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles. Section numbers
+or the equivalent are not considered part of the section titles.
+
+@item
+Delete any section Entitled ``Endorsements''. Such a section
+may not be included in the Modified Version.
+
+@item
+Do not retitle any existing section to be Entitled ``Endorsements'' or
+to conflict in title with any Invariant Section.
+
+@item
+Preserve any Warranty Disclaimers.
+@end enumerate
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties---for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+@item
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled ``History''
+in the various original documents, forming one section Entitled
+``History''; likewise combine any sections Entitled ``Acknowledgements'',
+and any sections Entitled ``Dedications''. You must delete all
+sections Entitled ``Endorsements.''
+
+@item
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+@item
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an ``aggregate'' if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+@item
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled ``Acknowledgements'',
+``Dedications'', or ``History'', the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+@item
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+
+However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
+
+@item
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+@uref{http://www.gnu.org/copyleft/}.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation. If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy's public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+
+@item
+RELICENSING
+
+``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works. A
+public wiki that anybody can edit is an example of such a server. A
+``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
+site means any set of copyrightable works thus published on the MMC
+site.
+
+``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+
+``Incorporate'' means to publish or republish a Document, in whole or
+in part, as part of another Document.
+
+An MMC is ``eligible for relicensing'' if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole
+or in part into the MMC, (1) had no cover texts or invariant sections,
+and (2) were thus incorporated prior to November 1, 2008.
+
+The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+
+@end enumerate
+
+@page
+@heading ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+@smallexample
+@group
+ Copyright (C) @var{year} @var{your name}.
+ 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, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+@end group
+@end smallexample
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the ``with@dots{}Texts.'' line with this:
+
+@smallexample
+@group
+ with the Invariant Sections being @var{list their titles}, with
+ the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
+ being @var{list}.
+@end group
+@end smallexample
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
+@c Local Variables:
+@c ispell-local-pdict: "ispell-dict"
+@c End:
+
diff --git a/doc/librejs.info b/doc/librejs.info
new file mode 100644
index 0000000..fb706b5
--- /dev/null
+++ b/doc/librejs.info
@@ -0,0 +1,1243 @@
+This is librejs.info, produced by makeinfo version 5.2 from
+librejs.texi.
+
+This manual is for GNU LibreJS (version 6.0.8.20150117, 17 January
+2015), a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+ Copyright (C) 2011 2012 2014 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".
+INFO-DIR-SECTION GNUzilla
+START-INFO-DIR-ENTRY
+* LibreJS: (librejs). Detect nonfree nontrivial in GNU Icecat
+END-INFO-DIR-ENTRY
+
+
+File: librejs.info, Node: Top, Next: Overview, Up: (dir)
+
+LibreJS
+*******
+
+This manual is for GNU LibreJS (version 6.0.8.20150117, 17 January
+2015).
+
+* Menu:
+
+* Overview:: General purpose and information.
+* Disclaimer:: Emphasize what LibreJS does and does not.
+* Installation:: Installing LibreJS from source.
+* How to Use:: How to use LibreJS in IceCat.
+* JavaScript Detection:: How LibreJS detects nontrivial Javascript.
+* Free Licenses Detection:: List of licenses detected by LibreJS.
+* Setting Your JavaScript Free:: Information for website owners/maintainers.
+* Installation Requirements:: Requirements to build and install LibreJS.
+* LibreJS Internals:: How LibreJS works under the hood.
+* Tests:: Test LibreJS and better understand it.
+* GNU Free Documentation License:: Copying and sharing this documentation.
+
+
+File: librejs.info, Node: Overview, Next: Disclaimer, Prev: Top, Up: Top
+
+1 Overview
+**********
+
+GNU LibreJS --an add-on for GNU IceCat and Mozilla Firefox-- detects and
+blocks nonfree nontrivial JavaScript while allowing its execution on
+pages containing code that is either trivial and/or free.
+
+ Many websites run nontrivial JavaScript on your computer. Some use
+it for complex tasks; many use it gratuitously for minor jobs that could
+be done easily with plain HTML. Sometimes this JavaScript code is
+malicious. Either way, the JavaScript code is often nonfree. For
+explanation of the issue, see "The JavaScript
+Trap"(<http://www.gnu.org/philosophy/javascript-trap.html>).
+
+ If you care about freedom in your computing, and don't wish to let
+all and sundry make you run nonfree programs, now you can prevent it by
+using LibreJS.
+
+
+File: librejs.info, Node: Disclaimer, Next: Installation, Prev: Overview, Up: Top
+
+2 Disclaimer
+************
+
+ * LibreJS is not a security tool. Its goal is to detect nonfree
+ nontrivial JavaScript, and it currently does not detect whether
+ free or trivial code is malicious or not. Other free Mozilla
+ extensions and add-ons may be available for this purpose.
+
+ * LibreJS is always a work in progress. If you find a bug, please
+ report it to <bug-librejs@gnu.org>.
+
+
+File: librejs.info, Node: Installation, Next: How to Use, Prev: Disclaimer, Up: Top
+
+3 Installation
+**************
+
+You can install LibreJS directly using a generated 'librejs.xpi' file,
+or by building it from source.
+
+3.1 Building the Package
+========================
+
+After enabling the Add-on SDK, you should be able to use the 'make'
+command to build LibreJS from source.
+
+ After running 'make', a new file, 'librejs.xpi' should be generated.
+This is the file that can be installed in a Mozilla browser.
+
+3.2 Installing LibreJS
+======================
+
+To install the add-on for all users, run:
+ sudo make install
+
+ or as root:
+ make install
+
+ Next time you open a Mozilla-browser as a user of your system, you
+should be notified that a new add-on (in this case, LibreJS) as been
+installed and whether to allow it to run or not.
+
+
+File: librejs.info, Node: How to Use, Next: JavaScript Detection, Prev: Installation, Up: Top
+
+4 How to Use
+************
+
+4.1 LibreJS in action
+=====================
+
+After installing the add-on, you will see the LibreJS widget in the
+add-on bar at the bottom of the browser window. After loading a page,
+left-click on the widget to view the deactivated JavaScript code from
+the page (both on page and external) and, if applicable, the scripts
+that were accepted.
+
+4.2 Complaint Feature
+=====================
+
+It is very important to complain when a site has nonfree JavaScript
+code, especially if it won't work without that code. LibreJS makes it
+easy to complain by heuristically finding where to send the complaint.
+
+ When nonfree/nontrivial code is detected in a page, LibreJS attempts
+to find a relevant contact link or email for the website you are
+visiting. In order to do so, it will attempt to visit a few links from
+the current page (for instance, a link labeled "contact" on the same
+domain as the current page, ...)
+
+ LibreJS detects contact pages, email addresses that are likely to be
+owned by the maintainer of the site, Twitter and identi.ca links, and
+phone numbers.
+
+ After LibreJS detects any of the above, a "Complain" tab will appear
+on the right of your web browser. When you click on this tab, a large
+panel will appear with contact information. Ideally, at the top you
+will find the email address of the maintainer, labeled as the "Email you
+should use".
+
+ When you complain to the website for their nonfree nontrivial
+JavaScript, provide them with the link to the JavaScript Trap essay so
+that they can get more information on what the issue is and how they can
+solve it on their own site.
+
+ LibreJS includes a default subject line and body for the complaint
+email, with a link to the JavaScript Trap essay. This can be configured
+in the LibreJS add-on preferences in your web browser.
+
+4.3 Options
+===========
+
+"Whitelist"
+ LibreJS lets you whitelist domain names and subdomains to bypass
+ the regular JavaScript check. This might be useful, for example,
+ if you are running your own code in a local web server. In order
+ to add a whitelisted domain or url, go to Tools >> Add-ons, or
+ press 'Control + Shift + A'. Inside the add-on window, click on
+ "Extensions", and in the list, where you see LibreJS, click on the
+ "Preferences" button. You will see an input field labeled
+ "Whitelist". In the field, enter comma-separated domain names. Do
+ not enter the protocol. For instance to whitelist all the pages of
+ <http://www.gnu.org> and <https://gnu.org>, enter 'gnu.org'. To
+ allow all subdomains from gnu.org, enter: '*.gnu.org'. This will
+ match such sites as <http://savannah.gnu.org> and
+ <http://audio-video.gnu.org>.
+
+"Complaint tab"
+ This specifies whether the complaint tab appears when a site is
+ running nonfree JavaScript.
+
+"Display notifications of JavaScript analysis"
+ This option enables an info bar of realtime JavaScript analysis.
+
+"Complaint email subject"
+ Configure the default subject used in complaint emails.
+
+"Complaint email body"
+ Configure the default body used in complaint emails.
+
+
+File: librejs.info, Node: JavaScript Detection, Next: Free Licenses Detection, Prev: How to Use, Up: Top
+
+5 JavaScript Detection
+**********************
+
+ LibreJS considers JavaScript on a page nontrivial if any of the
+ following are true:
+
+ * It makes an AJAX request or is loaded along with scripts that make
+ an AJAX request,
+
+ * It loads external scripts dynamically or is loaded along with
+ scripts that do,
+
+ * It defines functions or methods and either loads an external script
+ (from HTML) or is loaded as one,
+
+ * It uses dynamic JavaScript constructs that are difficult to analyze
+ without interpreting the program or is loaded along with scripts
+ that use such constructs. These constructs are:
+ * Using the eval function
+ * Calling methods with the square bracket notation
+ * Using any other construct than a string literal with certain
+ methods ('Obj.write', 'Obj.createElement', ...).
+
+ In practice, the JavaScript code in your page may be found trivial by
+LibreJS if, as a whole:
+
+ * It does not define functions and it does not load external scripts
+ (with the HTML src attribute in a '<script>' tag).
+
+ * It does not make AJAX calls.
+
+ * It does not load external scripts with dynamic constructs.
+
+ * It does not use constructs that may be used to do any of the above
+ in a non-obvious way (use of the 'eval()' method, use of square
+ bracket method calls, use of concatenation with certain constructs
+ or method calls, ...).
+
+ However, in some instances, you may be required by LibreJS to add a
+stylized comment to JavaScript code that may be otherwise trivial.
+
+ When an external file defines a function, it becomes available to all
+other external scripts. That is the case if another script defines a
+function that makes AJAX calls, when an external script loads other
+scripts dynamically (which in turn could also make AJAX calls, ...), or
+when a script is written with constructs that may do any of these.
+
+ For instance, if your page contains the following:
+ <script src="jquery.js"></script>
+ <script>
+ $.doSomething();
+ </script>
+
+ While '$.doSomething();' may seem trivial, you will nevertheless have
+to add a stylized license comment on your main HTML page because the
+external script (in this case jQuery) has been found to define methods
+that make AJAX calls. '$.doSomething()' might make an AJAX call, and
+LibreJS does not check for that. The rule of thumb is that when you use
+a library or code that handles AJAX, JSON, JSONP, the loading of scripts
+dynamically, you should have license mentions for all your JavaScript
+files and for your main page regardless. In practice this is a case
+that happens very often with code that uses libraries.
+
+ In practice also, the JavaScript code in an external file (an
+external '.js' file loaded on your page) may be found trivial if it does
+not define functions/methods.
+
+ And in the same manner it will be considered nontrivial if AJAX
+calls, dynamic script loading, or non-obvious dynamic JavaScript
+constructs are used in another script.
+
+ If your JavaScript code makes AJAX requests, it's important to get an
+accurate "Content-Type" in the response from the server. For example,
+if you're using JSON, set it to 'application/json'. This is because
+LibreJS alters the content of 'text/html' responses.
+
+
+File: librejs.info, Node: Free Licenses Detection, Next: Setting Your JavaScript Free, Prev: JavaScript Detection, Up: Top
+
+6 Free Licenses Detection
+*************************
+
+6.1 Detected Free Licenses
+==========================
+
+In order for a file to be detected as free, the license notice should
+appear in a JavaScript file above all code, at the very top of the file.
+
+ For inline JavaScript code inside '<script>' tags in HTML pages, the
+license notice should appear once per page as a comment inside a
+'<script>' tag, before all the code in that script. When the only
+inline JavaScript code is within element attributes ('onload',
+'onclick'), place the license notice in an otherwise empty '<script>' at
+the top of the page. This is sometimes needed when an external script
+performs AJAX calls or embeds scripts dynamically, and the only inline
+JavaScript is an event attribute making a method call, e.g.: '<body
+onload="methodCall('remote-data.xml');">'
+
+ When people speak of the "MIT license" they mean either the X11
+license or the Expat license. Please see which license the code uses,
+and label it accordingly.
+
+ Currently LibreJS checks for the following licenses:
+
+ * Creative Commons CC0 1.0 Universal
+ * Identifier: 'CC0-1.0'
+ * URL:
+ <http://creativecommons.org/publicdomain/zero/1.0/legalcode>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt'
+
+ * Public Domain
+ * Public domain is not a license (see
+ <https://www.gnu.org/licenses/license-list.html#PublicDomain>).
+ If you want to release your work to the public domain, the FSF
+ recommends using CC0.
+ * Magnet Link:
+ 'magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt'
+
+ * GNU General Public License (GPL) version 2
+ * Identifier: 'GNU-GPL-2.0'
+ * URL: <http://www.gnu.org/licenses/gpl-2.0.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt'
+
+ * GNU General Public License (GPL) version 3
+ * Identifier: 'GNU-GPL-3.0'
+ * URL: <http://www.gnu.org/licenses/gpl-3.0.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt'
+
+ * Apache License, Version 2.0
+ * Identifier: 'Apache-2.0'
+ * URL: <http://www.apache.org/licenses/LICENSE-2.0>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt'
+
+ * GNU Lesser General Public License, version 2.1
+ * Identifier: 'GNU-LGPL-2.1'
+ * URL: <http://www.gnu.org/licenses/lgpl-2.1.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt'
+
+ * GNU Lesser General Public License, version 3
+ * Identifier: 'GNU-LGPL-3.0'
+ * URL: <http://www.gnu.org/licenses/lgpl-3.0.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt'
+
+ * GNU Affero General Public License, version 3
+ * Identifier: 'GNU-AGPL-3.0'
+ * URL: <http://www.gnu.org/licenses/agpl-3.0.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt'
+
+ * Boost Software License
+ * URL: <http://www.boost.org/LICENSE_1_0.txt>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&dn=Boost-1.0.txt'
+
+ * BSD 3-Clause License
+ * URL: <http://opensource.org/licenses/BSD-3-Clause>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt'
+
+ * Eclipse Public License 1.0
+ * Identifier: 'EPL-1.0'
+ * URL: <http://www.eclipse.org/legal/epl-v10.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&dn=epl-1.0.txt'
+
+ * Mozilla Public License 2.0
+ * Identifier: 'MPL-2.0'
+ * URL: <http://www.mozilla.org/MPL/2.0>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt'
+
+ * Expat License (sometimes called the MIT license)
+ * Identifier: 'Expat'
+ * URL: <http://www.jclark.com/xml/copying.txt>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt'
+
+ * X11 License
+ * Magnet link:
+ 'magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt'
+
+ * XFree86 License
+ * Identifier: 'Modified-BSD'
+ * URLs: <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3>
+ <http://www.xfree86.org/current/LICENSE4.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&dn=xfree86.txt'
+
+ * FreeBSD License
+ * URL: <http://www.freebsd.org/copyright/freebsd-license.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&dn=freebsd.txt'
+
+ * The ISC License
+ * URL:
+ <https://www.isc.org/downloads/software-support-policy/isc-license/>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&dn=ISC.txt'
+
+ * Artistic License 2.0
+ * URL: <http://www.perlfoundation.org/artistic_license_2_0>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&dn=artistic-2.0.txt'
+
+ * CPAL 1.0
+ * Identifier: 'CPAL-1.0'
+ * URL: <http://opensource.org/licenses/cpal_1.0>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&dn=cpal-1.0.txt'
+
+6.2 Undetected Free Licenses
+============================
+
+If you are using a free license that isn't detected by LibreJS and isn't
+listed in the previous section, please send a message to
+<bug-librejs@gnu.org> regarding this license, where code released under
+this license can be found, and where to find the license text and
+information.
+
+ Many free licenses are listed in this page:
+<http://www.gnu.org/licenses/license-list.html>
+
+
+File: librejs.info, Node: Setting Your JavaScript Free, Next: Installation Requirements, Prev: Free Licenses Detection, Up: Top
+
+7 Setting Your JavaScript Free
+******************************
+
+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.
+
+ 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.
+
+ 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.
+
+ _Tip_: 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.
+
+ Imagine a page that contains several pieces of JavaScript from
+various sources:
+ * On top, within the '<head>' tag, it includes jQuery
+
+ * Then, some JavaScript code that you have written
+
+ * At the bottom, a JavaScript-based Facebook widget
+
+ * Also, there's some analytics tracking code
+
+"JavaScript that is already free"
+ 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.
+
+"Your own JavaScript"
+ 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: <http://www.gnu.org/licenses/license-list.html>
+
+"Nonfree JavaScript"
+ 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:
+
+ * If you have used nonfree third-party code as the base to write
+ your own code, try to find a free alternative.
+
+ * If you're using a third-party service such as an analytics
+ service, replace it with a free alternative like Piwik.
+
+ * 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!
+
+7.1 JavaScript Web Labels
+=========================
+
+One way to make your website work with LibreJS is by defining a
+JavaScript Web Labels table.
+
+ 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.
+
+ 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
+<https://www.gnu.org/licenses/gpl-howto.html>. Future versions of
+LibreJS will require a copying permission statement or other license
+notice for source files listed in a Web Labels table.
+
+ More information on JavaScript Web Labels is detailed here:
+<https://www.gnu.org/software/librejs/free-your-javascript.html#step3>
+and here: <https://www.gnu.org/licenses/javascript-labels.html>.
+
+7.1.1 Specifying multiple licenses for a single JavaScript file
+---------------------------------------------------------------
+
+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:
+
+<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"
+ >GNU-GPL-3.0-or-later</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>
+
+ The '<br />' 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.
+
+ 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.
+
+7.2 Adding a stylized comment in your JavaScript files and on your page
+=======================================================================
+
+See a "Convention for releasing free JavaScript programs" in the
+JavaScript Trap <http://www.gnu.org/philosophy/javascript-trap.html>
+
+ Adding this notice will ensure LibreJS will find the JavaScript file
+to be free. The '@licstart' and '@licend' 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.
+
+ In the main HTML page, the license notice covers JavaScript contained
+in all '<script>' 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
+'@licstart' and '@licend'.
+
+ You should make _only_ one '@licstart' '@licend' comment in your
+page, since it pertains to the entire code on page across all '<script>'
+tags and inline html attributes.
+
+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.
+
+ For more info on making your JavaScript LibreJS-compliant, see this
+web page:
+<https://www.gnu.org/software/librejs/free-your-javascript.html>
+
+
+File: librejs.info, Node: Installation Requirements, Next: LibreJS Internals, Prev: Setting Your JavaScript Free, Up: Top
+
+Appendix A Installation Requirements
+************************************
+
+A.1 Mozilla Browser
+===================
+
+You will need one of the many flavors of the Mozilla browser to use
+LibreJS. It can be installed on the following:
+
+ GNU IceCat, Mozilla Firefox, Trisquel Abrowser, Debian Iceweasel.
+
+ LibreJS works on these browsers starting from version 29. We
+recommend that you use the latest version of your Mozilla browser.
+LibreJS has been tested extensively on multiple GNU/Linux distributions,
+but it is compatible any operating system as long as you're using a
+compatible Mozilla browser.
+
+A.2 Mozilla's Add-on SDK
+========================
+
+LibreJS uses the Mozilla Add-on SDK (Software Development Kit), a set of
+APIs and tools to create add-ons for Mozilla browsers.
+
+ You do not need the Add-on SDK to use LibreJS xpi file or to install
+it using the packaged version, but it is required in order to package
+the LibreJS source code into an xpi file using 'make'. If you would
+like to run the tests for LibreJS or make changes to the source files,
+you will need the Add-on SDK as well. For the "make" command to work
+properly, you must have the 'cfx' command available on your system from
+the command line.
+
+ The latest tarball for the Add-on SDK is available at:
+
+ <https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/jetpack-sdk-latest.tar.gz>
+
+ Instructions on how to get it working are available here:
+
+ <https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/installation.html>
+
+ In order to use 'make' with LibreJS source, however, it is ideal to
+have 'cfx' available at all times and for all users.
+
+ An easy way to do this is to extract the contents of the tarball and
+to place the files inside '/usr/lib/addon-sdk' and then creating a
+symbolic link in '/usr/bin', as follows:
+
+ sudo ln -s /usr/lib/addon-sdk/bin/cfx /usr/bin/cfx
+
+ The 'cfx' command will then be available to all users.
+
+ The Add-on SDK is released under the Mozilla Public License 2.0.
+
+
+File: librejs.info, Node: LibreJS Internals, Next: Tests, Prev: Installation Requirements, Up: Top
+
+Appendix B LibreJS Internals
+****************************
+
+LibreJS intercepts HTTP responses and rewrites their contents after
+analyzing JavaScript within them. It does not remove script nodes and
+attributes from the page, but instead "deactivates" them by modifying
+the 'type' and 'src' attributes on script elements and by moving the
+contents of inline JavaScript attributes such as onClick into harmless
+attributes.
+
+ LibreJS detects the most common cases using the HTTP response method
+described above, but in extremely rare cases, or when running code
+locally, LibreJS cannot detect JavaScript during the response stage.
+
+ To remedy this issue, and as a final safeguard, LibreJS takes a look
+at the scripts that are about to be executed while the browser engine is
+parsing the page. If the script is not found in a list of accepted
+scripts populated earlier, the execution will be prevented. This is to
+ensure content types that are not regular HTML (binhex with HTML in it,
+...) and JavaScript do not fall through the cracks and get executed.
+
+
+File: librejs.info, Node: Tests, Next: GNU Free Documentation License, Prev: LibreJS Internals, Up: Top
+
+Appendix C Tests
+****************
+
+In order to better understand how LibreJS works, you can try to visit
+these pages with LibreJS installed and enabled and see how they are
+being processed:
+
+ *
+ <http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/>
+ This page contains trivial on-page JavaScript code, and an external
+ script that contains trivial JavaScript code. Therefore, all
+ JavaScript is being executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/>
+ The on-page script here is trivial and uses a built-in method, but
+ the external script in this page is nontrivial (defines a
+ function.) The external script is blocked, the inline script is
+ executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/>
+ This page contains nontrivial code on page, and trivial code in its
+ external page. All JavaScript is _removed_ from the page, and the
+ external script is never analyzed, since the nontrivial conditions
+ are already met in the page.
+
+ * <http://lduros.net/assets/librejs/tests/free-inline-free-external/>
+ This page contains free on-page (GPL 3) JavaScript, and free
+ external Javascript. Therefore all JavaScript is being executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/>
+ This page contains free on-page JavaScript. The external script
+ contains nonfree nontrivial JavaScript (AJAX request). The free
+ code that is inline is executed, but the external file is blocked.
+
+ * <http://lduros.net/assets/librejs/tests/intrinsec-event/> This page
+ contains trivial on-page code, with an intrinsic event in an html
+ attribute (onload). All JavaScript is being executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/>
+ This page contains on-page trivial JavaScript (only makes a window
+ alert and loads an external script using the html <script> tag with
+ the src attribute. The external script is free (GPL v3), and since
+ it is only nontrivial because it defines a function, the on-page
+ trivial code is allowed to use it. All JavaScript is being
+ executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/>
+ This page contains trivial on-page JavaScript code, and loads an
+ external script that is free. Since no function is defined, the
+ external script is being analyzed. The external script is free.
+ Trivial here is not allowed because the external script, although
+ free, writes a script. The inline trivial script should also have
+ a free license notice for it to be interpreted.
+
+ *
+ <http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html>
+ This is a real-life example of a small jQuery plugin. The on-page
+ JavaScript code has a free license. The jQuery external file has a
+ free licensed. The shelltypist.js file has a free license as well.
+ All licenses are defined between '@licstart' and '@licend'. All
+ JavaScript is executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html>
+ This is the same page than the previous example, except it does not
+ have a free license for the main HTML page on-page script. While
+ the actual code there is trivial, since jQuery defines methods that
+ make use of AJAX, trivial code is not allowed, and no JavaScript is
+ executed.
+
+ * <http://lduros.net/assets/librejs/tests/test-labels/> This page
+ contains JavaScript (jQuery minified) that does not have proper
+ license information in the file, as it has no '@licstart' '@licend'
+ comment. It would be considered nonfree, however, the page itself
+ uses the JavaScript Web Labels method. On the page itself, you
+ will find a link labeled "JavaScript License Information", which
+ leads to a page that contains a properly formatted table with the
+ required data on the external JavaScript file. LibreJS visits this
+ link and determines the version of jQuery linked from the original
+ page is the one listed there, and flags it as free. All JavaScript
+ is executed (and the title should turn green.)
+
+
+File: librejs.info, Node: GNU Free Documentation License, Prev: Tests, Up: Top
+
+Appendix D GNU Free Documentation License
+*****************************************
+
+ Version 1.3, 3 November 2008
+
+ Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+ <http://fsf.org/>
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ 0. PREAMBLE
+
+ The purpose of this License is to make a manual, textbook, or other
+ functional and useful document "free" in the sense of freedom: to
+ assure everyone the effective freedom to copy and redistribute it,
+ with or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the
+ author and publisher a way to get credit for their work, while not
+ being considered responsible for modifications made by others.
+
+ This License is a kind of "copyleft", which means that derivative
+ works of the document must themselves be free in the same sense.
+ It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
+
+ We have designed this License in order to use it for manuals for
+ free software, because free software needs free documentation: a
+ free program should come with manuals providing the same freedoms
+ that the software does. But this License is not limited to
+ software manuals; it can be used for any textual work, regardless
+ of subject matter or whether it is published as a printed book. We
+ recommend this License principally for works whose purpose is
+ instruction or reference.
+
+ 1. APPLICABILITY AND DEFINITIONS
+
+ This License applies to any manual or other work, in any medium,
+ that contains a notice placed by the copyright holder saying it can
+ be distributed under the terms of this License. Such a notice
+ grants a world-wide, royalty-free license, unlimited in duration,
+ to use that work under the conditions stated herein. The
+ "Document", below, refers to any such manual or work. Any member
+ of the public is a licensee, and is addressed as "you". You accept
+ the license if you copy, modify or distribute the work in a way
+ requiring permission under copyright law.
+
+ A "Modified Version" of the Document means any work containing the
+ Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+
+ A "Secondary Section" is a named appendix or a front-matter section
+ of the Document that deals exclusively with the relationship of the
+ publishers or authors of the Document to the Document's overall
+ subject (or to related matters) and contains nothing that could
+ fall directly within that overall subject. (Thus, if the Document
+ is in part a textbook of mathematics, a Secondary Section may not
+ explain any mathematics.) The relationship could be a matter of
+ historical connection with the subject or with related matters, or
+ of legal, commercial, philosophical, ethical or political position
+ regarding them.
+
+ The "Invariant Sections" are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in the
+ notice that says that the Document is released under this License.
+ If a section does not fit the above definition of Secondary then it
+ is not allowed to be designated as Invariant. The Document may
+ contain zero Invariant Sections. If the Document does not identify
+ any Invariant Sections then there are none.
+
+ The "Cover Texts" are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice
+ that says that the Document is released under this License. A
+ Front-Cover Text may be at most 5 words, and a Back-Cover Text may
+ be at most 25 words.
+
+ A "Transparent" copy of the Document means a machine-readable copy,
+ represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images composed
+ of pixels) generic paint programs or (for drawings) some widely
+ available drawing editor, and that is suitable for input to text
+ formatters or for automatic translation to a variety of formats
+ suitable for input to text formatters. A copy made in an otherwise
+ Transparent file format whose markup, or absence of markup, has
+ been arranged to thwart or discourage subsequent modification by
+ readers is not Transparent. An image format is not Transparent if
+ used for any substantial amount of text. A copy that is not
+ "Transparent" is called "Opaque".
+
+ Examples of suitable formats for Transparent copies include plain
+ ASCII without markup, Texinfo input format, LaTeX input format,
+ SGML or XML using a publicly available DTD, and standard-conforming
+ simple HTML, PostScript or PDF designed for human modification.
+ Examples of transparent image formats include PNG, XCF and JPG.
+ Opaque formats include proprietary formats that can be read and
+ edited only by proprietary word processors, SGML or XML for which
+ the DTD and/or processing tools are not generally available, and
+ the machine-generated HTML, PostScript or PDF produced by some word
+ processors for output purposes only.
+
+ The "Title Page" means, for a printed book, the title page itself,
+ plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For
+ works in formats which do not have any title page as such, "Title
+ Page" means the text near the most prominent appearance of the
+ work's title, preceding the beginning of the body of the text.
+
+ The "publisher" means any person or entity that distributes copies
+ of the Document to the public.
+
+ A section "Entitled XYZ" means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ
+ stands for a specific section name mentioned below, such as
+ "Acknowledgements", "Dedications", "Endorsements", or "History".)
+ To "Preserve the Title" of such a section when you modify the
+ Document means that it remains a section "Entitled XYZ" according
+ to this definition.
+
+ The Document may include Warranty Disclaimers next to the notice
+ which states that this License applies to the Document. These
+ Warranty Disclaimers are considered to be included by reference in
+ this License, but only as regards disclaiming warranties: any other
+ implication that these Warranty Disclaimers may have is void and
+ has no effect on the meaning of this License.
+
+ 2. VERBATIM COPYING
+
+ You may copy and distribute the Document in any medium, either
+ commercially or noncommercially, provided that this License, the
+ copyright notices, and the license notice saying this License
+ applies to the Document are reproduced in all copies, and that you
+ add no other conditions whatsoever to those of this License. You
+ may not use technical measures to obstruct or control the reading
+ or further copying of the copies you make or distribute. However,
+ you may accept compensation in exchange for copies. If you
+ distribute a large enough number of copies you must also follow the
+ conditions in section 3.
+
+ You may also lend copies, under the same conditions stated above,
+ and you may publicly display copies.
+
+ 3. COPYING IN QUANTITY
+
+ If you publish printed copies (or copies in media that commonly
+ have printed covers) of the Document, numbering more than 100, and
+ the Document's license notice requires Cover Texts, you must
+ enclose the copies in covers that carry, clearly and legibly, all
+ these Cover Texts: Front-Cover Texts on the front cover, and
+ Back-Cover Texts on the back cover. Both covers must also clearly
+ and legibly identify you as the publisher of these copies. The
+ front cover must present the full title with all words of the title
+ equally prominent and visible. You may add other material on the
+ covers in addition. Copying with changes limited to the covers, as
+ long as they preserve the title of the Document and satisfy these
+ conditions, can be treated as verbatim copying in other respects.
+
+ If the required texts for either cover are too voluminous to fit
+ legibly, you should put the first ones listed (as many as fit
+ reasonably) on the actual cover, and continue the rest onto
+ adjacent pages.
+
+ If you publish or distribute Opaque copies of the Document
+ numbering more than 100, you must either include a machine-readable
+ Transparent copy along with each Opaque copy, or state in or with
+ each Opaque copy a computer-network location from which the general
+ network-using public has access to download using public-standard
+ network protocols a complete Transparent copy of the Document, free
+ of added material. If you use the latter option, you must take
+ reasonably prudent steps, when you begin distribution of Opaque
+ copies in quantity, to ensure that this Transparent copy will
+ remain thus accessible at the stated location until at least one
+ year after the last time you distribute an Opaque copy (directly or
+ through your agents or retailers) of that edition to the public.
+
+ It is requested, but not required, that you contact the authors of
+ the Document well before redistributing any large number of copies,
+ to give them a chance to provide you with an updated version of the
+ Document.
+
+ 4. MODIFICATIONS
+
+ You may copy and distribute a Modified Version of the Document
+ under the conditions of sections 2 and 3 above, provided that you
+ release the Modified Version under precisely this License, with the
+ Modified Version filling the role of the Document, thus licensing
+ distribution and modification of the Modified Version to whoever
+ possesses a copy of it. In addition, you must do these things in
+ the Modified Version:
+
+ A. Use in the Title Page (and on the covers, if any) a title
+ distinct from that of the Document, and from those of previous
+ versions (which should, if there were any, be listed in the
+ History section of the Document). You may use the same title
+ as a previous version if the original publisher of that
+ version gives permission.
+
+ B. List on the Title Page, as authors, one or more persons or
+ entities responsible for authorship of the modifications in
+ the Modified Version, together with at least five of the
+ principal authors of the Document (all of its principal
+ authors, if it has fewer than five), unless they release you
+ from this requirement.
+
+ C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+
+ D. Preserve all the copyright notices of the Document.
+
+ E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+
+ F. Include, immediately after the copyright notices, a license
+ notice giving the public permission to use the Modified
+ Version under the terms of this License, in the form shown in
+ the Addendum below.
+
+ G. Preserve in that license notice the full lists of Invariant
+ Sections and required Cover Texts given in the Document's
+ license notice.
+
+ H. Include an unaltered copy of this License.
+
+ I. Preserve the section Entitled "History", Preserve its Title,
+ and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on the
+ Title Page. If there is no section Entitled "History" in the
+ Document, create one stating the title, year, authors, and
+ publisher of the Document as given on its Title Page, then add
+ an item describing the Modified Version as stated in the
+ previous sentence.
+
+ J. Preserve the network location, if any, given in the Document
+ for public access to a Transparent copy of the Document, and
+ likewise the network locations given in the Document for
+ previous versions it was based on. These may be placed in the
+ "History" section. You may omit a network location for a work
+ that was published at least four years before the Document
+ itself, or if the original publisher of the version it refers
+ to gives permission.
+
+ K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the section
+ all the substance and tone of each of the contributor
+ acknowledgements and/or dedications given therein.
+
+ L. Preserve all the Invariant Sections of the Document, unaltered
+ in their text and in their titles. Section numbers or the
+ equivalent are not considered part of the section titles.
+
+ M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+
+ N. Do not retitle any existing section to be Entitled
+ "Endorsements" or to conflict in title with any Invariant
+ Section.
+
+ O. Preserve any Warranty Disclaimers.
+
+ If the Modified Version includes new front-matter sections or
+ appendices that qualify as Secondary Sections and contain no
+ material copied from the Document, you may at your option designate
+ some or all of these sections as invariant. To do this, add their
+ titles to the list of Invariant Sections in the Modified Version's
+ license notice. These titles must be distinct from any other
+ section titles.
+
+ You may add a section Entitled "Endorsements", provided it contains
+ nothing but endorsements of your Modified Version by various
+ parties--for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative
+ definition of a standard.
+
+ You may add a passage of up to five words as a Front-Cover Text,
+ and a passage of up to 25 words as a Back-Cover Text, to the end of
+ the list of Cover Texts in the Modified Version. Only one passage
+ of Front-Cover Text and one of Back-Cover Text may be added by (or
+ through arrangements made by) any one entity. If the Document
+ already includes a cover text for the same cover, previously added
+ by you or by arrangement made by the same entity you are acting on
+ behalf of, you may not add another; but you may replace the old
+ one, on explicit permission from the previous publisher that added
+ the old one.
+
+ The author(s) and publisher(s) of the Document do not by this
+ License give permission to use their names for publicity for or to
+ assert or imply endorsement of any Modified Version.
+
+ 5. COMBINING DOCUMENTS
+
+ You may combine the Document with other documents released under
+ this License, under the terms defined in section 4 above for
+ modified versions, provided that you include in the combination all
+ of the Invariant Sections of all of the original documents,
+ unmodified, and list them all as Invariant Sections of your
+ combined work in its license notice, and that you preserve all
+ their Warranty Disclaimers.
+
+ The combined work need only contain one copy of this License, and
+ multiple identical Invariant Sections may be replaced with a single
+ copy. If there are multiple Invariant Sections with the same name
+ but different contents, make the title of each such section unique
+ by adding at the end of it, in parentheses, the name of the
+ original author or publisher of that section if known, or else a
+ unique number. Make the same adjustment to the section titles in
+ the list of Invariant Sections in the license notice of the
+ combined work.
+
+ In the combination, you must combine any sections Entitled
+ "History" in the various original documents, forming one section
+ Entitled "History"; likewise combine any sections Entitled
+ "Acknowledgements", and any sections Entitled "Dedications". You
+ must delete all sections Entitled "Endorsements."
+
+ 6. COLLECTIONS OF DOCUMENTS
+
+ You may make a collection consisting of the Document and other
+ documents released under this License, and replace the individual
+ copies of this License in the various documents with a single copy
+ that is included in the collection, provided that you follow the
+ rules of this License for verbatim copying of each of the documents
+ in all other respects.
+
+ You may extract a single document from such a collection, and
+ distribute it individually under this License, provided you insert
+ a copy of this License into the extracted document, and follow this
+ License in all other respects regarding verbatim copying of that
+ document.
+
+ 7. AGGREGATION WITH INDEPENDENT WORKS
+
+ A compilation of the Document or its derivatives with other
+ separate and independent documents or works, in or on a volume of a
+ storage or distribution medium, is called an "aggregate" if the
+ copyright resulting from the compilation is not used to limit the
+ legal rights of the compilation's users beyond what the individual
+ works permit. When the Document is included in an aggregate, this
+ License does not apply to the other works in the aggregate which
+ are not themselves derivative works of the Document.
+
+ If the Cover Text requirement of section 3 is applicable to these
+ copies of the Document, then if the Document is less than one half
+ of the entire aggregate, the Document's Cover Texts may be placed
+ on covers that bracket the Document within the aggregate, or the
+ electronic equivalent of covers if the Document is in electronic
+ form. Otherwise they must appear on printed covers that bracket
+ the whole aggregate.
+
+ 8. TRANSLATION
+
+ Translation is considered a kind of modification, so you may
+ distribute translations of the Document under the terms of section
+ 4. Replacing Invariant Sections with translations requires special
+ permission from their copyright holders, but you may include
+ translations of some or all Invariant Sections in addition to the
+ original versions of these Invariant Sections. You may include a
+ translation of this License, and all the license notices in the
+ Document, and any Warranty Disclaimers, provided that you also
+ include the original English version of this License and the
+ original versions of those notices and disclaimers. In case of a
+ disagreement between the translation and the original version of
+ this License or a notice or disclaimer, the original version will
+ prevail.
+
+ If a section in the Document is Entitled "Acknowledgements",
+ "Dedications", or "History", the requirement (section 4) to
+ Preserve its Title (section 1) will typically require changing the
+ actual title.
+
+ 9. TERMINATION
+
+ You may not copy, modify, sublicense, or distribute the Document
+ except as expressly provided under this License. Any attempt
+ otherwise to copy, modify, sublicense, or distribute it is void,
+ and will automatically terminate your rights under this License.
+
+ However, if you cease all violation of this License, then your
+ license from a particular copyright holder is reinstated (a)
+ provisionally, unless and until the copyright holder explicitly and
+ finally terminates your license, and (b) permanently, if the
+ copyright holder fails to notify you of the violation by some
+ reasonable means prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+ reinstated permanently if the copyright holder notifies you of the
+ violation by some reasonable means, this is the first time you have
+ received notice of violation of this License (for any work) from
+ that copyright holder, and you cure the violation prior to 30 days
+ after your receipt of the notice.
+
+ Termination of your rights under this section does not terminate
+ the licenses of parties who have received copies or rights from you
+ under this License. If your rights have been terminated and not
+ permanently reinstated, receipt of a copy of some or all of the
+ same material does not give you any rights to use it.
+
+ 10. FUTURE REVISIONS OF THIS LICENSE
+
+ The Free Software Foundation may publish new, revised versions of
+ the GNU Free Documentation License from time to time. Such new
+ versions will be similar in spirit to the present version, but may
+ differ in detail to address new problems or concerns. See
+ <http://www.gnu.org/copyleft/>.
+
+ Each version of the License is given a distinguishing version
+ number. If the Document specifies that a particular numbered
+ version of this License "or any later version" applies to it, you
+ have the option of following the terms and conditions either of
+ that specified version or of any later version that has been
+ published (not as a draft) by the Free Software Foundation. If the
+ Document does not specify a version number of this License, you may
+ choose any version ever published (not as a draft) by the Free
+ Software Foundation. If the Document specifies that a proxy can
+ decide which future versions of this License can be used, that
+ proxy's public statement of acceptance of a version permanently
+ authorizes you to choose that version for the Document.
+
+ 11. RELICENSING
+
+ "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
+ World Wide Web server that publishes copyrightable works and also
+ provides prominent facilities for anybody to edit those works. A
+ public wiki that anybody can edit is an example of such a server.
+ A "Massive Multiauthor Collaboration" (or "MMC") contained in the
+ site means any set of copyrightable works thus published on the MMC
+ site.
+
+ "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
+ license published by Creative Commons Corporation, a not-for-profit
+ corporation with a principal place of business in San Francisco,
+ California, as well as future copyleft versions of that license
+ published by that same organization.
+
+ "Incorporate" means to publish or republish a Document, in whole or
+ in part, as part of another Document.
+
+ An MMC is "eligible for relicensing" if it is licensed under this
+ License, and if all works that were first published under this
+ License somewhere other than this MMC, and subsequently
+ incorporated in whole or in part into the MMC, (1) had no cover
+ texts or invariant sections, and (2) were thus incorporated prior
+ to November 1, 2008.
+
+ The operator of an MMC Site may republish an MMC contained in the
+ site under CC-BY-SA on the same site at any time before August 1,
+ 2009, provided the MMC is eligible for relicensing.
+
+ADDENDUM: How to use this License for your documents
+====================================================
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and license
+notices just after the title page:
+
+ Copyright (C) YEAR YOUR NAME.
+ 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, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover
+Texts, replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with
+ the Front-Cover Texts being LIST, and with the Back-Cover Texts
+ being LIST.
+
+ If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+ If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of free
+software license, such as the GNU General Public License, to permit
+their use in free software.
+
+
+
+Tag Table:
+Node: Top835
+Node: Overview1858
+Node: Disclaimer2705
+Node: Installation3201
+Node: How to Use4054
+Node: JavaScript Detection7296
+Node: Free Licenses Detection10704
+Node: Setting Your JavaScript Free16876
+Node: Installation Requirements23722
+Node: LibreJS Internals25879
+Node: Tests27042
+Node: GNU Free Documentation License31549
+
+End Tag Table
diff --git a/doc/librejs.texi b/doc/librejs.texi
new file mode 100644
index 0000000..2ff6271
--- /dev/null
+++ b/doc/librejs.texi
@@ -0,0 +1,878 @@
+\input texinfo @c -*-texinfo-*-
+@c %**start of header
+@setfilename librejs.info
+@include version.texi
+@settitle GNU LibreJS @value{VERSION}
+
+@copying
+This manual is for GNU LibreJS (version @value{VERSION}, @value{UPDATED}),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright @copyright{} 2011 2012 2014 Loic J. Duros
+
+@quotation
+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''.
+@end quotation
+@end copying
+
+@dircategory GNUzilla
+@direntry
+* LibreJS: (librejs). Detect nonfree nontrivial in GNU Icecat
+@end direntry
+
+@titlepage
+@title GNU LibreJS
+@subtitle for version @value{VERSION}, @value{UPDATED}
+@author Loic J. Duros (@email{librejs@@lduros.net})
+@page
+@vskip 0pt plus 1filll
+@insertcopying
+@end titlepage
+
+
+@contents
+
+
+@node Top
+@top LibreJS
+This manual is for GNU LibreJS (version @value{VERSION}, @value{UPDATED}).
+
+@menu
+* Overview:: General purpose and information.
+* Disclaimer:: Emphasize what LibreJS does and does not.
+* Installation:: Installing LibreJS from source.
+* How to Use:: How to use LibreJS in IceCat.
+* JavaScript Detection:: How LibreJS detects nontrivial Javascript.
+* Free Licenses Detection:: List of licenses detected by LibreJS.
+* Setting Your JavaScript Free:: Information for website owners/maintainers.
+* Installation Requirements:: Requirements to build and install LibreJS.
+* LibreJS Internals:: How LibreJS works under the hood.
+* Tests:: Test LibreJS and better understand it.
+* GNU Free Documentation License:: Copying and sharing this documentation.
+@end menu
+
+@node Overview
+@chapter Overview
+
+@cindex overview
+GNU LibreJS ---an add-on for GNU IceCat and Mozilla Firefox--- detects
+and blocks nonfree nontrivial JavaScript while allowing its execution on
+pages containing code that is either trivial and/or free.
+
+Many websites run nontrivial JavaScript on your computer. Some use it
+for complex tasks; many use it gratuitously for minor jobs that could be
+done easily with plain HTML. Sometimes this JavaScript code is
+malicious. Either way, the JavaScript code is often nonfree. For
+explanation of the issue, see "The JavaScript
+Trap"(@url{http://www.gnu.org/philosophy/javascript-trap.html}).
+
+If you care about freedom in your computing, and don't wish to let all
+and sundry make you run nonfree programs, now you can prevent it by
+using LibreJS.
+
+
+@node Disclaimer
+@chapter Disclaimer
+
+@cindex disclaimer
+
+@itemize @bullet
+@item
+LibreJS is not a security tool. Its goal is to detect nonfree nontrivial
+JavaScript, and it currently does not detect whether free or trivial
+code is malicious or not. Other free Mozilla extensions and add-ons may
+be available for this purpose.
+
+@item
+LibreJS is always a work in progress. If you find a bug, please report
+it to @email{bug-librejs@@gnu.org}.
+
+@end itemize
+
+@node Installation
+@chapter Installation
+@cindex Installation
+
+You can install LibreJS directly using a generated @file{librejs.xpi}
+file, or by building it from source.
+
+
+@section Building the Package
+After enabling the Add-on SDK, you should be able to use the @code{make}
+command to build LibreJS from source.
+
+After running @code{make}, a new file, @file{librejs.xpi} should be
+generated. This is the file that can be installed in a Mozilla browser.
+
+@section Installing LibreJS
+To install the add-on for all users, run:
+@example
+sudo make install
+@end example
+
+or as root:
+@example
+make install
+@end example
+
+Next time you open a Mozilla-browser as a user of your system, you
+should be notified that a new add-on (in this case, LibreJS) as been
+installed and whether to allow it to run or not.
+
+@node How to Use
+@chapter How to Use
+
+@section LibreJS in action
+
+After installing the add-on, you will see the LibreJS widget in the
+add-on bar at the bottom of the browser window. After loading a page,
+left-click on the widget to view the deactivated JavaScript code from
+the page (both on page and external) and, if applicable, the scripts
+that were accepted.
+
+@section Complaint Feature
+
+It is very important to complain when a site has nonfree JavaScript
+code, especially if it won't work without that code. LibreJS makes it
+easy to complain by heuristically finding where to send the complaint.
+
+When nonfree/nontrivial code is detected in a page, LibreJS attempts to
+find a relevant contact link or email for the website you are
+visiting. In order to do so, it will attempt to visit a few links from
+the current page (for instance, a link labeled ``contact'' on the same
+domain as the current page, @dots{})
+
+LibreJS detects contact pages, email addresses that are likely to be
+owned by the maintainer of the site, Twitter and identi.ca links, and
+phone numbers.
+
+After LibreJS detects any of the above, a ``Complain'' tab will appear
+on the right of your web browser. When you click on this tab, a large
+panel will appear with contact information. Ideally, at the top you will
+find the email address of the maintainer, labeled as the ``Email you
+should use''.
+
+When you complain to the website for their nonfree nontrivial
+JavaScript, provide them with the link to the JavaScript Trap essay so
+that they can get more information on what the issue is and how they can
+solve it on their own site.
+
+LibreJS includes a default subject line and body for the complaint email,
+with a link to the JavaScript Trap essay. This can be configured in the
+LibreJS add-on preferences in your web browser.
+
+
+@section Options
+
+@table @dfn
+@item Whitelist
+LibreJS lets you whitelist domain names and subdomains to bypass the
+regular JavaScript check. This might be useful, for example, if you are
+running your own code in a local web server. In order to add a
+whitelisted domain or url, go to Tools >> Add-ons, or press @kbd{Control
++ Shift + A}. Inside the add-on window, click on @dfn{Extensions}, and in
+the list, where you see LibreJS, click on the @dfn{Preferences} button.
+You will see an input field labeled @dfn{Whitelist}. In the field,
+enter comma-separated domain names. Do not enter the protocol. For
+instance to whitelist all the pages of @url{http://www.gnu.org} and
+@url{https://gnu.org}, enter @samp{gnu.org}. To allow all subdomains from
+gnu.org, enter: @samp{*.gnu.org}. This will match such sites as
+@url{http://savannah.gnu.org} and @url{http://audio-video.gnu.org}.
+
+@item Complaint tab
+This specifies whether the complaint tab appears when a site is running
+nonfree JavaScript.
+
+@item Display notifications of JavaScript analysis
+This option enables an info bar of realtime JavaScript analysis.
+
+@item Complaint email subject
+Configure the default subject used in complaint emails.
+
+@item Complaint email body
+Configure the default body used in complaint emails.
+@end table
+
+@node JavaScript Detection
+@chapter JavaScript Detection
+@cindex javascript
+
+@itemize
+LibreJS considers JavaScript on a page nontrivial if any of the
+following are true:
+
+@item
+It makes an AJAX request or is loaded along with scripts that make
+an AJAX request,
+
+@item
+It loads external scripts dynamically or is loaded along with
+scripts that do,
+
+@item
+It defines functions or methods and either loads an external script
+(from HTML) or is loaded as one,
+
+@item
+It uses dynamic JavaScript constructs that are difficult to analyze
+without interpreting the program or is loaded along with scripts
+that use such constructs. These constructs are:
+@itemize
+@item
+Using the eval function
+@item
+Calling methods with the square bracket notation
+@item
+Using any other construct than a string literal with certain methods
+(@code{Obj.write}, @code{Obj.createElement}, @dots{}).
+@end itemize
+@end itemize
+
+In practice, the JavaScript code in your page may be found trivial by
+LibreJS if, as a whole:
+@itemize @bullet
+
+@item
+It does not define functions and it does not load external scripts
+(with the HTML src attribute in a @code{<script>} tag).
+
+@item
+It does not make AJAX calls.
+
+@item
+It does not load external scripts with dynamic constructs.
+
+@item
+It does not use constructs that may be used to do any of the above in
+a non-obvious way (use of the @code{eval()} method, use of square bracket
+method calls, use of concatenation with certain constructs or method
+calls, @dots{}).
+
+@end itemize
+
+However, in some instances, you may be required by LibreJS to add a
+stylized comment to JavaScript code that may be otherwise trivial.
+
+When an external file defines a function, it becomes available
+to all other external scripts. That is the case if another script
+defines a function that makes AJAX calls, when an external script
+loads other scripts dynamically (which in turn could also make AJAX
+calls, @dots{}), or when a script is written with constructs that may do
+any of these.
+
+For instance, if your page contains the following:
+@example
+<script src="jquery.js"></script>
+<script>
+$.doSomething();
+</script>
+@end example
+
+While @code{$.doSomething();} may seem trivial, you will nevertheless
+have to add a stylized license comment on your main HTML page because
+the external script (in this case jQuery) has been found to define
+methods that make AJAX calls. @code{$.doSomething()} might make an AJAX call,
+and LibreJS does not check for that. The rule of thumb is that when you
+use a library or code that handles AJAX, JSON, JSONP, the loading of
+scripts dynamically, you should have license mentions for all your
+JavaScript files and for your main page regardless. In practice this is
+a case that happens very often with code that uses libraries.
+
+In practice also, the JavaScript code in an external file (an external
+@file{.js} file loaded on your page) may be found trivial if it does not
+define functions/methods.
+
+And in the same manner it will be considered nontrivial if AJAX calls,
+dynamic script loading, or non-obvious dynamic JavaScript constructs
+are used in another script.
+
+If your JavaScript code makes AJAX requests, it's important to get an
+accurate @dfn{Content-Type} in the response from the server. For
+example, if you're using JSON, set it to @code{application/json}.
+This is because LibreJS alters the content of @code{text/html}
+responses.
+
+@node Free Licenses Detection
+@chapter Free Licenses Detection
+@cindex freelicenses
+
+@section Detected Free Licenses
+
+In order for a file to be detected as free, the license notice should
+appear in a JavaScript file above all code, at the very top of the file.
+
+For inline JavaScript code inside @code{<script>} tags in HTML pages,
+the license notice should appear once per page as a comment inside a
+@code{<script>} tag, before all the code in that script. When the only
+inline JavaScript code is within element attributes (@code{onload},
+@code{onclick}), place the license notice in an otherwise empty
+@code{<script>} at the top of the page. This is sometimes needed when an
+external script performs AJAX calls or embeds scripts dynamically, and
+the only inline JavaScript is an event attribute making a method call,
+e.g.: @code{<body onload="methodCall('remote-data.xml');">}
+
+When people speak of the ``MIT license'' they mean either the X11 license
+or the Expat license. Please see which license the code uses, and label
+it accordingly.
+
+Currently LibreJS checks for the following licenses:
+
+@itemize @bullet
+
+@item
+Creative Commons CC0 1.0 Universal
+@itemize @bullet
+@item
+Identifier: @samp{CC0-1.0}
+@item
+URL: @url{http://creativecommons.org/publicdomain/zero/1.0/legalcode}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt}
+@end itemize
+
+@item
+Public Domain
+@itemize @bullet
+@item
+Public domain is not a license (see
+@url{https://www.gnu.org/licenses/license-list.html#PublicDomain}). If
+you want to release your work to the public domain, the FSF recommends
+using CC0.
+@item
+Magnet Link: @indicateurl{magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt}
+@end itemize
+
+@item
+GNU General Public License (GPL) version 2
+@itemize @bullet
+@item
+Identifier: @samp{GNU-GPL-2.0}
+@item
+URL: @url{http://www.gnu.org/licenses/gpl-2.0.html}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt}
+@end itemize
+
+@item
+GNU General Public License (GPL) version 3
+@itemize @bullet
+@item
+Identifier: @samp{GNU-GPL-3.0}
+@item
+URL: @url{http://www.gnu.org/licenses/gpl-3.0.html}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt}
+@end itemize
+
+@item
+Apache License, Version 2.0
+@itemize @bullet
+@item
+Identifier: @samp{Apache-2.0}
+@item
+URL: @url{http://www.apache.org/licenses/LICENSE-2.0}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt}
+@end itemize
+
+@item
+GNU Lesser General Public License, version 2.1
+@itemize @bullet
+@item
+Identifier: @samp{GNU-LGPL-2.1}
+@item
+URL: @url{http://www.gnu.org/licenses/lgpl-2.1.html}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt}
+@end itemize
+
+@item
+GNU Lesser General Public License, version 3
+@itemize @bullet
+@item
+Identifier: @samp{GNU-LGPL-3.0}
+@item
+URL: @url{http://www.gnu.org/licenses/lgpl-3.0.html}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt}
+@end itemize
+
+@item
+GNU Affero General Public License, version 3
+@itemize @bullet
+@item
+Identifier: @samp{GNU-AGPL-3.0}
+@item
+URL: @url{http://www.gnu.org/licenses/agpl-3.0.html}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt}
+@end itemize
+
+@item
+Boost Software License
+@itemize @bullet
+@item
+URL: @url{http://www.boost.org/LICENSE_1_0.txt}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&dn=Boost-1.0.txt}
+@end itemize
+
+@item
+BSD 3-Clause License
+@itemize @bullet
+@item
+URL: @url{http://opensource.org/licenses/BSD-3-Clause}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt}
+@end itemize
+
+@item
+Eclipse Public License 1.0
+@itemize @bullet
+@item
+Identifier: @samp{EPL-1.0}
+@item
+URL: @url{http://www.eclipse.org/legal/epl-v10.html}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&dn=epl-1.0.txt}
+@end itemize
+
+@item
+Mozilla Public License 2.0
+@itemize @bullet
+@item
+Identifier: @samp{MPL-2.0}
+@item
+URL: @url{http://www.mozilla.org/MPL/2.0}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt}
+@end itemize
+
+@item
+Expat License (sometimes called the MIT license)
+@itemize @bullet
+@item
+Identifier: @samp{Expat}
+@item
+URL: @url{http://www.jclark.com/xml/copying.txt}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt}
+@end itemize
+
+@item
+X11 License
+@itemize @bullet
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt}
+@end itemize
+
+@item
+XFree86 License
+@itemize @bullet
+@item
+Identifier: @samp{Modified-BSD}
+@item
+URLs:
+@url{http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3}
+@url{http://www.xfree86.org/current/LICENSE4.html}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&dn=xfree86.txt}
+@end itemize
+
+@item
+FreeBSD License
+@itemize @bullet
+@item
+URL: @url{http://www.freebsd.org/copyright/freebsd-license.html}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&dn=freebsd.txt}
+@end itemize
+
+@item
+The ISC License
+@itemize @bullet
+@item
+URL: @url{https://www.isc.org/downloads/software-support-policy/isc-license/}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&dn=ISC.txt}
+@end itemize
+
+@item
+Artistic License 2.0
+@itemize @bullet
+@item
+URL: @url{http://www.perlfoundation.org/artistic_license_2_0}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&dn=artistic-2.0.txt}
+@end itemize
+
+@item
+CPAL 1.0
+@itemize @bullet
+@item
+Identifier: @samp{CPAL-1.0}
+@item
+URL: @url{http://opensource.org/licenses/cpal_1.0}
+@item
+Magnet link: @indicateurl{magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&dn=cpal-1.0.txt}
+@end itemize
+
+@end itemize
+
+@section Undetected Free Licenses
+If you are using a free license that isn't detected by LibreJS and isn't
+listed in the previous section, please send a message to
+@email{bug-librejs@@gnu.org} regarding this license, where code released under
+this license can be found, and where to find the license text and
+information.
+
+Many free licenses are listed in this page:
+@url{http://www.gnu.org/licenses/license-list.html}
+
+
+@node Setting Your JavaScript Free
+@chapter Setting Your JavaScript Free
+
+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.
+
+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.
+
+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.
+
+@emph{Tip}: 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.
+
+Imagine a page that contains several pieces of JavaScript from various
+sources:
+@itemize @bullet
+@item
+On top, within the @code{<head>} tag, it includes jQuery
+
+@item
+Then, some JavaScript code that you have written
+
+@item
+At the bottom, a JavaScript-based Facebook widget
+
+@item
+Also, there's some analytics tracking code
+@end itemize
+
+
+@table @dfn
+@item JavaScript that is already free
+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.
+
+@item Your own JavaScript
+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: @url{http://www.gnu.org/licenses/license-list.html}
+
+@item Nonfree JavaScript
+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:
+
+@itemize @bullet
+
+@item
+If you have used nonfree third-party code as the base to write your own
+code, try to find a free alternative.
+
+@item
+If you're using a third-party service such as an analytics service,
+replace it with a free alternative like Piwik.
+
+@item
+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!
+@end itemize
+
+@end table
+
+@section JavaScript Web Labels
+One way to make your website work with LibreJS is by defining a
+JavaScript Web Labels table.
+
+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.
+
+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
+@url{https://www.gnu.org/licenses/gpl-howto.html}. Future versions of
+LibreJS will require a copying permission statement or other license
+notice for source files listed in a Web Labels table.
+
+More information on JavaScript Web Labels is detailed here:
+@url{https://www.gnu.org/software/librejs/free-your-javascript.html#step3}
+and here:
+@url{https://www.gnu.org/licenses/javascript-labels.html}.
+
+@subsection Specifying multiple licenses for a single JavaScript file
+
+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:
+
+@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"
+ >GNU-GPL-3.0-or-later</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>
+@end verbatim
+
+The @code{<br />} 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.
+
+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.
+
+@section Adding a stylized comment in your JavaScript files and on your page
+See a ``Convention for releasing free JavaScript programs'' in the
+JavaScript Trap @url{http://www.gnu.org/philosophy/javascript-trap.html}
+
+Adding this notice will ensure LibreJS will find the JavaScript file to
+be free. The @code{@@licstart} and @code{@@licend} 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.
+
+In the main HTML page, the license notice covers JavaScript contained
+in all @code{<script>} tags with on-page code and the inline
+JavaScript (in event attributes such as onload, onclick, etc, @dots{}).
+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} and @code{@@licend}.
+
+You should make @emph{only} one @code{@@licstart} @code{@@licend}
+comment in your page, since it pertains to the entire code on page
+across all @code{<script>} tags and inline html attributes.
+
+@unnumbered
+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.
+
+For more info on making your JavaScript LibreJS-compliant, see this web
+page: @url{https://www.gnu.org/software/librejs/free-your-javascript.html}
+
+@node Installation Requirements
+@appendix Installation Requirements
+
+
+@appendixsec Mozilla Browser
+
+You will need one of the many flavors of the Mozilla browser to use
+LibreJS. It can be installed on the following:
+
+GNU IceCat, Mozilla Firefox, Trisquel Abrowser, Debian Iceweasel.
+
+LibreJS works on these browsers starting from version 29. We
+recommend that you use the latest version of your Mozilla browser.
+LibreJS has been tested extensively on multiple GNU/Linux distributions,
+but it is compatible any operating system as long as you're using a
+compatible Mozilla browser.
+
+@appendixsec Mozilla's Add-on SDK
+LibreJS uses the Mozilla Add-on SDK (Software Development Kit), a
+set of APIs and tools to create add-ons for Mozilla browsers.
+
+You do not need the Add-on SDK to use LibreJS xpi file or to install it
+using the packaged version, but it is required in order to package the
+LibreJS source code into an xpi file using @code{make}. If you would like
+to run the tests for LibreJS or make changes to the source files, you
+will need the Add-on SDK as well. For the ``make'' command to work
+properly, you must have the @code{cfx} command available on your system
+from the command line.
+
+The latest tarball for the Add-on SDK is available at:
+
+@url{https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/jetpack-sdk-latest.tar.gz}
+
+Instructions on how to get it working are available here:
+
+@url{https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/installation.html}
+
+In order to use @code{make} with LibreJS source, however, it is ideal to
+have @code{cfx} available at all times and for all users.
+
+An easy way to do this is to extract the contents of the tarball and to
+place the files inside @file{/usr/lib/addon-sdk} and then creating a
+symbolic link in @file{/usr/bin}, as follows:
+
+@example
+sudo ln -s /usr/lib/addon-sdk/bin/cfx /usr/bin/cfx
+@end example
+
+The @code{cfx} command will then be available to all users.
+
+The Add-on SDK is released under the Mozilla Public License 2.0.
+
+@node LibreJS Internals
+@appendix LibreJS Internals
+
+LibreJS intercepts HTTP responses and rewrites their contents after
+analyzing JavaScript within them. It does not remove script nodes and
+attributes from the page, but instead ``deactivates'' them by modifying
+the @code{type} and @code{src} attributes on script elements and by
+moving the contents of inline JavaScript attributes such as onClick
+into harmless attributes.
+
+LibreJS detects the most common cases using the HTTP response method
+described above, but in extremely rare cases, or when running code
+locally, LibreJS cannot detect JavaScript during the response stage.
+
+To remedy this issue, and as a final safeguard, LibreJS takes a look
+at the scripts that are about to be executed while the browser engine is
+parsing the page. If the script is not found in a list of accepted
+scripts populated earlier, the execution will be prevented. This is to
+ensure content types that are not regular HTML (binhex with HTML in it,
+@dots{}) and JavaScript do not fall through the cracks and get executed.
+
+@node Tests
+@appendix Tests
+
+
+In order to better understand how LibreJS works, you can try to visit
+these pages with LibreJS installed and enabled and see how they are
+being processed:
+
+@itemize @bullet
+
+@item
+@url{http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/}
+This page contains trivial on-page JavaScript code, and an external
+script that contains trivial JavaScript code. Therefore, all JavaScript
+is being executed.
+
+
+@item
+@url{http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/}
+The on-page script here is trivial and uses a built-in method, but the
+external script in this page is nontrivial (defines a function.) The
+external script is blocked, the inline script is executed.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/}
+This page contains nontrivial code on page, and trivial code in its
+external page. All JavaScript is @emph{removed} from the page, and the
+external script is never analyzed, since the nontrivial conditions are
+already met in the page.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/free-inline-free-external/}
+This page contains free on-page (GPL 3) JavaScript, and free external
+Javascript. Therefore all JavaScript is being executed.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/}
+This page contains free on-page JavaScript. The external script contains
+nonfree nontrivial JavaScript (AJAX request). The free code that is
+inline is executed, but the external file is blocked.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/intrinsec-event/} This page
+contains trivial on-page code, with an intrinsic event in an html
+attribute (onload). All JavaScript is being executed.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/}
+This page contains on-page trivial JavaScript (only makes a window alert
+and loads an external script using the html <script> tag with the src
+attribute. The external script is free (GPL v3), and since it is only
+nontrivial because it defines a function, the on-page trivial code is
+allowed to use it. All JavaScript is being executed.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/}
+This page contains trivial on-page JavaScript code, and loads an
+external script that is free. Since no function is defined, the external
+script is being analyzed. The external script is free. Trivial here is
+not allowed because the external script, although free, writes a
+script. The inline trivial script should also have a free license notice
+for it to be interpreted.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html}
+This is a real-life example of a small jQuery plugin. The on-page
+JavaScript code has a free license. The jQuery external file has a free
+licensed. The shelltypist.js file has a free license as well. All
+licenses are defined between @code{@@licstart} and @code{@@licend}. All
+JavaScript is executed.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html}
+This is the same page than the previous example, except it does not have
+a free license for the main HTML page on-page script. While the actual
+code there is trivial, since jQuery defines methods that make use of
+AJAX, trivial code is not allowed, and no JavaScript is executed.
+
+@item
+@url{http://lduros.net/assets/librejs/tests/test-labels/} This page
+contains JavaScript (jQuery minified) that does not have proper license
+information in the file, as it has no @code{@@licstart} @code{@@licend}
+comment. It would be considered nonfree, however, the page itself uses
+the JavaScript Web Labels method. On the page itself, you will find a
+link labeled ``JavaScript License Information'', which leads to a page
+that contains a properly formatted table with the required data on the
+external JavaScript file. LibreJS visits this link and determines the
+version of jQuery linked from the original page is the one listed there,
+and flags it as free. All JavaScript is executed (and the title should
+turn green.)
+
+@end itemize
+
+
+@node GNU Free Documentation License
+@appendix GNU Free Documentation License
+
+@include fdl.texi
+
+
+@bye
diff --git a/doc/manual/html_node/Disclaimer.html b/doc/manual/html_node/Disclaimer.html
new file mode 100644
index 0000000..608099e
--- /dev/null
+++ b/doc/manual/html_node/Disclaimer.html
@@ -0,0 +1,89 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: Disclaimer</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: Disclaimer">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: Disclaimer">
+<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="Installation.html#Installation" rel="next" title="Installation">
+<link href="Overview.html#Overview" rel="prev" title="Overview">
+<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="Disclaimer"></a>
+<div class="header">
+<p>
+Next: <a href="Installation.html#Installation" accesskey="n" rel="next">Installation</a>, Previous: <a href="Overview.html#Overview" accesskey="p" rel="prev">Overview</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="Disclaimer-1"></a>
+<h2 class="chapter">2 Disclaimer</h2>
+
+<a name="index-disclaimer"></a>
+
+<ul>
+<li> LibreJS is not a security tool. Its goal is to detect nonfree nontrivial
+JavaScript, and it currently does not detect whether free or trivial
+code is malicious or not. Other free Mozilla extensions and add-ons may
+be available for this purpose.
+
+</li><li> LibreJS is always a work in progress. If you find a bug, please report
+it to <a href="mailto:bug-librejs@gnu.org">bug-librejs@gnu.org</a>.
+
+</li></ul>
+
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/Free-Licenses-Detection.html b/doc/manual/html_node/Free-Licenses-Detection.html
new file mode 100644
index 0000000..e2c8a3d
--- /dev/null
+++ b/doc/manual/html_node/Free-Licenses-Detection.html
@@ -0,0 +1,249 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: Free Licenses Detection</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: Free Licenses Detection">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: Free Licenses Detection">
+<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="Setting-Your-JavaScript-Free.html#Setting-Your-JavaScript-Free" rel="next" title="Setting Your JavaScript Free">
+<link href="JavaScript-Detection.html#JavaScript-Detection" rel="prev" title="JavaScript 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="Free-Licenses-Detection"></a>
+<div class="header">
+<p>
+Next: <a href="Setting-Your-JavaScript-Free.html#Setting-Your-JavaScript-Free" accesskey="n" rel="next">Setting Your JavaScript Free</a>, Previous: <a href="JavaScript-Detection.html#JavaScript-Detection" accesskey="p" rel="prev">JavaScript Detection</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="Free-Licenses-Detection-1"></a>
+<h2 class="chapter">6 Free Licenses Detection</h2>
+<a name="index-freelicenses"></a>
+
+<a name="Detected-Free-Licenses"></a>
+<h3 class="section">6.1 Detected Free Licenses</h3>
+
+<p>In order for a file to be detected as free, the license notice should
+appear in a JavaScript file above all code, at the very top of the file.
+</p>
+<p>For inline JavaScript code inside <code>&lt;script&gt;</code> tags in HTML pages,
+the license notice should appear once per page as a comment inside a
+<code>&lt;script&gt;</code> tag, before all the code in that script. When the only
+inline JavaScript code is within element attributes (<code>onload</code>,
+<code>onclick</code>), place the license notice in an otherwise empty
+<code>&lt;script&gt;</code> at the top of the page. This is sometimes needed when an
+external script performs AJAX calls or embeds scripts dynamically, and
+the only inline JavaScript is an event attribute making a method call,
+e.g.: <code>&lt;body onload=&quot;methodCall('remote-data.xml');&quot;&gt;</code>
+</p>
+<p>When people speak of the &ldquo;MIT license&rdquo; they mean either the X11 license
+or the Expat license. Please see which license the code uses, and label
+it accordingly.
+</p>
+<p>Currently LibreJS checks for the following licenses:
+</p>
+<ul>
+<li> Creative Commons CC0 1.0 Universal
+<ul>
+<li> Identifier: &lsquo;<samp>CC0-1.0</samp>&rsquo;
+</li><li> URL: <a href="http://creativecommons.org/publicdomain/zero/1.0/legalcode">http://creativecommons.org/publicdomain/zero/1.0/legalcode</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&amp;dn=cc0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Public Domain
+<ul>
+<li> Public domain is not a license (see
+<a href="https://www.gnu.org/licenses/license-list.html#PublicDomain">https://www.gnu.org/licenses/license-list.html#PublicDomain</a>). If
+you want to release your work to the public domain, the FSF recommends
+using CC0.
+</li><li> Magnet Link: &lsquo;<code>magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&amp;dn=public-domain.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU General Public License (GPL) version 2
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-GPL-2.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/gpl-2.0.html">http://www.gnu.org/licenses/gpl-2.0.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU General Public License (GPL) version 3
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-GPL-3.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/gpl-3.0.html">http://www.gnu.org/licenses/gpl-3.0.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Apache License, Version 2.0
+<ul>
+<li> Identifier: &lsquo;<samp>Apache-2.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&amp;dn=apache-2.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU Lesser General Public License, version 2.1
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-LGPL-2.1</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/lgpl-2.1.html">http://www.gnu.org/licenses/lgpl-2.1.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&amp;dn=lgpl-2.1.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU Lesser General Public License, version 3
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-LGPL-3.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/lgpl-3.0.html">http://www.gnu.org/licenses/lgpl-3.0.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&amp;dn=lgpl-3.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU Affero General Public License, version 3
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-AGPL-3.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/agpl-3.0.html">http://www.gnu.org/licenses/agpl-3.0.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&amp;dn=agpl-3.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Boost Software License
+<ul>
+<li> URL: <a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&amp;dn=Boost-1.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> BSD 3-Clause License
+<ul>
+<li> URL: <a href="http://opensource.org/licenses/BSD-3-Clause">http://opensource.org/licenses/BSD-3-Clause</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&amp;dn=bsd-3-clause.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Eclipse Public License 1.0
+<ul>
+<li> Identifier: &lsquo;<samp>EPL-1.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&amp;dn=epl-1.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Mozilla Public License 2.0
+<ul>
+<li> Identifier: &lsquo;<samp>MPL-2.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.mozilla.org/MPL/2.0">http://www.mozilla.org/MPL/2.0</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&amp;dn=mpl-2.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Expat License (sometimes called the MIT license)
+<ul>
+<li> Identifier: &lsquo;<samp>Expat</samp>&rsquo;
+</li><li> URL: <a href="http://www.jclark.com/xml/copying.txt">http://www.jclark.com/xml/copying.txt</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt</code>&rsquo;
+</li></ul>
+
+</li><li> X11 License
+<ul>
+<li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&amp;dn=x11.txt</code>&rsquo;
+</li></ul>
+
+</li><li> XFree86 License
+<ul>
+<li> Identifier: &lsquo;<samp>Modified-BSD</samp>&rsquo;
+</li><li> URLs:
+<a href="http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3">http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3</a>
+<a href="http://www.xfree86.org/current/LICENSE4.html">http://www.xfree86.org/current/LICENSE4.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&amp;dn=xfree86.txt</code>&rsquo;
+</li></ul>
+
+</li><li> FreeBSD License
+<ul>
+<li> URL: <a href="http://www.freebsd.org/copyright/freebsd-license.html">http://www.freebsd.org/copyright/freebsd-license.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&amp;dn=freebsd.txt</code>&rsquo;
+</li></ul>
+
+</li><li> The ISC License
+<ul>
+<li> URL: <a href="https://www.isc.org/downloads/software-support-policy/isc-license/">https://www.isc.org/downloads/software-support-policy/isc-license/</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&amp;dn=ISC.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Artistic License 2.0
+<ul>
+<li> URL: <a href="http://www.perlfoundation.org/artistic_license_2_0">http://www.perlfoundation.org/artistic_license_2_0</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&amp;dn=artistic-2.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> CPAL 1.0
+<ul>
+<li> Identifier: &lsquo;<samp>CPAL-1.0</samp>&rsquo;
+</li><li> URL: <a href="http://opensource.org/licenses/cpal_1.0">http://opensource.org/licenses/cpal_1.0</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&amp;dn=cpal-1.0.txt</code>&rsquo;
+</li></ul>
+
+</li></ul>
+
+<a name="Undetected-Free-Licenses"></a>
+<h3 class="section">6.2 Undetected Free Licenses</h3>
+<p>If you are using a free license that isn&rsquo;t detected by LibreJS and isn&rsquo;t
+listed in the previous section, please send a message to
+<a href="mailto:bug-librejs@gnu.org">bug-librejs@gnu.org</a> regarding this license, where code released under
+this license can be found, and where to find the license text and
+information.
+</p>
+<p>Many free licenses are listed in this page:
+<a href="http://www.gnu.org/licenses/license-list.html">http://www.gnu.org/licenses/license-list.html</a>
+</p>
+
+<hr>
+<div class="header">
+<p>
+Next: <a href="Setting-Your-JavaScript-Free.html#Setting-Your-JavaScript-Free" accesskey="n" rel="next">Setting Your JavaScript Free</a>, Previous: <a href="JavaScript-Detection.html#JavaScript-Detection" accesskey="p" rel="prev">JavaScript Detection</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/GNU-Free-Documentation-License.html b/doc/manual/html_node/GNU-Free-Documentation-License.html
new file mode 100644
index 0000000..dbb1d02
--- /dev/null
+++ b/doc/manual/html_node/GNU-Free-Documentation-License.html
@@ -0,0 +1,551 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: GNU Free Documentation License</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: GNU Free Documentation License">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: GNU Free Documentation License">
+<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="Tests.html#Tests" rel="prev" title="Tests">
+<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="GNU-Free-Documentation-License"></a>
+<div class="header">
+<p>
+Previous: <a href="Tests.html#Tests" accesskey="p" rel="prev">Tests</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="GNU-Free-Documentation-License-1"></a>
+<h2 class="appendix">Appendix D GNU Free Documentation License</h2>
+
+<div align="center">Version 1.3, 3 November 2008
+</div>
+
+<div class="display">
+<pre class="display">Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+<a href="http://fsf.org/">http://fsf.org/</a>
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+</pre></div>
+
+<ol>
+<li> PREAMBLE
+
+<p>The purpose of this License is to make a manual, textbook, or other
+functional and useful document <em>free</em> in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+</p>
+<p>This License is a kind of &ldquo;copyleft&rdquo;, which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+</p>
+<p>We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+</p>
+</li><li> APPLICABILITY AND DEFINITIONS
+
+<p>This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The &ldquo;Document&rdquo;, below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as &ldquo;you&rdquo;. You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+</p>
+<p>A &ldquo;Modified Version&rdquo; of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+</p>
+<p>A &ldquo;Secondary Section&rdquo; is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document&rsquo;s overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+</p>
+<p>The &ldquo;Invariant Sections&rdquo; are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+</p>
+<p>The &ldquo;Cover Texts&rdquo; are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+</p>
+<p>A &ldquo;Transparent&rdquo; copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not &ldquo;Transparent&rdquo; is called &ldquo;Opaque&rdquo;.
+</p>
+<p>Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input
+format, SGML or XML using a publicly available
+DTD, and standard-conforming simple HTML,
+PostScript or PDF designed for human modification. Examples
+of transparent image formats include PNG, XCF and
+JPG. Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, SGML or
+XML for which the DTD and/or processing tools are
+not generally available, and the machine-generated HTML,
+PostScript or PDF produced by some word processors for
+output purposes only.
+</p>
+<p>The &ldquo;Title Page&rdquo; means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, &ldquo;Title Page&rdquo; means
+the text near the most prominent appearance of the work&rsquo;s title,
+preceding the beginning of the body of the text.
+</p>
+<p>The &ldquo;publisher&rdquo; means any person or entity that distributes copies
+of the Document to the public.
+</p>
+<p>A section &ldquo;Entitled XYZ&rdquo; means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as &ldquo;Acknowledgements&rdquo;,
+&ldquo;Dedications&rdquo;, &ldquo;Endorsements&rdquo;, or &ldquo;History&rdquo;.) To &ldquo;Preserve the Title&rdquo;
+of such a section when you modify the Document means that it remains a
+section &ldquo;Entitled XYZ&rdquo; according to this definition.
+</p>
+<p>The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+</p>
+</li><li> VERBATIM COPYING
+
+<p>You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+</p>
+<p>You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+</p>
+</li><li> COPYING IN QUANTITY
+
+<p>If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document&rsquo;s license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+</p>
+<p>If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+</p>
+<p>If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+</p>
+<p>It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+</p>
+</li><li> MODIFICATIONS
+
+<p>You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+</p>
+<ol>
+<li> Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document). You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
+</li><li> List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
+</li><li> State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
+</li><li> Preserve all the copyright notices of the Document.
+
+</li><li> Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
+</li><li> Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
+</li><li> Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document&rsquo;s license notice.
+
+</li><li> Include an unaltered copy of this License.
+
+</li><li> Preserve the section Entitled &ldquo;History&rdquo;, Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page. If
+there is no section Entitled &ldquo;History&rdquo; in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
+</li><li> Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on. These may be placed in the &ldquo;History&rdquo; section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
+</li><li> For any section Entitled &ldquo;Acknowledgements&rdquo; or &ldquo;Dedications&rdquo;, Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
+</li><li> Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles. Section numbers
+or the equivalent are not considered part of the section titles.
+
+</li><li> Delete any section Entitled &ldquo;Endorsements&rdquo;. Such a section
+may not be included in the Modified Version.
+
+</li><li> Do not retitle any existing section to be Entitled &ldquo;Endorsements&rdquo; or
+to conflict in title with any Invariant Section.
+
+</li><li> Preserve any Warranty Disclaimers.
+</li></ol>
+
+<p>If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version&rsquo;s license notice.
+These titles must be distinct from any other section titles.
+</p>
+<p>You may add a section Entitled &ldquo;Endorsements&rdquo;, provided it contains
+nothing but endorsements of your Modified Version by various
+parties&mdash;for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+</p>
+<p>You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+</p>
+<p>The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+</p>
+</li><li> COMBINING DOCUMENTS
+
+<p>You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+</p>
+<p>The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+</p>
+<p>In the combination, you must combine any sections Entitled &ldquo;History&rdquo;
+in the various original documents, forming one section Entitled
+&ldquo;History&rdquo;; likewise combine any sections Entitled &ldquo;Acknowledgements&rdquo;,
+and any sections Entitled &ldquo;Dedications&rdquo;. You must delete all
+sections Entitled &ldquo;Endorsements.&rdquo;
+</p>
+</li><li> COLLECTIONS OF DOCUMENTS
+
+<p>You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+</p>
+<p>You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+</p>
+</li><li> AGGREGATION WITH INDEPENDENT WORKS
+
+<p>A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an &ldquo;aggregate&rdquo; if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation&rsquo;s users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+</p>
+<p>If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document&rsquo;s Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+</p>
+</li><li> TRANSLATION
+
+<p>Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+</p>
+<p>If a section in the Document is Entitled &ldquo;Acknowledgements&rdquo;,
+&ldquo;Dedications&rdquo;, or &ldquo;History&rdquo;, the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+</p>
+</li><li> TERMINATION
+
+<p>You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+</p>
+<p>However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+</p>
+<p>Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+</p>
+<p>Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
+</p>
+</li><li> FUTURE REVISIONS OF THIS LICENSE
+
+<p>The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+<a href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>.
+</p>
+<p>Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License &ldquo;or any later version&rdquo; applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation. If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy&rsquo;s public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+</p>
+</li><li> RELICENSING
+
+<p>&ldquo;Massive Multiauthor Collaboration Site&rdquo; (or &ldquo;MMC Site&rdquo;) means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works. A
+public wiki that anybody can edit is an example of such a server. A
+&ldquo;Massive Multiauthor Collaboration&rdquo; (or &ldquo;MMC&rdquo;) contained in the
+site means any set of copyrightable works thus published on the MMC
+site.
+</p>
+<p>&ldquo;CC-BY-SA&rdquo; means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+</p>
+<p>&ldquo;Incorporate&rdquo; means to publish or republish a Document, in whole or
+in part, as part of another Document.
+</p>
+<p>An MMC is &ldquo;eligible for relicensing&rdquo; if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole
+or in part into the MMC, (1) had no cover texts or invariant sections,
+and (2) were thus incorporated prior to November 1, 2008.
+</p>
+<p>The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+</p>
+</li></ol>
+
+<a name="ADDENDUM_003a-How-to-use-this-License-for-your-documents"></a>
+<h3 class="heading">ADDENDUM: How to use this License for your documents</h3>
+
+<p>To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+</p>
+<div class="smallexample">
+<pre class="smallexample"> Copyright (C) <var>year</var> <var>your name</var>.
+ 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, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+</pre></div>
+
+<p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the &ldquo;with&hellip;Texts.&rdquo; line with this:
+</p>
+<div class="smallexample">
+<pre class="smallexample"> with the Invariant Sections being <var>list their titles</var>, with
+ the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts
+ being <var>list</var>.
+</pre></div>
+
+<p>If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+</p>
+<p>If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+</p>
+
+
+
+<hr>
+<div class="header">
+<p>
+Previous: <a href="Tests.html#Tests" accesskey="p" rel="prev">Tests</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/How-to-Use.html b/doc/manual/html_node/How-to-Use.html
new file mode 100644
index 0000000..9050b2b
--- /dev/null
+++ b/doc/manual/html_node/How-to-Use.html
@@ -0,0 +1,160 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: How to Use</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: How to Use">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: How to Use">
+<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="JavaScript-Detection.html#JavaScript-Detection" rel="next" title="JavaScript Detection">
+<link href="Installation.html#Installation" rel="prev" title="Installation">
+<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="How-to-Use"></a>
+<div class="header">
+<p>
+Next: <a href="JavaScript-Detection.html#JavaScript-Detection" accesskey="n" rel="next">JavaScript Detection</a>, Previous: <a href="Installation.html#Installation" accesskey="p" rel="prev">Installation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="How-to-Use-1"></a>
+<h2 class="chapter">4 How to Use</h2>
+
+<a name="LibreJS-in-action"></a>
+<h3 class="section">4.1 LibreJS in action</h3>
+
+<p>After installing the add-on, you will see the LibreJS widget in the
+add-on bar at the bottom of the browser window. After loading a page,
+left-click on the widget to view the deactivated JavaScript code from
+the page (both on page and external) and, if applicable, the scripts
+that were accepted.
+</p>
+<a name="Complaint-Feature"></a>
+<h3 class="section">4.2 Complaint Feature</h3>
+
+<p>It is very important to complain when a site has nonfree JavaScript
+code, especially if it won&rsquo;t work without that code. LibreJS makes it
+easy to complain by heuristically finding where to send the complaint.
+</p>
+<p>When nonfree/nontrivial code is detected in a page, LibreJS attempts to
+find a relevant contact link or email for the website you are
+visiting. In order to do so, it will attempt to visit a few links from
+the current page (for instance, a link labeled &ldquo;contact&rdquo; on the same
+domain as the current page, &hellip;)
+</p>
+<p>LibreJS detects contact pages, email addresses that are likely to be
+owned by the maintainer of the site, Twitter and identi.ca links, and
+phone numbers.
+</p>
+<p>After LibreJS detects any of the above, a &ldquo;Complain&rdquo; tab will appear
+on the right of your web browser. When you click on this tab, a large
+panel will appear with contact information. Ideally, at the top you will
+find the email address of the maintainer, labeled as the &ldquo;Email you
+should use&rdquo;.
+</p>
+<p>When you complain to the website for their nonfree nontrivial
+JavaScript, provide them with the link to the JavaScript Trap essay so
+that they can get more information on what the issue is and how they can
+solve it on their own site.
+</p>
+<p>LibreJS includes a default subject line and body for the complaint email,
+with a link to the JavaScript Trap essay. This can be configured in the
+LibreJS add-on preferences in your web browser.
+</p>
+
+<a name="Options"></a>
+<h3 class="section">4.3 Options</h3>
+
+<dl compact="compact">
+<dt><em>Whitelist</em></dt>
+<dd><p>LibreJS lets you whitelist domain names and subdomains to bypass the
+regular JavaScript check. This might be useful, for example, if you are
+running your own code in a local web server. In order to add a
+whitelisted domain or url, go to Tools &gt;&gt; Add-ons, or press <kbd>Control
++ Shift + A</kbd>. Inside the add-on window, click on <em>Extensions</em>, and in
+the list, where you see LibreJS, click on the <em>Preferences</em> button.
+You will see an input field labeled <em>Whitelist</em>. In the field,
+enter comma-separated domain names. Do not enter the protocol. For
+instance to whitelist all the pages of <a href="http://www.gnu.org">http://www.gnu.org</a> and
+<a href="https://gnu.org">https://gnu.org</a>, enter &lsquo;<samp>gnu.org</samp>&rsquo;. To allow all subdomains from
+gnu.org, enter: &lsquo;<samp>*.gnu.org</samp>&rsquo;. This will match such sites as
+<a href="http://savannah.gnu.org">http://savannah.gnu.org</a> and <a href="http://audio-video.gnu.org">http://audio-video.gnu.org</a>.
+</p>
+</dd>
+<dt><em>Complaint tab</em></dt>
+<dd><p>This specifies whether the complaint tab appears when a site is running
+nonfree JavaScript.
+</p>
+</dd>
+<dt><em>Display notifications of JavaScript analysis</em></dt>
+<dd><p>This option enables an info bar of realtime JavaScript analysis.
+</p>
+</dd>
+<dt><em>Complaint email subject</em></dt>
+<dd><p>Configure the default subject used in complaint emails.
+</p>
+</dd>
+<dt><em>Complaint email body</em></dt>
+<dd><p>Configure the default body used in complaint emails.
+</p></dd>
+</dl>
+
+<hr>
+<div class="header">
+<p>
+Next: <a href="JavaScript-Detection.html#JavaScript-Detection" accesskey="n" rel="next">JavaScript Detection</a>, Previous: <a href="Installation.html#Installation" accesskey="p" rel="prev">Installation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/Installation-Requirements.html b/doc/manual/html_node/Installation-Requirements.html
new file mode 100644
index 0000000..d9eb038
--- /dev/null
+++ b/doc/manual/html_node/Installation-Requirements.html
@@ -0,0 +1,132 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: Installation Requirements</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: Installation Requirements">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: Installation Requirements">
+<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-Internals.html#LibreJS-Internals" rel="next" title="LibreJS Internals">
+<link href="Setting-Your-JavaScript-Free.html#Setting-Your-JavaScript-Free" rel="prev" title="Setting Your JavaScript Free">
+<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="Installation-Requirements"></a>
+<div class="header">
+<p>
+Next: <a href="LibreJS-Internals.html#LibreJS-Internals" accesskey="n" rel="next">LibreJS Internals</a>, Previous: <a href="Setting-Your-JavaScript-Free.html#Setting-Your-JavaScript-Free" accesskey="p" rel="prev">Setting Your JavaScript Free</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="Installation-Requirements-1"></a>
+<h2 class="appendix">Appendix A Installation Requirements</h2>
+
+
+<a name="Mozilla-Browser"></a>
+<h3 class="appendixsec">A.1 Mozilla Browser</h3>
+
+<p>You will need one of the many flavors of the Mozilla browser to use
+LibreJS. It can be installed on the following:
+</p>
+<p>GNU IceCat, Mozilla Firefox, Trisquel Abrowser, Debian Iceweasel.
+</p>
+<p>LibreJS works on these browsers starting from version 29. We
+recommend that you use the latest version of your Mozilla browser.
+LibreJS has been tested extensively on multiple GNU/Linux distributions,
+but it is compatible any operating system as long as you&rsquo;re using a
+compatible Mozilla browser.
+</p>
+<a name="Mozilla_0027s-Add_002don-SDK"></a>
+<h3 class="appendixsec">A.2 Mozilla&rsquo;s Add-on SDK</h3>
+<p>LibreJS uses the Mozilla Add-on SDK (Software Development Kit), a
+set of APIs and tools to create add-ons for Mozilla browsers.
+</p>
+<p>You do not need the Add-on SDK to use LibreJS xpi file or to install it
+using the packaged version, but it is required in order to package the
+LibreJS source code into an xpi file using <code>make</code>. If you would like
+to run the tests for LibreJS or make changes to the source files, you
+will need the Add-on SDK as well. For the &ldquo;make&rdquo; command to work
+properly, you must have the <code>cfx</code> command available on your system
+from the command line.
+</p>
+<p>The latest tarball for the Add-on SDK is available at:
+</p>
+<p><a href="https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/jetpack-sdk-latest.tar.gz">https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/jetpack-sdk-latest.tar.gz</a>
+</p>
+<p>Instructions on how to get it working are available here:
+</p>
+<p><a href="https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/installation.html">https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/installation.html</a>
+</p>
+<p>In order to use <code>make</code> with LibreJS source, however, it is ideal to
+have <code>cfx</code> available at all times and for all users.
+</p>
+<p>An easy way to do this is to extract the contents of the tarball and to
+place the files inside <samp>/usr/lib/addon-sdk</samp> and then creating a
+symbolic link in <samp>/usr/bin</samp>, as follows:
+</p>
+<div class="example">
+<pre class="example">sudo ln -s /usr/lib/addon-sdk/bin/cfx /usr/bin/cfx
+</pre></div>
+
+<p>The <code>cfx</code> command will then be available to all users.
+</p>
+<p>The Add-on SDK is released under the Mozilla Public License 2.0.
+</p>
+<hr>
+<div class="header">
+<p>
+Next: <a href="LibreJS-Internals.html#LibreJS-Internals" accesskey="n" rel="next">LibreJS Internals</a>, Previous: <a href="Setting-Your-JavaScript-Free.html#Setting-Your-JavaScript-Free" accesskey="p" rel="prev">Setting Your JavaScript Free</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/Installation.html b/doc/manual/html_node/Installation.html
new file mode 100644
index 0000000..b6a309a
--- /dev/null
+++ b/doc/manual/html_node/Installation.html
@@ -0,0 +1,105 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: Installation</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: Installation">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: Installation">
+<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="How-to-Use.html#How-to-Use" rel="next" title="How to Use">
+<link href="Disclaimer.html#Disclaimer" rel="prev" title="Disclaimer">
+<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="Installation"></a>
+<div class="header">
+<p>
+Next: <a href="How-to-Use.html#How-to-Use" accesskey="n" rel="next">How to Use</a>, Previous: <a href="Disclaimer.html#Disclaimer" accesskey="p" rel="prev">Disclaimer</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="Installation-1"></a>
+<h2 class="chapter">3 Installation</h2>
+<a name="index-Installation"></a>
+
+<p>You can install LibreJS directly using a generated <samp>librejs.xpi</samp>
+file, or by building it from source.
+</p>
+
+<a name="Building-the-Package"></a>
+<h3 class="section">3.1 Building the Package</h3>
+<p>After enabling the Add-on SDK, you should be able to use the <code>make</code>
+command to build LibreJS from source.
+</p>
+<p>After running <code>make</code>, a new file, <samp>librejs.xpi</samp> should be
+generated. This is the file that can be installed in a Mozilla browser.
+</p>
+<a name="Installing-LibreJS"></a>
+<h3 class="section">3.2 Installing LibreJS</h3>
+<p>To install the add-on for all users, run:
+</p><div class="example">
+<pre class="example">sudo make install
+</pre></div>
+
+<p>or as root:
+</p><div class="example">
+<pre class="example">make install
+</pre></div>
+
+<p>Next time you open a Mozilla-browser as a user of your system, you
+should be notified that a new add-on (in this case, LibreJS) as been
+installed and whether to allow it to run or not.
+</p>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/JavaScript-Detection.html b/doc/manual/html_node/JavaScript-Detection.html
new file mode 100644
index 0000000..1ce0f95
--- /dev/null
+++ b/doc/manual/html_node/JavaScript-Detection.html
@@ -0,0 +1,165 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: JavaScript Detection</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: JavaScript Detection">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: JavaScript Detection">
+<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="Free-Licenses-Detection.html#Free-Licenses-Detection" rel="next" title="Free Licenses Detection">
+<link href="How-to-Use.html#How-to-Use" rel="prev" title="How to Use">
+<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="JavaScript-Detection"></a>
+<div class="header">
+<p>
+Next: <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="n" rel="next">Free Licenses Detection</a>, Previous: <a href="How-to-Use.html#How-to-Use" accesskey="p" rel="prev">How to Use</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="JavaScript-Detection-1"></a>
+<h2 class="chapter">5 JavaScript Detection</h2>
+<a name="index-javascript"></a>
+
+<ul>
+<li>LibreJS considers JavaScript on a page nontrivial if any of the
+following are true:
+
+</li><li> It makes an AJAX request or is loaded along with scripts that make
+an AJAX request,
+
+</li><li> It loads external scripts dynamically or is loaded along with
+scripts that do,
+
+</li><li> It defines functions or methods and either loads an external script
+(from HTML) or is loaded as one,
+
+</li><li> It uses dynamic JavaScript constructs that are difficult to analyze
+without interpreting the program or is loaded along with scripts
+that use such constructs. These constructs are:
+<ul>
+<li> Using the eval function
+</li><li> Calling methods with the square bracket notation
+</li><li> Using any other construct than a string literal with certain methods
+(<code>Obj.write</code>, <code>Obj.createElement</code>, &hellip;).
+</li></ul>
+</li></ul>
+
+<p>In practice, the JavaScript code in your page may be found trivial by
+LibreJS if, as a whole:
+</p><ul>
+<li> It does not define functions and it does not load external scripts
+(with the HTML src attribute in a <code>&lt;script&gt;</code> tag).
+
+</li><li> It does not make AJAX calls.
+
+</li><li> It does not load external scripts with dynamic constructs.
+
+</li><li> It does not use constructs that may be used to do any of the above in
+a non-obvious way (use of the <code>eval()</code> method, use of square bracket
+method calls, use of concatenation with certain constructs or method
+calls, &hellip;).
+
+</li></ul>
+
+<p>However, in some instances, you may be required by LibreJS to add a
+stylized comment to JavaScript code that may be otherwise trivial.
+</p>
+<p>When an external file defines a function, it becomes available
+to all other external scripts. That is the case if another script
+defines a function that makes AJAX calls, when an external script
+loads other scripts dynamically (which in turn could also make AJAX
+calls, &hellip;), or when a script is written with constructs that may do
+any of these.
+</p>
+<p>For instance, if your page contains the following:
+</p><div class="example">
+<pre class="example">&lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+$.doSomething();
+&lt;/script&gt;
+</pre></div>
+
+<p>While <code>$.doSomething();</code> may seem trivial, you will nevertheless
+have to add a stylized license comment on your main HTML page because
+the external script (in this case jQuery) has been found to define
+methods that make AJAX calls. <code>$.doSomething()</code> might make an AJAX call,
+and LibreJS does not check for that. The rule of thumb is that when you
+use a library or code that handles AJAX, JSON, JSONP, the loading of
+scripts dynamically, you should have license mentions for all your
+JavaScript files and for your main page regardless. In practice this is
+a case that happens very often with code that uses libraries.
+</p>
+<p>In practice also, the JavaScript code in an external file (an external
+<samp>.js</samp> file loaded on your page) may be found trivial if it does not
+define functions/methods.
+</p>
+<p>And in the same manner it will be considered nontrivial if AJAX calls,
+dynamic script loading, or non-obvious dynamic JavaScript constructs
+are used in another script.
+</p>
+<p>If your JavaScript code makes AJAX requests, it&rsquo;s important to get an
+accurate <em>Content-Type</em> in the response from the server. For
+example, if you&rsquo;re using JSON, set it to <code>application/json</code>.
+This is because LibreJS alters the content of <code>text/html</code>
+responses.
+</p>
+<hr>
+<div class="header">
+<p>
+Next: <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="n" rel="next">Free Licenses Detection</a>, Previous: <a href="How-to-Use.html#How-to-Use" accesskey="p" rel="prev">How to Use</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/LibreJS-Internals.html b/doc/manual/html_node/LibreJS-Internals.html
new file mode 100644
index 0000000..9a12390
--- /dev/null
+++ b/doc/manual/html_node/LibreJS-Internals.html
@@ -0,0 +1,94 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: LibreJS Internals</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: LibreJS Internals">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: LibreJS Internals">
+<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="Tests.html#Tests" rel="next" title="Tests">
+<link href="Installation-Requirements.html#Installation-Requirements" rel="prev" title="Installation Requirements">
+<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="LibreJS-Internals"></a>
+<div class="header">
+<p>
+Next: <a href="Tests.html#Tests" accesskey="n" rel="next">Tests</a>, Previous: <a href="Installation-Requirements.html#Installation-Requirements" accesskey="p" rel="prev">Installation Requirements</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="LibreJS-Internals-1"></a>
+<h2 class="appendix">Appendix B LibreJS Internals</h2>
+
+<p>LibreJS intercepts HTTP responses and rewrites their contents after
+analyzing JavaScript within them. It does not remove script nodes and
+attributes from the page, but instead &ldquo;deactivates&rdquo; them by modifying
+the <code>type</code> and <code>src</code> attributes on script elements and by
+moving the contents of inline JavaScript attributes such as onClick
+into harmless attributes.
+</p>
+<p>LibreJS detects the most common cases using the HTTP response method
+described above, but in extremely rare cases, or when running code
+locally, LibreJS cannot detect JavaScript during the response stage.
+</p>
+<p>To remedy this issue, and as a final safeguard, LibreJS takes a look
+at the scripts that are about to be executed while the browser engine is
+parsing the page. If the script is not found in a list of accepted
+scripts populated earlier, the execution will be prevented. This is to
+ensure content types that are not regular HTML (binhex with HTML in it,
+&hellip;) and JavaScript do not fall through the cracks and get executed.
+</p>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/Overview.html b/doc/manual/html_node/Overview.html
new file mode 100644
index 0000000..b885eb0
--- /dev/null
+++ b/doc/manual/html_node/Overview.html
@@ -0,0 +1,93 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: Overview</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: Overview">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: Overview">
+<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="Disclaimer.html#Disclaimer" rel="next" title="Disclaimer">
+<link href="index.html#Top" rel="prev" title="Top">
+<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="Overview"></a>
+<div class="header">
+<p>
+Next: <a href="Disclaimer.html#Disclaimer" accesskey="n" rel="next">Disclaimer</a>, Previous: <a href="index.html#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="Overview-1"></a>
+<h2 class="chapter">1 Overview</h2>
+
+<a name="index-overview"></a>
+<p>GNU LibreJS &mdash;an add-on for GNU IceCat and Mozilla Firefox&mdash; detects
+and blocks nonfree nontrivial JavaScript while allowing its execution on
+pages containing code that is either trivial and/or free.
+</p>
+<p>Many websites run nontrivial JavaScript on your computer. Some use it
+for complex tasks; many use it gratuitously for minor jobs that could be
+done easily with plain HTML. Sometimes this JavaScript code is
+malicious. Either way, the JavaScript code is often nonfree. For
+explanation of the issue, see &quot;The JavaScript
+Trap&quot;(<a href="http://www.gnu.org/philosophy/javascript-trap.html">http://www.gnu.org/philosophy/javascript-trap.html</a>).
+</p>
+<p>If you care about freedom in your computing, and don&rsquo;t wish to let all
+and sundry make you run nonfree programs, now you can prevent it by
+using LibreJS.
+</p>
+
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/Setting-Your-JavaScript-Free.html b/doc/manual/html_node/Setting-Your-JavaScript-Free.html
new file mode 100644
index 0000000..9f25717
--- /dev/null
+++ b/doc/manual/html_node/Setting-Your-JavaScript-Free.html
@@ -0,0 +1,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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: Setting Your JavaScript Free</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: Setting Your JavaScript Free">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: 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="Installation-Requirements.html#Installation-Requirements" rel="next" title="Installation Requirements">
+<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="Installation-Requirements.html#Installation-Requirements" accesskey="n" rel="next">Installation Requirements</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> &nbsp; [<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&rsquo;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>&lt;head&gt;</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&rsquo;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&rsquo;t need to look any further.
+But if there&rsquo;s no mention of the license, or if it&rsquo;s too brief, you&rsquo;ll
+have to look for a COPYING or LICENSE file within the original library&rsquo;s
+source package, or on the library&rsquo;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&rsquo;re using a third-party service such as an analytics service,
+replace it with a free alternative like Piwik.
+
+</li><li> If you can&rsquo;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&rsquo;s linked to from your main page. The table lists each of your
+site&rsquo;s JavaScript files, that file&rsquo;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&rsquo;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&rsquo;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">&lt;table id=&quot;jslicense-labels1&quot;&gt;
+ &lt;tr&gt;
+ &lt;td&gt;&lt;a href=&quot;all.min.js&quot;&gt;all.min.js&lt;/a&gt;&lt;/td&gt;
+ &lt;td&gt;
+ &lt;a href=&quot;http://www.gnu.org/licenses/gpl-3.0.html&quot;
+ &gt;GNU-GPL-3.0-or-later&lt;/a&gt;
+ &lt;br /&gt;
+ &lt;a href=&quot;http://www.apache.org/licenses/LICENSE-2.0&quot;
+ &gt;Apache-2.0&lt;/a&gt;
+ &lt;/td&gt;
+ &lt;td&gt;
+ &lt;a href=&quot;gpl-script.js&quot;&gt;gpl-script.js&lt;/a&gt;
+ &lt;br /&gt;
+ &lt;a href=&quot;apache-script.js&quot;&gt;apache-script.js&lt;/a&gt;
+ &lt;/td&gt;
+ &lt;/tr&gt;
+&lt;/table&gt;
+</pre>
+<p>The <code>&lt;br /&gt;</code> tags just make the table more understandable when
+looking at the rendered version of it on the license page. They aren&rsquo;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 &ldquo;Convention for releasing free JavaScript programs&rdquo; 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>&lt;script&gt;</code> tags with on-page code and the inline
+JavaScript (in event attributes such as onload, onclick, etc, &hellip;).
+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>&lt;script&gt;</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="Installation-Requirements.html#Installation-Requirements" accesskey="n" rel="next">Installation Requirements</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> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/Tests.html b/doc/manual/html_node/Tests.html
new file mode 100644
index 0000000..2e0e5d8
--- /dev/null
+++ b/doc/manual/html_node/Tests.html
@@ -0,0 +1,160 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: Tests</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: Tests">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: Tests">
+<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="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" rel="next" title="GNU Free Documentation License">
+<link href="LibreJS-Internals.html#LibreJS-Internals" rel="prev" title="LibreJS Internals">
+<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="Tests"></a>
+<div class="header">
+<p>
+Next: <a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" accesskey="n" rel="next">GNU Free Documentation License</a>, Previous: <a href="LibreJS-Internals.html#LibreJS-Internals" accesskey="p" rel="prev">LibreJS Internals</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="Tests-1"></a>
+<h2 class="appendix">Appendix C Tests</h2>
+
+
+<p>In order to better understand how LibreJS works, you can try to visit
+these pages with LibreJS installed and enabled and see how they are
+being processed:
+</p>
+<ul>
+<li> <a href="http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/">http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/</a>
+This page contains trivial on-page JavaScript code, and an external
+script that contains trivial JavaScript code. Therefore, all JavaScript
+is being executed.
+
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/">http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/</a>
+The on-page script here is trivial and uses a built-in method, but the
+external script in this page is nontrivial (defines a function.) The
+external script is blocked, the inline script is executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/">http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/</a>
+This page contains nontrivial code on page, and trivial code in its
+external page. All JavaScript is <em>removed</em> from the page, and the
+external script is never analyzed, since the nontrivial conditions are
+already met in the page.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/free-inline-free-external/">http://lduros.net/assets/librejs/tests/free-inline-free-external/</a>
+This page contains free on-page (GPL 3) JavaScript, and free external
+Javascript. Therefore all JavaScript is being executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/">http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/</a>
+This page contains free on-page JavaScript. The external script contains
+nonfree nontrivial JavaScript (AJAX request). The free code that is
+inline is executed, but the external file is blocked.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/intrinsec-event/">http://lduros.net/assets/librejs/tests/intrinsec-event/</a> This page
+contains trivial on-page code, with an intrinsic event in an html
+attribute (onload). All JavaScript is being executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/">http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/</a>
+This page contains on-page trivial JavaScript (only makes a window alert
+and loads an external script using the html &lt;script&gt; tag with the src
+attribute. The external script is free (GPL v3), and since it is only
+nontrivial because it defines a function, the on-page trivial code is
+allowed to use it. All JavaScript is being executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/">http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/</a>
+This page contains trivial on-page JavaScript code, and loads an
+external script that is free. Since no function is defined, the external
+script is being analyzed. The external script is free. Trivial here is
+not allowed because the external script, although free, writes a
+script. The inline trivial script should also have a free license notice
+for it to be interpreted.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html">http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html</a>
+This is a real-life example of a small jQuery plugin. The on-page
+JavaScript code has a free license. The jQuery external file has a free
+licensed. The shelltypist.js file has a free license as well. All
+licenses are defined between <code>@licstart</code> and <code>@licend</code>. All
+JavaScript is executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html">http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html</a>
+This is the same page than the previous example, except it does not have
+a free license for the main HTML page on-page script. While the actual
+code there is trivial, since jQuery defines methods that make use of
+AJAX, trivial code is not allowed, and no JavaScript is executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/test-labels/">http://lduros.net/assets/librejs/tests/test-labels/</a> This page
+contains JavaScript (jQuery minified) that does not have proper license
+information in the file, as it has no <code>@licstart</code> <code>@licend</code>
+comment. It would be considered nonfree, however, the page itself uses
+the JavaScript Web Labels method. On the page itself, you will find a
+link labeled &ldquo;JavaScript License Information&rdquo;, which leads to a page
+that contains a properly formatted table with the required data on the
+external JavaScript file. LibreJS visits this link and determines the
+version of jQuery linked from the original page is the one listed there,
+and flags it as free. All JavaScript is executed (and the title should
+turn green.)
+
+</li></ul>
+
+
+<hr>
+<div class="header">
+<p>
+Next: <a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" accesskey="n" rel="next">GNU Free Documentation License</a>, Previous: <a href="LibreJS-Internals.html#LibreJS-Internals" accesskey="p" rel="prev">LibreJS Internals</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/html_node/index.html b/doc/manual/html_node/index.html
new file mode 100644
index 0000000..1cae84a
--- /dev/null
+++ b/doc/manual/html_node/index.html
@@ -0,0 +1,159 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117: Top</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117: Top">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117: Top">
+<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="#Top" rel="start" title="Top">
+<link href="#SEC_Contents" rel="contents" title="Table of Contents">
+<link href="../dir/index.html" rel="up" title="(dir)">
+<link href="Overview.html#Overview" rel="next" title="Overview">
+<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">
+<h1 class="settitle" align="center">GNU LibreJS 6.0.8.20150117</h1>
+
+
+
+
+
+<a name="SEC_Contents"></a>
+<h2 class="contents-heading">Table of Contents</h2>
+
+<div class="contents">
+
+<ul class="no-bullet">
+ <li><a name="toc-Overview-1" href="Overview.html#Overview">1 Overview</a></li>
+ <li><a name="toc-Disclaimer-1" href="Disclaimer.html#Disclaimer">2 Disclaimer</a></li>
+ <li><a name="toc-Installation-1" href="Installation.html#Installation">3 Installation</a>
+ <ul class="no-bullet">
+ <li><a name="toc-Building-the-Package" href="Installation.html#Building-the-Package">3.1 Building the Package</a></li>
+ <li><a name="toc-Installing-LibreJS" href="Installation.html#Installing-LibreJS">3.2 Installing LibreJS</a></li>
+ </ul></li>
+ <li><a name="toc-How-to-Use-1" href="How-to-Use.html#How-to-Use">4 How to Use</a>
+ <ul class="no-bullet">
+ <li><a name="toc-LibreJS-in-action" href="How-to-Use.html#LibreJS-in-action">4.1 LibreJS in action</a></li>
+ <li><a name="toc-Complaint-Feature" href="How-to-Use.html#Complaint-Feature">4.2 Complaint Feature</a></li>
+ <li><a name="toc-Options" href="How-to-Use.html#Options">4.3 Options</a></li>
+ </ul></li>
+ <li><a name="toc-JavaScript-Detection-1" href="JavaScript-Detection.html#JavaScript-Detection">5 JavaScript Detection</a></li>
+ <li><a name="toc-Free-Licenses-Detection-1" href="Free-Licenses-Detection.html#Free-Licenses-Detection">6 Free Licenses Detection</a>
+ <ul class="no-bullet">
+ <li><a name="toc-Detected-Free-Licenses" href="Free-Licenses-Detection.html#Detected-Free-Licenses">6.1 Detected Free Licenses</a></li>
+ <li><a name="toc-Undetected-Free-Licenses" href="Free-Licenses-Detection.html#Undetected-Free-Licenses">6.2 Undetected Free Licenses</a></li>
+ </ul></li>
+ <li><a name="toc-Setting-Your-JavaScript-Free-1" href="Setting-Your-JavaScript-Free.html#Setting-Your-JavaScript-Free">7 Setting Your JavaScript Free</a>
+ <ul class="no-bullet">
+ <li><a name="toc-JavaScript-Web-Labels" href="Setting-Your-JavaScript-Free.html#JavaScript-Web-Labels">7.1 JavaScript Web Labels</a>
+ <ul class="no-bullet">
+ <li><a name="toc-Specifying-multiple-licenses-for-a-single-JavaScript-file" href="Setting-Your-JavaScript-Free.html#Specifying-multiple-licenses-for-a-single-JavaScript-file">7.1.1 Specifying multiple licenses for a single JavaScript file</a></li>
+ </ul></li>
+ <li><a name="toc-Adding-a-stylized-comment-in-your-JavaScript-files-and-on-your-page" href="Setting-Your-JavaScript-Free.html#Adding-a-stylized-comment-in-your-JavaScript-files-and-on-your-page">7.2 Adding a stylized comment in your JavaScript files and on your page</a></li>
+ </ul></li>
+</li>
+ <li><a name="toc-Installation-Requirements-1" href="Installation-Requirements.html#Installation-Requirements">Appendix A Installation Requirements</a>
+ <ul class="no-bullet">
+ <li><a name="toc-Mozilla-Browser" href="Installation-Requirements.html#Mozilla-Browser">A.1 Mozilla Browser</a></li>
+ <li><a name="toc-Mozilla_0027s-Add_002don-SDK" href="Installation-Requirements.html#Mozilla_0027s-Add_002don-SDK">A.2 Mozilla&rsquo;s Add-on SDK</a></li>
+ </ul></li>
+ <li><a name="toc-LibreJS-Internals-1" href="LibreJS-Internals.html#LibreJS-Internals">Appendix B LibreJS Internals</a></li>
+ <li><a name="toc-Tests-1" href="Tests.html#Tests">Appendix C Tests</a></li>
+ <li><a name="toc-GNU-Free-Documentation-License-1" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">Appendix D GNU Free Documentation License</a></li>
+</ul>
+</div>
+
+
+
+<a name="Top"></a>
+<div class="header">
+<p>
+Next: <a href="Overview.html#Overview" accesskey="n" rel="next">Overview</a>, Up: <a href="../dir/index.html" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<hr>
+<a name="LibreJS"></a>
+<h1 class="top">LibreJS</h1>
+<p>This manual is for GNU LibreJS (version 6.0.8.20150117, 17 January 2015).
+</p>
+<table class="menu" border="0" cellspacing="0">
+<tr><td align="left" valign="top">&bull; <a href="Overview.html#Overview" accesskey="1">Overview</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">General purpose and information.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="Disclaimer.html#Disclaimer" accesskey="2">Disclaimer</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Emphasize what LibreJS does and does not.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="Installation.html#Installation" accesskey="3">Installation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Installing LibreJS from source.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="How-to-Use.html#How-to-Use" accesskey="4">How to Use</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to use LibreJS in IceCat.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="JavaScript-Detection.html#JavaScript-Detection" accesskey="5">JavaScript Detection</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How LibreJS detects nontrivial Javascript.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="6">Free Licenses Detection</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">List of licenses detected by LibreJS.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="Setting-Your-JavaScript-Free.html#Setting-Your-JavaScript-Free" accesskey="7">Setting Your JavaScript Free</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Information for website owners/maintainers.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="Installation-Requirements.html#Installation-Requirements" accesskey="8">Installation Requirements</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Requirements to build and install LibreJS.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="LibreJS-Internals.html#LibreJS-Internals" accesskey="9">LibreJS Internals</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How LibreJS works under the hood.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="Tests.html#Tests">Tests</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Test LibreJS and better understand it.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">GNU Free Documentation License</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copying and sharing this documentation.
+</td></tr>
+</table>
+
+<hr>
+<div class="header">
+<p>
+Next: <a href="Overview.html#Overview" accesskey="n" rel="next">Overview</a>, Up: <a href="../dir/index.html" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/index.html b/doc/manual/index.html
new file mode 100644
index 0000000..f14f4c0
--- /dev/null
+++ b/doc/manual/index.html
@@ -0,0 +1,73 @@
+<!--#include virtual="/server/header.html" -->
+<!-- Parent-Version: 1.77 -->
+<title>GNU LibreJS Manual - GNU Project - Free Software Foundation</title>
+<!--#include virtual="/server/banner.html" -->
+<h2>GNU LibreJS Manual</h2>
+
+<address>Free Software Foundation</address>
+<address>last updated January 17, 2015</address>
+
+<p>This manual (librejs) is available in the following formats:</p>
+
+<ul>
+<li><a href="librejs.html">HTML
+ (72K bytes)</a> - entirely on one web page.</li>
+<li><a href="html_node/index.html">HTML</a> - with one web page per
+ node.</li>
+<li><a href="librejs.html.gz">HTML compressed
+ (24K gzipped characters)</a> - entirely on
+ one web page.</li>
+<li><a href="librejs.html_node.tar.gz">HTML compressed
+ (24K gzipped tar file)</a> -
+ with one web page per node.</li>
+<li><a href="librejs.info.tar.gz">Info document
+ (20K bytes gzipped tar file)</a>.</li>
+<li><a href="librejs.txt">ASCII text
+ (56K bytes)</a>.</li>
+<li><a href="librejs.txt.gz">ASCII text compressed
+ (20K bytes gzipped)</a>.</li>
+<li><a href="librejs.dvi.gz">TeX dvi file
+ (32K bytes gzipped)</a>.</li>
+<li><a href="librejs.pdf">PDF file
+ (200K bytes)</a>.</li>
+<li><a href="librejs.texi.tar.gz">Texinfo source
+ (20K bytes gzipped tar file).</a></li>
+</ul>
+
+<p>You can <a href="http://shop.fsf.org/">buy printed copies of
+some manuals</a> (among other items) from the Free Software Foundation;
+this helps support FSF activities.</p>
+
+<p>(This page generated by the <a href="http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh">gendocs.sh
+script</a>.)</p>
+
+<!-- If needed, change the copyright block at the bottom. In general,
+ all pages on the GNU web server should have the section about
+ verbatim copying. Please do NOT remove this without talking
+ with the webmasters first.
+ Please make sure the copyright date is consistent with the document
+ and that it is like this: "2001, 2002", not this: "2001-2002". -->
+</div><!-- for id="content", starts in the include above -->
+<!--#include virtual="/server/footer.html" -->
+<div id="footer">
+<div class="unprintable">
+
+<p>Please send general FSF &amp; GNU inquiries to
+<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
+There are also <a href="/contact/">other ways to contact</a>
+the FSF. Broken links and other corrections or suggestions can be sent
+to <a href="mailto:bug-librejs@gnu.org">&lt;bug-librejs@gnu.org&gt;</a>.</p>
+</div>
+
+<p>Copyright &copy; 2015 Free Software Foundation, Inc.</p>
+
+<p>This page is licensed under a <a rel="license"
+href="http://creativecommons.org/licenses/by-nd/3.0/us/">Creative
+Commons Attribution-NoDerivs 3.0 United States License</a>.</p>
+
+<!--#include virtual="/server/bottom-notes.html" -->
+
+</div>
+</div>
+</body>
+</html>
diff --git a/doc/manual/librejs.dvi.gz b/doc/manual/librejs.dvi.gz
new file mode 100644
index 0000000..2d69452
--- /dev/null
+++ b/doc/manual/librejs.dvi.gz
Binary files differ
diff --git a/doc/manual/librejs.html b/doc/manual/librejs.html
new file mode 100644
index 0000000..1520868
--- /dev/null
+++ b/doc/manual/librejs.html
@@ -0,0 +1,1419 @@
+<!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.8.20150117, 17 January 2015),
+a GNU IceCat extension to detect and block nonfree nontrivial
+JavaScript on webpages.
+
+Copyright (C) 2011 2012 2014 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.8.20150117</title>
+
+<meta name="description" content="GNU LibreJS 6.0.8.20150117">
+<meta name="keywords" content="GNU LibreJS 6.0.8.20150117">
+<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="#Top" rel="start" title="Top">
+<link href="#SEC_Contents" rel="contents" title="Table of Contents">
+<link href="dir.html#Top" rel="up" title="(dir)">
+<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">
+<h1 class="settitle" align="center">GNU LibreJS 6.0.8.20150117</h1>
+
+
+
+
+
+<a name="SEC_Contents"></a>
+<h2 class="contents-heading">Table of Contents</h2>
+
+<div class="contents">
+
+<ul class="no-bullet">
+ <li><a name="toc-Overview-1" href="#Overview">1 Overview</a></li>
+ <li><a name="toc-Disclaimer-1" href="#Disclaimer">2 Disclaimer</a></li>
+ <li><a name="toc-Installation-1" href="#Installation">3 Installation</a>
+ <ul class="no-bullet">
+ <li><a name="toc-Building-the-Package" href="#Building-the-Package">3.1 Building the Package</a></li>
+ <li><a name="toc-Installing-LibreJS" href="#Installing-LibreJS">3.2 Installing LibreJS</a></li>
+ </ul></li>
+ <li><a name="toc-How-to-Use-1" href="#How-to-Use">4 How to Use</a>
+ <ul class="no-bullet">
+ <li><a name="toc-LibreJS-in-action" href="#LibreJS-in-action">4.1 LibreJS in action</a></li>
+ <li><a name="toc-Complaint-Feature" href="#Complaint-Feature">4.2 Complaint Feature</a></li>
+ <li><a name="toc-Options" href="#Options">4.3 Options</a></li>
+ </ul></li>
+ <li><a name="toc-JavaScript-Detection-1" href="#JavaScript-Detection">5 JavaScript Detection</a></li>
+ <li><a name="toc-Free-Licenses-Detection-1" href="#Free-Licenses-Detection">6 Free Licenses Detection</a>
+ <ul class="no-bullet">
+ <li><a name="toc-Detected-Free-Licenses" href="#Detected-Free-Licenses">6.1 Detected Free Licenses</a></li>
+ <li><a name="toc-Undetected-Free-Licenses" href="#Undetected-Free-Licenses">6.2 Undetected Free Licenses</a></li>
+ </ul></li>
+ <li><a name="toc-Setting-Your-JavaScript-Free-1" href="#Setting-Your-JavaScript-Free">7 Setting Your JavaScript Free</a>
+ <ul class="no-bullet">
+ <li><a name="toc-JavaScript-Web-Labels" href="#JavaScript-Web-Labels">7.1 JavaScript Web Labels</a>
+ <ul class="no-bullet">
+ <li><a name="toc-Specifying-multiple-licenses-for-a-single-JavaScript-file" href="#Specifying-multiple-licenses-for-a-single-JavaScript-file">7.1.1 Specifying multiple licenses for a single JavaScript file</a></li>
+ </ul></li>
+ <li><a name="toc-Adding-a-stylized-comment-in-your-JavaScript-files-and-on-your-page" href="#Adding-a-stylized-comment-in-your-JavaScript-files-and-on-your-page">7.2 Adding a stylized comment in your JavaScript files and on your page</a></li>
+ </ul></li>
+</li>
+ <li><a name="toc-Installation-Requirements-1" href="#Installation-Requirements">Appendix A Installation Requirements</a>
+ <ul class="no-bullet">
+ <li><a name="toc-Mozilla-Browser" href="#Mozilla-Browser">A.1 Mozilla Browser</a></li>
+ <li><a name="toc-Mozilla_0027s-Add_002don-SDK" href="#Mozilla_0027s-Add_002don-SDK">A.2 Mozilla&rsquo;s Add-on SDK</a></li>
+ </ul></li>
+ <li><a name="toc-LibreJS-Internals-1" href="#LibreJS-Internals">Appendix B LibreJS Internals</a></li>
+ <li><a name="toc-Tests-1" href="#Tests">Appendix C Tests</a></li>
+ <li><a name="toc-GNU-Free-Documentation-License-1" href="#GNU-Free-Documentation-License">Appendix D GNU Free Documentation License</a></li>
+</ul>
+</div>
+
+
+
+<a name="Top"></a>
+<div class="header">
+<p>
+Next: <a href="#Overview" accesskey="n" rel="next">Overview</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="LibreJS"></a>
+<h1 class="top">LibreJS</h1>
+<p>This manual is for GNU LibreJS (version 6.0.8.20150117, 17 January 2015).
+</p>
+<table class="menu" border="0" cellspacing="0">
+<tr><td align="left" valign="top">&bull; <a href="#Overview" accesskey="1">Overview</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">General purpose and information.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#Disclaimer" accesskey="2">Disclaimer</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Emphasize what LibreJS does and does not.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#Installation" accesskey="3">Installation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Installing LibreJS from source.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#How-to-Use" accesskey="4">How to Use</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to use LibreJS in IceCat.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#JavaScript-Detection" accesskey="5">JavaScript Detection</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How LibreJS detects nontrivial Javascript.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#Free-Licenses-Detection" accesskey="6">Free Licenses Detection</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">List of licenses detected by LibreJS.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#Setting-Your-JavaScript-Free" accesskey="7">Setting Your JavaScript Free</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Information for website owners/maintainers.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#Installation-Requirements" accesskey="8">Installation Requirements</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Requirements to build and install LibreJS.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#LibreJS-Internals" accesskey="9">LibreJS Internals</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How LibreJS works under the hood.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#Tests">Tests</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Test LibreJS and better understand it.
+</td></tr>
+<tr><td align="left" valign="top">&bull; <a href="#GNU-Free-Documentation-License">GNU Free Documentation License</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copying and sharing this documentation.
+</td></tr>
+</table>
+
+<hr>
+<a name="Overview"></a>
+<div class="header">
+<p>
+Next: <a href="#Disclaimer" accesskey="n" rel="next">Disclaimer</a>, Previous: <a href="#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="Overview-1"></a>
+<h2 class="chapter">1 Overview</h2>
+
+<a name="index-overview"></a>
+<p>GNU LibreJS &mdash;an add-on for GNU IceCat and Mozilla Firefox&mdash; detects
+and blocks nonfree nontrivial JavaScript while allowing its execution on
+pages containing code that is either trivial and/or free.
+</p>
+<p>Many websites run nontrivial JavaScript on your computer. Some use it
+for complex tasks; many use it gratuitously for minor jobs that could be
+done easily with plain HTML. Sometimes this JavaScript code is
+malicious. Either way, the JavaScript code is often nonfree. For
+explanation of the issue, see &quot;The JavaScript
+Trap&quot;(<a href="http://www.gnu.org/philosophy/javascript-trap.html">http://www.gnu.org/philosophy/javascript-trap.html</a>).
+</p>
+<p>If you care about freedom in your computing, and don&rsquo;t wish to let all
+and sundry make you run nonfree programs, now you can prevent it by
+using LibreJS.
+</p>
+
+<hr>
+<a name="Disclaimer"></a>
+<div class="header">
+<p>
+Next: <a href="#Installation" accesskey="n" rel="next">Installation</a>, Previous: <a href="#Overview" accesskey="p" rel="prev">Overview</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="Disclaimer-1"></a>
+<h2 class="chapter">2 Disclaimer</h2>
+
+<a name="index-disclaimer"></a>
+
+<ul>
+<li> LibreJS is not a security tool. Its goal is to detect nonfree nontrivial
+JavaScript, and it currently does not detect whether free or trivial
+code is malicious or not. Other free Mozilla extensions and add-ons may
+be available for this purpose.
+
+</li><li> LibreJS is always a work in progress. If you find a bug, please report
+it to <a href="mailto:bug-librejs@gnu.org">bug-librejs@gnu.org</a>.
+
+</li></ul>
+
+<hr>
+<a name="Installation"></a>
+<div class="header">
+<p>
+Next: <a href="#How-to-Use" accesskey="n" rel="next">How to Use</a>, Previous: <a href="#Disclaimer" accesskey="p" rel="prev">Disclaimer</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="Installation-1"></a>
+<h2 class="chapter">3 Installation</h2>
+<a name="index-Installation"></a>
+
+<p>You can install LibreJS directly using a generated <samp>librejs.xpi</samp>
+file, or by building it from source.
+</p>
+
+<a name="Building-the-Package"></a>
+<h3 class="section">3.1 Building the Package</h3>
+<p>After enabling the Add-on SDK, you should be able to use the <code>make</code>
+command to build LibreJS from source.
+</p>
+<p>After running <code>make</code>, a new file, <samp>librejs.xpi</samp> should be
+generated. This is the file that can be installed in a Mozilla browser.
+</p>
+<a name="Installing-LibreJS"></a>
+<h3 class="section">3.2 Installing LibreJS</h3>
+<p>To install the add-on for all users, run:
+</p><div class="example">
+<pre class="example">sudo make install
+</pre></div>
+
+<p>or as root:
+</p><div class="example">
+<pre class="example">make install
+</pre></div>
+
+<p>Next time you open a Mozilla-browser as a user of your system, you
+should be notified that a new add-on (in this case, LibreJS) as been
+installed and whether to allow it to run or not.
+</p>
+<hr>
+<a name="How-to-Use"></a>
+<div class="header">
+<p>
+Next: <a href="#JavaScript-Detection" accesskey="n" rel="next">JavaScript Detection</a>, Previous: <a href="#Installation" accesskey="p" rel="prev">Installation</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="How-to-Use-1"></a>
+<h2 class="chapter">4 How to Use</h2>
+
+<a name="LibreJS-in-action"></a>
+<h3 class="section">4.1 LibreJS in action</h3>
+
+<p>After installing the add-on, you will see the LibreJS widget in the
+add-on bar at the bottom of the browser window. After loading a page,
+left-click on the widget to view the deactivated JavaScript code from
+the page (both on page and external) and, if applicable, the scripts
+that were accepted.
+</p>
+<a name="Complaint-Feature"></a>
+<h3 class="section">4.2 Complaint Feature</h3>
+
+<p>It is very important to complain when a site has nonfree JavaScript
+code, especially if it won&rsquo;t work without that code. LibreJS makes it
+easy to complain by heuristically finding where to send the complaint.
+</p>
+<p>When nonfree/nontrivial code is detected in a page, LibreJS attempts to
+find a relevant contact link or email for the website you are
+visiting. In order to do so, it will attempt to visit a few links from
+the current page (for instance, a link labeled &ldquo;contact&rdquo; on the same
+domain as the current page, &hellip;)
+</p>
+<p>LibreJS detects contact pages, email addresses that are likely to be
+owned by the maintainer of the site, Twitter and identi.ca links, and
+phone numbers.
+</p>
+<p>After LibreJS detects any of the above, a &ldquo;Complain&rdquo; tab will appear
+on the right of your web browser. When you click on this tab, a large
+panel will appear with contact information. Ideally, at the top you will
+find the email address of the maintainer, labeled as the &ldquo;Email you
+should use&rdquo;.
+</p>
+<p>When you complain to the website for their nonfree nontrivial
+JavaScript, provide them with the link to the JavaScript Trap essay so
+that they can get more information on what the issue is and how they can
+solve it on their own site.
+</p>
+<p>LibreJS includes a default subject line and body for the complaint email,
+with a link to the JavaScript Trap essay. This can be configured in the
+LibreJS add-on preferences in your web browser.
+</p>
+
+<a name="Options"></a>
+<h3 class="section">4.3 Options</h3>
+
+<dl compact="compact">
+<dt><em>Whitelist</em></dt>
+<dd><p>LibreJS lets you whitelist domain names and subdomains to bypass the
+regular JavaScript check. This might be useful, for example, if you are
+running your own code in a local web server. In order to add a
+whitelisted domain or url, go to Tools &gt;&gt; Add-ons, or press <kbd>Control
++ Shift + A</kbd>. Inside the add-on window, click on <em>Extensions</em>, and in
+the list, where you see LibreJS, click on the <em>Preferences</em> button.
+You will see an input field labeled <em>Whitelist</em>. In the field,
+enter comma-separated domain names. Do not enter the protocol. For
+instance to whitelist all the pages of <a href="http://www.gnu.org">http://www.gnu.org</a> and
+<a href="https://gnu.org">https://gnu.org</a>, enter &lsquo;<samp>gnu.org</samp>&rsquo;. To allow all subdomains from
+gnu.org, enter: &lsquo;<samp>*.gnu.org</samp>&rsquo;. This will match such sites as
+<a href="http://savannah.gnu.org">http://savannah.gnu.org</a> and <a href="http://audio-video.gnu.org">http://audio-video.gnu.org</a>.
+</p>
+</dd>
+<dt><em>Complaint tab</em></dt>
+<dd><p>This specifies whether the complaint tab appears when a site is running
+nonfree JavaScript.
+</p>
+</dd>
+<dt><em>Display notifications of JavaScript analysis</em></dt>
+<dd><p>This option enables an info bar of realtime JavaScript analysis.
+</p>
+</dd>
+<dt><em>Complaint email subject</em></dt>
+<dd><p>Configure the default subject used in complaint emails.
+</p>
+</dd>
+<dt><em>Complaint email body</em></dt>
+<dd><p>Configure the default body used in complaint emails.
+</p></dd>
+</dl>
+
+<hr>
+<a name="JavaScript-Detection"></a>
+<div class="header">
+<p>
+Next: <a href="#Free-Licenses-Detection" accesskey="n" rel="next">Free Licenses Detection</a>, Previous: <a href="#How-to-Use" accesskey="p" rel="prev">How to Use</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="JavaScript-Detection-1"></a>
+<h2 class="chapter">5 JavaScript Detection</h2>
+<a name="index-javascript"></a>
+
+<ul>
+<li>LibreJS considers JavaScript on a page nontrivial if any of the
+following are true:
+
+</li><li> It makes an AJAX request or is loaded along with scripts that make
+an AJAX request,
+
+</li><li> It loads external scripts dynamically or is loaded along with
+scripts that do,
+
+</li><li> It defines functions or methods and either loads an external script
+(from HTML) or is loaded as one,
+
+</li><li> It uses dynamic JavaScript constructs that are difficult to analyze
+without interpreting the program or is loaded along with scripts
+that use such constructs. These constructs are:
+<ul>
+<li> Using the eval function
+</li><li> Calling methods with the square bracket notation
+</li><li> Using any other construct than a string literal with certain methods
+(<code>Obj.write</code>, <code>Obj.createElement</code>, &hellip;).
+</li></ul>
+</li></ul>
+
+<p>In practice, the JavaScript code in your page may be found trivial by
+LibreJS if, as a whole:
+</p><ul>
+<li> It does not define functions and it does not load external scripts
+(with the HTML src attribute in a <code>&lt;script&gt;</code> tag).
+
+</li><li> It does not make AJAX calls.
+
+</li><li> It does not load external scripts with dynamic constructs.
+
+</li><li> It does not use constructs that may be used to do any of the above in
+a non-obvious way (use of the <code>eval()</code> method, use of square bracket
+method calls, use of concatenation with certain constructs or method
+calls, &hellip;).
+
+</li></ul>
+
+<p>However, in some instances, you may be required by LibreJS to add a
+stylized comment to JavaScript code that may be otherwise trivial.
+</p>
+<p>When an external file defines a function, it becomes available
+to all other external scripts. That is the case if another script
+defines a function that makes AJAX calls, when an external script
+loads other scripts dynamically (which in turn could also make AJAX
+calls, &hellip;), or when a script is written with constructs that may do
+any of these.
+</p>
+<p>For instance, if your page contains the following:
+</p><div class="example">
+<pre class="example">&lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+$.doSomething();
+&lt;/script&gt;
+</pre></div>
+
+<p>While <code>$.doSomething();</code> may seem trivial, you will nevertheless
+have to add a stylized license comment on your main HTML page because
+the external script (in this case jQuery) has been found to define
+methods that make AJAX calls. <code>$.doSomething()</code> might make an AJAX call,
+and LibreJS does not check for that. The rule of thumb is that when you
+use a library or code that handles AJAX, JSON, JSONP, the loading of
+scripts dynamically, you should have license mentions for all your
+JavaScript files and for your main page regardless. In practice this is
+a case that happens very often with code that uses libraries.
+</p>
+<p>In practice also, the JavaScript code in an external file (an external
+<samp>.js</samp> file loaded on your page) may be found trivial if it does not
+define functions/methods.
+</p>
+<p>And in the same manner it will be considered nontrivial if AJAX calls,
+dynamic script loading, or non-obvious dynamic JavaScript constructs
+are used in another script.
+</p>
+<p>If your JavaScript code makes AJAX requests, it&rsquo;s important to get an
+accurate <em>Content-Type</em> in the response from the server. For
+example, if you&rsquo;re using JSON, set it to <code>application/json</code>.
+This is because LibreJS alters the content of <code>text/html</code>
+responses.
+</p>
+<hr>
+<a name="Free-Licenses-Detection"></a>
+<div class="header">
+<p>
+Next: <a href="#Setting-Your-JavaScript-Free" accesskey="n" rel="next">Setting Your JavaScript Free</a>, Previous: <a href="#JavaScript-Detection" accesskey="p" rel="prev">JavaScript Detection</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="Free-Licenses-Detection-1"></a>
+<h2 class="chapter">6 Free Licenses Detection</h2>
+<a name="index-freelicenses"></a>
+
+<a name="Detected-Free-Licenses"></a>
+<h3 class="section">6.1 Detected Free Licenses</h3>
+
+<p>In order for a file to be detected as free, the license notice should
+appear in a JavaScript file above all code, at the very top of the file.
+</p>
+<p>For inline JavaScript code inside <code>&lt;script&gt;</code> tags in HTML pages,
+the license notice should appear once per page as a comment inside a
+<code>&lt;script&gt;</code> tag, before all the code in that script. When the only
+inline JavaScript code is within element attributes (<code>onload</code>,
+<code>onclick</code>), place the license notice in an otherwise empty
+<code>&lt;script&gt;</code> at the top of the page. This is sometimes needed when an
+external script performs AJAX calls or embeds scripts dynamically, and
+the only inline JavaScript is an event attribute making a method call,
+e.g.: <code>&lt;body onload=&quot;methodCall('remote-data.xml');&quot;&gt;</code>
+</p>
+<p>When people speak of the &ldquo;MIT license&rdquo; they mean either the X11 license
+or the Expat license. Please see which license the code uses, and label
+it accordingly.
+</p>
+<p>Currently LibreJS checks for the following licenses:
+</p>
+<ul>
+<li> Creative Commons CC0 1.0 Universal
+<ul>
+<li> Identifier: &lsquo;<samp>CC0-1.0</samp>&rsquo;
+</li><li> URL: <a href="http://creativecommons.org/publicdomain/zero/1.0/legalcode">http://creativecommons.org/publicdomain/zero/1.0/legalcode</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&amp;dn=cc0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Public Domain
+<ul>
+<li> Public domain is not a license (see
+<a href="https://www.gnu.org/licenses/license-list.html#PublicDomain">https://www.gnu.org/licenses/license-list.html#PublicDomain</a>). If
+you want to release your work to the public domain, the FSF recommends
+using CC0.
+</li><li> Magnet Link: &lsquo;<code>magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&amp;dn=public-domain.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU General Public License (GPL) version 2
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-GPL-2.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/gpl-2.0.html">http://www.gnu.org/licenses/gpl-2.0.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU General Public License (GPL) version 3
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-GPL-3.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/gpl-3.0.html">http://www.gnu.org/licenses/gpl-3.0.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Apache License, Version 2.0
+<ul>
+<li> Identifier: &lsquo;<samp>Apache-2.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&amp;dn=apache-2.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU Lesser General Public License, version 2.1
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-LGPL-2.1</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/lgpl-2.1.html">http://www.gnu.org/licenses/lgpl-2.1.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&amp;dn=lgpl-2.1.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU Lesser General Public License, version 3
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-LGPL-3.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/lgpl-3.0.html">http://www.gnu.org/licenses/lgpl-3.0.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&amp;dn=lgpl-3.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> GNU Affero General Public License, version 3
+<ul>
+<li> Identifier: &lsquo;<samp>GNU-AGPL-3.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.gnu.org/licenses/agpl-3.0.html">http://www.gnu.org/licenses/agpl-3.0.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&amp;dn=agpl-3.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Boost Software License
+<ul>
+<li> URL: <a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&amp;dn=Boost-1.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> BSD 3-Clause License
+<ul>
+<li> URL: <a href="http://opensource.org/licenses/BSD-3-Clause">http://opensource.org/licenses/BSD-3-Clause</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&amp;dn=bsd-3-clause.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Eclipse Public License 1.0
+<ul>
+<li> Identifier: &lsquo;<samp>EPL-1.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&amp;dn=epl-1.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Mozilla Public License 2.0
+<ul>
+<li> Identifier: &lsquo;<samp>MPL-2.0</samp>&rsquo;
+</li><li> URL: <a href="http://www.mozilla.org/MPL/2.0">http://www.mozilla.org/MPL/2.0</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&amp;dn=mpl-2.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Expat License (sometimes called the MIT license)
+<ul>
+<li> Identifier: &lsquo;<samp>Expat</samp>&rsquo;
+</li><li> URL: <a href="http://www.jclark.com/xml/copying.txt">http://www.jclark.com/xml/copying.txt</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt</code>&rsquo;
+</li></ul>
+
+</li><li> X11 License
+<ul>
+<li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&amp;dn=x11.txt</code>&rsquo;
+</li></ul>
+
+</li><li> XFree86 License
+<ul>
+<li> Identifier: &lsquo;<samp>Modified-BSD</samp>&rsquo;
+</li><li> URLs:
+<a href="http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3">http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3</a>
+<a href="http://www.xfree86.org/current/LICENSE4.html">http://www.xfree86.org/current/LICENSE4.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&amp;dn=xfree86.txt</code>&rsquo;
+</li></ul>
+
+</li><li> FreeBSD License
+<ul>
+<li> URL: <a href="http://www.freebsd.org/copyright/freebsd-license.html">http://www.freebsd.org/copyright/freebsd-license.html</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&amp;dn=freebsd.txt</code>&rsquo;
+</li></ul>
+
+</li><li> The ISC License
+<ul>
+<li> URL: <a href="https://www.isc.org/downloads/software-support-policy/isc-license/">https://www.isc.org/downloads/software-support-policy/isc-license/</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&amp;dn=ISC.txt</code>&rsquo;
+</li></ul>
+
+</li><li> Artistic License 2.0
+<ul>
+<li> URL: <a href="http://www.perlfoundation.org/artistic_license_2_0">http://www.perlfoundation.org/artistic_license_2_0</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&amp;dn=artistic-2.0.txt</code>&rsquo;
+</li></ul>
+
+</li><li> CPAL 1.0
+<ul>
+<li> Identifier: &lsquo;<samp>CPAL-1.0</samp>&rsquo;
+</li><li> URL: <a href="http://opensource.org/licenses/cpal_1.0">http://opensource.org/licenses/cpal_1.0</a>
+</li><li> Magnet link: &lsquo;<code>magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&amp;dn=cpal-1.0.txt</code>&rsquo;
+</li></ul>
+
+</li></ul>
+
+<a name="Undetected-Free-Licenses"></a>
+<h3 class="section">6.2 Undetected Free Licenses</h3>
+<p>If you are using a free license that isn&rsquo;t detected by LibreJS and isn&rsquo;t
+listed in the previous section, please send a message to
+<a href="mailto:bug-librejs@gnu.org">bug-librejs@gnu.org</a> regarding this license, where code released under
+this license can be found, and where to find the license text and
+information.
+</p>
+<p>Many free licenses are listed in this page:
+<a href="http://www.gnu.org/licenses/license-list.html">http://www.gnu.org/licenses/license-list.html</a>
+</p>
+
+<hr>
+<a name="Setting-Your-JavaScript-Free"></a>
+<div class="header">
+<p>
+Next: <a href="#Installation-Requirements" accesskey="n" rel="next">Installation Requirements</a>, Previous: <a href="#Free-Licenses-Detection" accesskey="p" rel="prev">Free Licenses Detection</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<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&rsquo;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>&lt;head&gt;</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&rsquo;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&rsquo;t need to look any further.
+But if there&rsquo;s no mention of the license, or if it&rsquo;s too brief, you&rsquo;ll
+have to look for a COPYING or LICENSE file within the original library&rsquo;s
+source package, or on the library&rsquo;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&rsquo;re using a third-party service such as an analytics service,
+replace it with a free alternative like Piwik.
+
+</li><li> If you can&rsquo;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&rsquo;s linked to from your main page. The table lists each of your
+site&rsquo;s JavaScript files, that file&rsquo;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&rsquo;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&rsquo;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">&lt;table id=&quot;jslicense-labels1&quot;&gt;
+ &lt;tr&gt;
+ &lt;td&gt;&lt;a href=&quot;all.min.js&quot;&gt;all.min.js&lt;/a&gt;&lt;/td&gt;
+ &lt;td&gt;
+ &lt;a href=&quot;http://www.gnu.org/licenses/gpl-3.0.html&quot;
+ &gt;GNU-GPL-3.0-or-later&lt;/a&gt;
+ &lt;br /&gt;
+ &lt;a href=&quot;http://www.apache.org/licenses/LICENSE-2.0&quot;
+ &gt;Apache-2.0&lt;/a&gt;
+ &lt;/td&gt;
+ &lt;td&gt;
+ &lt;a href=&quot;gpl-script.js&quot;&gt;gpl-script.js&lt;/a&gt;
+ &lt;br /&gt;
+ &lt;a href=&quot;apache-script.js&quot;&gt;apache-script.js&lt;/a&gt;
+ &lt;/td&gt;
+ &lt;/tr&gt;
+&lt;/table&gt;
+</pre>
+<p>The <code>&lt;br /&gt;</code> tags just make the table more understandable when
+looking at the rendered version of it on the license page. They aren&rsquo;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 &ldquo;Convention for releasing free JavaScript programs&rdquo; 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>&lt;script&gt;</code> tags with on-page code and the inline
+JavaScript (in event attributes such as onload, onclick, etc, &hellip;).
+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>&lt;script&gt;</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>
+<a name="Installation-Requirements"></a>
+<div class="header">
+<p>
+Next: <a href="#LibreJS-Internals" accesskey="n" rel="next">LibreJS Internals</a>, Previous: <a href="#Setting-Your-JavaScript-Free" accesskey="p" rel="prev">Setting Your JavaScript Free</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="Installation-Requirements-1"></a>
+<h2 class="appendix">Appendix A Installation Requirements</h2>
+
+
+<a name="Mozilla-Browser"></a>
+<h3 class="appendixsec">A.1 Mozilla Browser</h3>
+
+<p>You will need one of the many flavors of the Mozilla browser to use
+LibreJS. It can be installed on the following:
+</p>
+<p>GNU IceCat, Mozilla Firefox, Trisquel Abrowser, Debian Iceweasel.
+</p>
+<p>LibreJS works on these browsers starting from version 29. We
+recommend that you use the latest version of your Mozilla browser.
+LibreJS has been tested extensively on multiple GNU/Linux distributions,
+but it is compatible any operating system as long as you&rsquo;re using a
+compatible Mozilla browser.
+</p>
+<a name="Mozilla_0027s-Add_002don-SDK"></a>
+<h3 class="appendixsec">A.2 Mozilla&rsquo;s Add-on SDK</h3>
+<p>LibreJS uses the Mozilla Add-on SDK (Software Development Kit), a
+set of APIs and tools to create add-ons for Mozilla browsers.
+</p>
+<p>You do not need the Add-on SDK to use LibreJS xpi file or to install it
+using the packaged version, but it is required in order to package the
+LibreJS source code into an xpi file using <code>make</code>. If you would like
+to run the tests for LibreJS or make changes to the source files, you
+will need the Add-on SDK as well. For the &ldquo;make&rdquo; command to work
+properly, you must have the <code>cfx</code> command available on your system
+from the command line.
+</p>
+<p>The latest tarball for the Add-on SDK is available at:
+</p>
+<p><a href="https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/jetpack-sdk-latest.tar.gz">https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/jetpack-sdk-latest.tar.gz</a>
+</p>
+<p>Instructions on how to get it working are available here:
+</p>
+<p><a href="https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/installation.html">https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/installation.html</a>
+</p>
+<p>In order to use <code>make</code> with LibreJS source, however, it is ideal to
+have <code>cfx</code> available at all times and for all users.
+</p>
+<p>An easy way to do this is to extract the contents of the tarball and to
+place the files inside <samp>/usr/lib/addon-sdk</samp> and then creating a
+symbolic link in <samp>/usr/bin</samp>, as follows:
+</p>
+<div class="example">
+<pre class="example">sudo ln -s /usr/lib/addon-sdk/bin/cfx /usr/bin/cfx
+</pre></div>
+
+<p>The <code>cfx</code> command will then be available to all users.
+</p>
+<p>The Add-on SDK is released under the Mozilla Public License 2.0.
+</p>
+<hr>
+<a name="LibreJS-Internals"></a>
+<div class="header">
+<p>
+Next: <a href="#Tests" accesskey="n" rel="next">Tests</a>, Previous: <a href="#Installation-Requirements" accesskey="p" rel="prev">Installation Requirements</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="LibreJS-Internals-1"></a>
+<h2 class="appendix">Appendix B LibreJS Internals</h2>
+
+<p>LibreJS intercepts HTTP responses and rewrites their contents after
+analyzing JavaScript within them. It does not remove script nodes and
+attributes from the page, but instead &ldquo;deactivates&rdquo; them by modifying
+the <code>type</code> and <code>src</code> attributes on script elements and by
+moving the contents of inline JavaScript attributes such as onClick
+into harmless attributes.
+</p>
+<p>LibreJS detects the most common cases using the HTTP response method
+described above, but in extremely rare cases, or when running code
+locally, LibreJS cannot detect JavaScript during the response stage.
+</p>
+<p>To remedy this issue, and as a final safeguard, LibreJS takes a look
+at the scripts that are about to be executed while the browser engine is
+parsing the page. If the script is not found in a list of accepted
+scripts populated earlier, the execution will be prevented. This is to
+ensure content types that are not regular HTML (binhex with HTML in it,
+&hellip;) and JavaScript do not fall through the cracks and get executed.
+</p>
+<hr>
+<a name="Tests"></a>
+<div class="header">
+<p>
+Next: <a href="#GNU-Free-Documentation-License" accesskey="n" rel="next">GNU Free Documentation License</a>, Previous: <a href="#LibreJS-Internals" accesskey="p" rel="prev">LibreJS Internals</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="Tests-1"></a>
+<h2 class="appendix">Appendix C Tests</h2>
+
+
+<p>In order to better understand how LibreJS works, you can try to visit
+these pages with LibreJS installed and enabled and see how they are
+being processed:
+</p>
+<ul>
+<li> <a href="http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/">http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/</a>
+This page contains trivial on-page JavaScript code, and an external
+script that contains trivial JavaScript code. Therefore, all JavaScript
+is being executed.
+
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/">http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/</a>
+The on-page script here is trivial and uses a built-in method, but the
+external script in this page is nontrivial (defines a function.) The
+external script is blocked, the inline script is executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/">http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/</a>
+This page contains nontrivial code on page, and trivial code in its
+external page. All JavaScript is <em>removed</em> from the page, and the
+external script is never analyzed, since the nontrivial conditions are
+already met in the page.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/free-inline-free-external/">http://lduros.net/assets/librejs/tests/free-inline-free-external/</a>
+This page contains free on-page (GPL 3) JavaScript, and free external
+Javascript. Therefore all JavaScript is being executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/">http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/</a>
+This page contains free on-page JavaScript. The external script contains
+nonfree nontrivial JavaScript (AJAX request). The free code that is
+inline is executed, but the external file is blocked.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/intrinsec-event/">http://lduros.net/assets/librejs/tests/intrinsec-event/</a> This page
+contains trivial on-page code, with an intrinsic event in an html
+attribute (onload). All JavaScript is being executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/">http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/</a>
+This page contains on-page trivial JavaScript (only makes a window alert
+and loads an external script using the html &lt;script&gt; tag with the src
+attribute. The external script is free (GPL v3), and since it is only
+nontrivial because it defines a function, the on-page trivial code is
+allowed to use it. All JavaScript is being executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/">http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/</a>
+This page contains trivial on-page JavaScript code, and loads an
+external script that is free. Since no function is defined, the external
+script is being analyzed. The external script is free. Trivial here is
+not allowed because the external script, although free, writes a
+script. The inline trivial script should also have a free license notice
+for it to be interpreted.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html">http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html</a>
+This is a real-life example of a small jQuery plugin. The on-page
+JavaScript code has a free license. The jQuery external file has a free
+licensed. The shelltypist.js file has a free license as well. All
+licenses are defined between <code>@licstart</code> and <code>@licend</code>. All
+JavaScript is executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html">http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html</a>
+This is the same page than the previous example, except it does not have
+a free license for the main HTML page on-page script. While the actual
+code there is trivial, since jQuery defines methods that make use of
+AJAX, trivial code is not allowed, and no JavaScript is executed.
+
+</li><li> <a href="http://lduros.net/assets/librejs/tests/test-labels/">http://lduros.net/assets/librejs/tests/test-labels/</a> This page
+contains JavaScript (jQuery minified) that does not have proper license
+information in the file, as it has no <code>@licstart</code> <code>@licend</code>
+comment. It would be considered nonfree, however, the page itself uses
+the JavaScript Web Labels method. On the page itself, you will find a
+link labeled &ldquo;JavaScript License Information&rdquo;, which leads to a page
+that contains a properly formatted table with the required data on the
+external JavaScript file. LibreJS visits this link and determines the
+version of jQuery linked from the original page is the one listed there,
+and flags it as free. All JavaScript is executed (and the title should
+turn green.)
+
+</li></ul>
+
+
+<hr>
+<a name="GNU-Free-Documentation-License"></a>
+<div class="header">
+<p>
+Previous: <a href="#Tests" accesskey="p" rel="prev">Tests</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
+</div>
+<a name="GNU-Free-Documentation-License-1"></a>
+<h2 class="appendix">Appendix D GNU Free Documentation License</h2>
+
+<div align="center">Version 1.3, 3 November 2008
+</div>
+
+<div class="display">
+<pre class="display">Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+<a href="http://fsf.org/">http://fsf.org/</a>
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+</pre></div>
+
+<ol>
+<li> PREAMBLE
+
+<p>The purpose of this License is to make a manual, textbook, or other
+functional and useful document <em>free</em> in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+</p>
+<p>This License is a kind of &ldquo;copyleft&rdquo;, which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+</p>
+<p>We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+</p>
+</li><li> APPLICABILITY AND DEFINITIONS
+
+<p>This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The &ldquo;Document&rdquo;, below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as &ldquo;you&rdquo;. You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+</p>
+<p>A &ldquo;Modified Version&rdquo; of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+</p>
+<p>A &ldquo;Secondary Section&rdquo; is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document&rsquo;s overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+</p>
+<p>The &ldquo;Invariant Sections&rdquo; are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+</p>
+<p>The &ldquo;Cover Texts&rdquo; are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+</p>
+<p>A &ldquo;Transparent&rdquo; copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not &ldquo;Transparent&rdquo; is called &ldquo;Opaque&rdquo;.
+</p>
+<p>Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input
+format, SGML or XML using a publicly available
+DTD, and standard-conforming simple HTML,
+PostScript or PDF designed for human modification. Examples
+of transparent image formats include PNG, XCF and
+JPG. Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, SGML or
+XML for which the DTD and/or processing tools are
+not generally available, and the machine-generated HTML,
+PostScript or PDF produced by some word processors for
+output purposes only.
+</p>
+<p>The &ldquo;Title Page&rdquo; means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, &ldquo;Title Page&rdquo; means
+the text near the most prominent appearance of the work&rsquo;s title,
+preceding the beginning of the body of the text.
+</p>
+<p>The &ldquo;publisher&rdquo; means any person or entity that distributes copies
+of the Document to the public.
+</p>
+<p>A section &ldquo;Entitled XYZ&rdquo; means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as &ldquo;Acknowledgements&rdquo;,
+&ldquo;Dedications&rdquo;, &ldquo;Endorsements&rdquo;, or &ldquo;History&rdquo;.) To &ldquo;Preserve the Title&rdquo;
+of such a section when you modify the Document means that it remains a
+section &ldquo;Entitled XYZ&rdquo; according to this definition.
+</p>
+<p>The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+</p>
+</li><li> VERBATIM COPYING
+
+<p>You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+</p>
+<p>You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+</p>
+</li><li> COPYING IN QUANTITY
+
+<p>If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document&rsquo;s license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+</p>
+<p>If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+</p>
+<p>If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+</p>
+<p>It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+</p>
+</li><li> MODIFICATIONS
+
+<p>You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+</p>
+<ol>
+<li> Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document). You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
+</li><li> List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
+</li><li> State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
+</li><li> Preserve all the copyright notices of the Document.
+
+</li><li> Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
+</li><li> Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
+</li><li> Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document&rsquo;s license notice.
+
+</li><li> Include an unaltered copy of this License.
+
+</li><li> Preserve the section Entitled &ldquo;History&rdquo;, Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page. If
+there is no section Entitled &ldquo;History&rdquo; in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
+</li><li> Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on. These may be placed in the &ldquo;History&rdquo; section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
+</li><li> For any section Entitled &ldquo;Acknowledgements&rdquo; or &ldquo;Dedications&rdquo;, Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
+</li><li> Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles. Section numbers
+or the equivalent are not considered part of the section titles.
+
+</li><li> Delete any section Entitled &ldquo;Endorsements&rdquo;. Such a section
+may not be included in the Modified Version.
+
+</li><li> Do not retitle any existing section to be Entitled &ldquo;Endorsements&rdquo; or
+to conflict in title with any Invariant Section.
+
+</li><li> Preserve any Warranty Disclaimers.
+</li></ol>
+
+<p>If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version&rsquo;s license notice.
+These titles must be distinct from any other section titles.
+</p>
+<p>You may add a section Entitled &ldquo;Endorsements&rdquo;, provided it contains
+nothing but endorsements of your Modified Version by various
+parties&mdash;for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+</p>
+<p>You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+</p>
+<p>The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+</p>
+</li><li> COMBINING DOCUMENTS
+
+<p>You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+</p>
+<p>The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+</p>
+<p>In the combination, you must combine any sections Entitled &ldquo;History&rdquo;
+in the various original documents, forming one section Entitled
+&ldquo;History&rdquo;; likewise combine any sections Entitled &ldquo;Acknowledgements&rdquo;,
+and any sections Entitled &ldquo;Dedications&rdquo;. You must delete all
+sections Entitled &ldquo;Endorsements.&rdquo;
+</p>
+</li><li> COLLECTIONS OF DOCUMENTS
+
+<p>You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+</p>
+<p>You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+</p>
+</li><li> AGGREGATION WITH INDEPENDENT WORKS
+
+<p>A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an &ldquo;aggregate&rdquo; if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation&rsquo;s users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+</p>
+<p>If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document&rsquo;s Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+</p>
+</li><li> TRANSLATION
+
+<p>Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+</p>
+<p>If a section in the Document is Entitled &ldquo;Acknowledgements&rdquo;,
+&ldquo;Dedications&rdquo;, or &ldquo;History&rdquo;, the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+</p>
+</li><li> TERMINATION
+
+<p>You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+</p>
+<p>However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+</p>
+<p>Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+</p>
+<p>Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
+</p>
+</li><li> FUTURE REVISIONS OF THIS LICENSE
+
+<p>The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+<a href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>.
+</p>
+<p>Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License &ldquo;or any later version&rdquo; applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation. If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy&rsquo;s public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+</p>
+</li><li> RELICENSING
+
+<p>&ldquo;Massive Multiauthor Collaboration Site&rdquo; (or &ldquo;MMC Site&rdquo;) means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works. A
+public wiki that anybody can edit is an example of such a server. A
+&ldquo;Massive Multiauthor Collaboration&rdquo; (or &ldquo;MMC&rdquo;) contained in the
+site means any set of copyrightable works thus published on the MMC
+site.
+</p>
+<p>&ldquo;CC-BY-SA&rdquo; means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+</p>
+<p>&ldquo;Incorporate&rdquo; means to publish or republish a Document, in whole or
+in part, as part of another Document.
+</p>
+<p>An MMC is &ldquo;eligible for relicensing&rdquo; if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole
+or in part into the MMC, (1) had no cover texts or invariant sections,
+and (2) were thus incorporated prior to November 1, 2008.
+</p>
+<p>The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+</p>
+</li></ol>
+
+<a name="ADDENDUM_003a-How-to-use-this-License-for-your-documents"></a>
+<h3 class="heading">ADDENDUM: How to use this License for your documents</h3>
+
+<p>To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+</p>
+<div class="smallexample">
+<pre class="smallexample"> Copyright (C) <var>year</var> <var>your name</var>.
+ 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, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+</pre></div>
+
+<p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the &ldquo;with&hellip;Texts.&rdquo; line with this:
+</p>
+<div class="smallexample">
+<pre class="smallexample"> with the Invariant Sections being <var>list their titles</var>, with
+ the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts
+ being <var>list</var>.
+</pre></div>
+
+<p>If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+</p>
+<p>If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+</p>
+
+
+
+<hr>
+
+
+
+</body>
+</html>
diff --git a/doc/manual/librejs.html.gz b/doc/manual/librejs.html.gz
new file mode 100644
index 0000000..7cd39ce
--- /dev/null
+++ b/doc/manual/librejs.html.gz
Binary files differ
diff --git a/doc/manual/librejs.html_node.tar.gz b/doc/manual/librejs.html_node.tar.gz
new file mode 100644
index 0000000..07f53fc
--- /dev/null
+++ b/doc/manual/librejs.html_node.tar.gz
Binary files differ
diff --git a/doc/manual/librejs.info.tar.gz b/doc/manual/librejs.info.tar.gz
new file mode 100644
index 0000000..ce0a256
--- /dev/null
+++ b/doc/manual/librejs.info.tar.gz
Binary files differ
diff --git a/doc/manual/librejs.pdf b/doc/manual/librejs.pdf
new file mode 100644
index 0000000..b174523
--- /dev/null
+++ b/doc/manual/librejs.pdf
Binary files differ
diff --git a/doc/manual/librejs.texi.tar.gz b/doc/manual/librejs.texi.tar.gz
new file mode 100644
index 0000000..0561cc6
--- /dev/null
+++ b/doc/manual/librejs.texi.tar.gz
Binary files differ
diff --git a/doc/manual/librejs.txt b/doc/manual/librejs.txt
new file mode 100644
index 0000000..7cfa420
--- /dev/null
+++ b/doc/manual/librejs.txt
@@ -0,0 +1,1181 @@
+LibreJS
+1 Overview
+2 Disclaimer
+3 Installation
+ 3.1 Building the Package
+ 3.2 Installing LibreJS
+4 How to Use
+ 4.1 LibreJS in action
+ 4.2 Complaint Feature
+ 4.3 Options
+5 JavaScript Detection
+6 Free Licenses Detection
+ 6.1 Detected Free Licenses
+ 6.2 Undetected Free Licenses
+7 Setting Your JavaScript Free
+ 7.1 JavaScript Web Labels
+ 7.1.1 Specifying multiple licenses for a single JavaScript file
+ 7.2 Adding a stylized comment in your JavaScript files and on your page
+
+Appendix A Installation Requirements
+ A.1 Mozilla Browser
+ A.2 Mozilla's Add-on SDK
+Appendix B LibreJS Internals
+Appendix C Tests
+Appendix D GNU Free Documentation License
+LibreJS
+*******
+
+This manual is for GNU LibreJS (version 6.0.8.20150117, 17 January
+2015).
+
+1 Overview
+**********
+
+GNU LibreJS --an add-on for GNU IceCat and Mozilla Firefox-- detects and
+blocks nonfree nontrivial JavaScript while allowing its execution on
+pages containing code that is either trivial and/or free.
+
+ Many websites run nontrivial JavaScript on your computer. Some use
+it for complex tasks; many use it gratuitously for minor jobs that could
+be done easily with plain HTML. Sometimes this JavaScript code is
+malicious. Either way, the JavaScript code is often nonfree. For
+explanation of the issue, see "The JavaScript
+Trap"(<http://www.gnu.org/philosophy/javascript-trap.html>).
+
+ If you care about freedom in your computing, and don't wish to let
+all and sundry make you run nonfree programs, now you can prevent it by
+using LibreJS.
+
+2 Disclaimer
+************
+
+ * LibreJS is not a security tool. Its goal is to detect nonfree
+ nontrivial JavaScript, and it currently does not detect whether
+ free or trivial code is malicious or not. Other free Mozilla
+ extensions and add-ons may be available for this purpose.
+
+ * LibreJS is always a work in progress. If you find a bug, please
+ report it to <bug-librejs@gnu.org>.
+
+3 Installation
+**************
+
+You can install LibreJS directly using a generated 'librejs.xpi' file,
+or by building it from source.
+
+3.1 Building the Package
+========================
+
+After enabling the Add-on SDK, you should be able to use the 'make'
+command to build LibreJS from source.
+
+ After running 'make', a new file, 'librejs.xpi' should be generated.
+This is the file that can be installed in a Mozilla browser.
+
+3.2 Installing LibreJS
+======================
+
+To install the add-on for all users, run:
+ sudo make install
+
+ or as root:
+ make install
+
+ Next time you open a Mozilla-browser as a user of your system, you
+should be notified that a new add-on (in this case, LibreJS) as been
+installed and whether to allow it to run or not.
+
+4 How to Use
+************
+
+4.1 LibreJS in action
+=====================
+
+After installing the add-on, you will see the LibreJS widget in the
+add-on bar at the bottom of the browser window. After loading a page,
+left-click on the widget to view the deactivated JavaScript code from
+the page (both on page and external) and, if applicable, the scripts
+that were accepted.
+
+4.2 Complaint Feature
+=====================
+
+It is very important to complain when a site has nonfree JavaScript
+code, especially if it won't work without that code. LibreJS makes it
+easy to complain by heuristically finding where to send the complaint.
+
+ When nonfree/nontrivial code is detected in a page, LibreJS attempts
+to find a relevant contact link or email for the website you are
+visiting. In order to do so, it will attempt to visit a few links from
+the current page (for instance, a link labeled "contact" on the same
+domain as the current page, ...)
+
+ LibreJS detects contact pages, email addresses that are likely to be
+owned by the maintainer of the site, Twitter and identi.ca links, and
+phone numbers.
+
+ After LibreJS detects any of the above, a "Complain" tab will appear
+on the right of your web browser. When you click on this tab, a large
+panel will appear with contact information. Ideally, at the top you
+will find the email address of the maintainer, labeled as the "Email you
+should use".
+
+ When you complain to the website for their nonfree nontrivial
+JavaScript, provide them with the link to the JavaScript Trap essay so
+that they can get more information on what the issue is and how they can
+solve it on their own site.
+
+ LibreJS includes a default subject line and body for the complaint
+email, with a link to the JavaScript Trap essay. This can be configured
+in the LibreJS add-on preferences in your web browser.
+
+4.3 Options
+===========
+
+"Whitelist"
+ LibreJS lets you whitelist domain names and subdomains to bypass
+ the regular JavaScript check. This might be useful, for example,
+ if you are running your own code in a local web server. In order
+ to add a whitelisted domain or url, go to Tools >> Add-ons, or
+ press 'Control + Shift + A'. Inside the add-on window, click on
+ "Extensions", and in the list, where you see LibreJS, click on the
+ "Preferences" button. You will see an input field labeled
+ "Whitelist". In the field, enter comma-separated domain names. Do
+ not enter the protocol. For instance to whitelist all the pages of
+ <http://www.gnu.org> and <https://gnu.org>, enter 'gnu.org'. To
+ allow all subdomains from gnu.org, enter: '*.gnu.org'. This will
+ match such sites as <http://savannah.gnu.org> and
+ <http://audio-video.gnu.org>.
+
+"Complaint tab"
+ This specifies whether the complaint tab appears when a site is
+ running nonfree JavaScript.
+
+"Display notifications of JavaScript analysis"
+ This option enables an info bar of realtime JavaScript analysis.
+
+"Complaint email subject"
+ Configure the default subject used in complaint emails.
+
+"Complaint email body"
+ Configure the default body used in complaint emails.
+
+5 JavaScript Detection
+**********************
+
+ LibreJS considers JavaScript on a page nontrivial if any of the
+ following are true:
+
+ * It makes an AJAX request or is loaded along with scripts that make
+ an AJAX request,
+
+ * It loads external scripts dynamically or is loaded along with
+ scripts that do,
+
+ * It defines functions or methods and either loads an external script
+ (from HTML) or is loaded as one,
+
+ * It uses dynamic JavaScript constructs that are difficult to analyze
+ without interpreting the program or is loaded along with scripts
+ that use such constructs. These constructs are:
+ * Using the eval function
+ * Calling methods with the square bracket notation
+ * Using any other construct than a string literal with certain
+ methods ('Obj.write', 'Obj.createElement', ...).
+
+ In practice, the JavaScript code in your page may be found trivial by
+LibreJS if, as a whole:
+
+ * It does not define functions and it does not load external scripts
+ (with the HTML src attribute in a '<script>' tag).
+
+ * It does not make AJAX calls.
+
+ * It does not load external scripts with dynamic constructs.
+
+ * It does not use constructs that may be used to do any of the above
+ in a non-obvious way (use of the 'eval()' method, use of square
+ bracket method calls, use of concatenation with certain constructs
+ or method calls, ...).
+
+ However, in some instances, you may be required by LibreJS to add a
+stylized comment to JavaScript code that may be otherwise trivial.
+
+ When an external file defines a function, it becomes available to all
+other external scripts. That is the case if another script defines a
+function that makes AJAX calls, when an external script loads other
+scripts dynamically (which in turn could also make AJAX calls, ...), or
+when a script is written with constructs that may do any of these.
+
+ For instance, if your page contains the following:
+ <script src="jquery.js"></script>
+ <script>
+ $.doSomething();
+ </script>
+
+ While '$.doSomething();' may seem trivial, you will nevertheless have
+to add a stylized license comment on your main HTML page because the
+external script (in this case jQuery) has been found to define methods
+that make AJAX calls. '$.doSomething()' might make an AJAX call, and
+LibreJS does not check for that. The rule of thumb is that when you use
+a library or code that handles AJAX, JSON, JSONP, the loading of scripts
+dynamically, you should have license mentions for all your JavaScript
+files and for your main page regardless. In practice this is a case
+that happens very often with code that uses libraries.
+
+ In practice also, the JavaScript code in an external file (an
+external '.js' file loaded on your page) may be found trivial if it does
+not define functions/methods.
+
+ And in the same manner it will be considered nontrivial if AJAX
+calls, dynamic script loading, or non-obvious dynamic JavaScript
+constructs are used in another script.
+
+ If your JavaScript code makes AJAX requests, it's important to get an
+accurate "Content-Type" in the response from the server. For example,
+if you're using JSON, set it to 'application/json'. This is because
+LibreJS alters the content of 'text/html' responses.
+
+6 Free Licenses Detection
+*************************
+
+6.1 Detected Free Licenses
+==========================
+
+In order for a file to be detected as free, the license notice should
+appear in a JavaScript file above all code, at the very top of the file.
+
+ For inline JavaScript code inside '<script>' tags in HTML pages, the
+license notice should appear once per page as a comment inside a
+'<script>' tag, before all the code in that script. When the only
+inline JavaScript code is within element attributes ('onload',
+'onclick'), place the license notice in an otherwise empty '<script>' at
+the top of the page. This is sometimes needed when an external script
+performs AJAX calls or embeds scripts dynamically, and the only inline
+JavaScript is an event attribute making a method call, e.g.: '<body
+onload="methodCall('remote-data.xml');">'
+
+ When people speak of the "MIT license" they mean either the X11
+license or the Expat license. Please see which license the code uses,
+and label it accordingly.
+
+ Currently LibreJS checks for the following licenses:
+
+ * Creative Commons CC0 1.0 Universal
+ * Identifier: 'CC0-1.0'
+ * URL:
+ <http://creativecommons.org/publicdomain/zero/1.0/legalcode>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt'
+
+ * Public Domain
+ * Public domain is not a license (see
+ <https://www.gnu.org/licenses/license-list.html#PublicDomain>).
+ If you want to release your work to the public domain, the FSF
+ recommends using CC0.
+ * Magnet Link:
+ 'magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt'
+
+ * GNU General Public License (GPL) version 2
+ * Identifier: 'GNU-GPL-2.0'
+ * URL: <http://www.gnu.org/licenses/gpl-2.0.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt'
+
+ * GNU General Public License (GPL) version 3
+ * Identifier: 'GNU-GPL-3.0'
+ * URL: <http://www.gnu.org/licenses/gpl-3.0.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt'
+
+ * Apache License, Version 2.0
+ * Identifier: 'Apache-2.0'
+ * URL: <http://www.apache.org/licenses/LICENSE-2.0>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt'
+
+ * GNU Lesser General Public License, version 2.1
+ * Identifier: 'GNU-LGPL-2.1'
+ * URL: <http://www.gnu.org/licenses/lgpl-2.1.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt'
+
+ * GNU Lesser General Public License, version 3
+ * Identifier: 'GNU-LGPL-3.0'
+ * URL: <http://www.gnu.org/licenses/lgpl-3.0.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt'
+
+ * GNU Affero General Public License, version 3
+ * Identifier: 'GNU-AGPL-3.0'
+ * URL: <http://www.gnu.org/licenses/agpl-3.0.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt'
+
+ * Boost Software License
+ * URL: <http://www.boost.org/LICENSE_1_0.txt>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&dn=Boost-1.0.txt'
+
+ * BSD 3-Clause License
+ * URL: <http://opensource.org/licenses/BSD-3-Clause>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt'
+
+ * Eclipse Public License 1.0
+ * Identifier: 'EPL-1.0'
+ * URL: <http://www.eclipse.org/legal/epl-v10.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&dn=epl-1.0.txt'
+
+ * Mozilla Public License 2.0
+ * Identifier: 'MPL-2.0'
+ * URL: <http://www.mozilla.org/MPL/2.0>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt'
+
+ * Expat License (sometimes called the MIT license)
+ * Identifier: 'Expat'
+ * URL: <http://www.jclark.com/xml/copying.txt>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt'
+
+ * X11 License
+ * Magnet link:
+ 'magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt'
+
+ * XFree86 License
+ * Identifier: 'Modified-BSD'
+ * URLs: <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3>
+ <http://www.xfree86.org/current/LICENSE4.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&dn=xfree86.txt'
+
+ * FreeBSD License
+ * URL: <http://www.freebsd.org/copyright/freebsd-license.html>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&dn=freebsd.txt'
+
+ * The ISC License
+ * URL:
+ <https://www.isc.org/downloads/software-support-policy/isc-license/>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&dn=ISC.txt'
+
+ * Artistic License 2.0
+ * URL: <http://www.perlfoundation.org/artistic_license_2_0>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&dn=artistic-2.0.txt'
+
+ * CPAL 1.0
+ * Identifier: 'CPAL-1.0'
+ * URL: <http://opensource.org/licenses/cpal_1.0>
+ * Magnet link:
+ 'magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&dn=cpal-1.0.txt'
+
+6.2 Undetected Free Licenses
+============================
+
+If you are using a free license that isn't detected by LibreJS and isn't
+listed in the previous section, please send a message to
+<bug-librejs@gnu.org> regarding this license, where code released under
+this license can be found, and where to find the license text and
+information.
+
+ Many free licenses are listed in this page:
+<http://www.gnu.org/licenses/license-list.html>
+
+7 Setting Your JavaScript Free
+******************************
+
+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.
+
+ 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.
+
+ 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.
+
+ _Tip_: 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.
+
+ Imagine a page that contains several pieces of JavaScript from
+various sources:
+ * On top, within the '<head>' tag, it includes jQuery
+
+ * Then, some JavaScript code that you have written
+
+ * At the bottom, a JavaScript-based Facebook widget
+
+ * Also, there's some analytics tracking code
+
+"JavaScript that is already free"
+ 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.
+
+"Your own JavaScript"
+ 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: <http://www.gnu.org/licenses/license-list.html>
+
+"Nonfree JavaScript"
+ 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:
+
+ * If you have used nonfree third-party code as the base to write
+ your own code, try to find a free alternative.
+
+ * If you're using a third-party service such as an analytics
+ service, replace it with a free alternative like Piwik.
+
+ * 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!
+
+7.1 JavaScript Web Labels
+=========================
+
+One way to make your website work with LibreJS is by defining a
+JavaScript Web Labels table.
+
+ 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.
+
+ 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
+<https://www.gnu.org/licenses/gpl-howto.html>. Future versions of
+LibreJS will require a copying permission statement or other license
+notice for source files listed in a Web Labels table.
+
+ More information on JavaScript Web Labels is detailed here:
+<https://www.gnu.org/software/librejs/free-your-javascript.html#step3>
+and here: <https://www.gnu.org/licenses/javascript-labels.html>.
+
+7.1.1 Specifying multiple licenses for a single JavaScript file
+---------------------------------------------------------------
+
+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:
+
+<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"
+ >GNU-GPL-3.0-or-later</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>
+
+ The '<br />' 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.
+
+ 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.
+
+7.2 Adding a stylized comment in your JavaScript files and on your page
+=======================================================================
+
+See a "Convention for releasing free JavaScript programs" in the
+JavaScript Trap <http://www.gnu.org/philosophy/javascript-trap.html>
+
+ Adding this notice will ensure LibreJS will find the JavaScript file
+to be free. The '@licstart' and '@licend' 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.
+
+ In the main HTML page, the license notice covers JavaScript contained
+in all '<script>' 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
+'@licstart' and '@licend'.
+
+ You should make _only_ one '@licstart' '@licend' comment in your
+page, since it pertains to the entire code on page across all '<script>'
+tags and inline html attributes.
+
+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.
+
+ For more info on making your JavaScript LibreJS-compliant, see this
+web page:
+<https://www.gnu.org/software/librejs/free-your-javascript.html>
+
+Appendix A Installation Requirements
+************************************
+
+A.1 Mozilla Browser
+===================
+
+You will need one of the many flavors of the Mozilla browser to use
+LibreJS. It can be installed on the following:
+
+ GNU IceCat, Mozilla Firefox, Trisquel Abrowser, Debian Iceweasel.
+
+ LibreJS works on these browsers starting from version 29. We
+recommend that you use the latest version of your Mozilla browser.
+LibreJS has been tested extensively on multiple GNU/Linux distributions,
+but it is compatible any operating system as long as you're using a
+compatible Mozilla browser.
+
+A.2 Mozilla's Add-on SDK
+========================
+
+LibreJS uses the Mozilla Add-on SDK (Software Development Kit), a set of
+APIs and tools to create add-ons for Mozilla browsers.
+
+ You do not need the Add-on SDK to use LibreJS xpi file or to install
+it using the packaged version, but it is required in order to package
+the LibreJS source code into an xpi file using 'make'. If you would
+like to run the tests for LibreJS or make changes to the source files,
+you will need the Add-on SDK as well. For the "make" command to work
+properly, you must have the 'cfx' command available on your system from
+the command line.
+
+ The latest tarball for the Add-on SDK is available at:
+
+ <https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/jetpack-sdk-latest.tar.gz>
+
+ Instructions on how to get it working are available here:
+
+ <https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/installation.html>
+
+ In order to use 'make' with LibreJS source, however, it is ideal to
+have 'cfx' available at all times and for all users.
+
+ An easy way to do this is to extract the contents of the tarball and
+to place the files inside '/usr/lib/addon-sdk' and then creating a
+symbolic link in '/usr/bin', as follows:
+
+ sudo ln -s /usr/lib/addon-sdk/bin/cfx /usr/bin/cfx
+
+ The 'cfx' command will then be available to all users.
+
+ The Add-on SDK is released under the Mozilla Public License 2.0.
+
+Appendix B LibreJS Internals
+****************************
+
+LibreJS intercepts HTTP responses and rewrites their contents after
+analyzing JavaScript within them. It does not remove script nodes and
+attributes from the page, but instead "deactivates" them by modifying
+the 'type' and 'src' attributes on script elements and by moving the
+contents of inline JavaScript attributes such as onClick into harmless
+attributes.
+
+ LibreJS detects the most common cases using the HTTP response method
+described above, but in extremely rare cases, or when running code
+locally, LibreJS cannot detect JavaScript during the response stage.
+
+ To remedy this issue, and as a final safeguard, LibreJS takes a look
+at the scripts that are about to be executed while the browser engine is
+parsing the page. If the script is not found in a list of accepted
+scripts populated earlier, the execution will be prevented. This is to
+ensure content types that are not regular HTML (binhex with HTML in it,
+...) and JavaScript do not fall through the cracks and get executed.
+
+Appendix C Tests
+****************
+
+In order to better understand how LibreJS works, you can try to visit
+these pages with LibreJS installed and enabled and see how they are
+being processed:
+
+ *
+ <http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/>
+ This page contains trivial on-page JavaScript code, and an external
+ script that contains trivial JavaScript code. Therefore, all
+ JavaScript is being executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/>
+ The on-page script here is trivial and uses a built-in method, but
+ the external script in this page is nontrivial (defines a
+ function.) The external script is blocked, the inline script is
+ executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/>
+ This page contains nontrivial code on page, and trivial code in its
+ external page. All JavaScript is _removed_ from the page, and the
+ external script is never analyzed, since the nontrivial conditions
+ are already met in the page.
+
+ * <http://lduros.net/assets/librejs/tests/free-inline-free-external/>
+ This page contains free on-page (GPL 3) JavaScript, and free
+ external Javascript. Therefore all JavaScript is being executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/>
+ This page contains free on-page JavaScript. The external script
+ contains nonfree nontrivial JavaScript (AJAX request). The free
+ code that is inline is executed, but the external file is blocked.
+
+ * <http://lduros.net/assets/librejs/tests/intrinsec-event/> This page
+ contains trivial on-page code, with an intrinsic event in an html
+ attribute (onload). All JavaScript is being executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/>
+ This page contains on-page trivial JavaScript (only makes a window
+ alert and loads an external script using the html <script> tag with
+ the src attribute. The external script is free (GPL v3), and since
+ it is only nontrivial because it defines a function, the on-page
+ trivial code is allowed to use it. All JavaScript is being
+ executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/>
+ This page contains trivial on-page JavaScript code, and loads an
+ external script that is free. Since no function is defined, the
+ external script is being analyzed. The external script is free.
+ Trivial here is not allowed because the external script, although
+ free, writes a script. The inline trivial script should also have
+ a free license notice for it to be interpreted.
+
+ *
+ <http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html>
+ This is a real-life example of a small jQuery plugin. The on-page
+ JavaScript code has a free license. The jQuery external file has a
+ free licensed. The shelltypist.js file has a free license as well.
+ All licenses are defined between '@licstart' and '@licend'. All
+ JavaScript is executed.
+
+ *
+ <http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html>
+ This is the same page than the previous example, except it does not
+ have a free license for the main HTML page on-page script. While
+ the actual code there is trivial, since jQuery defines methods that
+ make use of AJAX, trivial code is not allowed, and no JavaScript is
+ executed.
+
+ * <http://lduros.net/assets/librejs/tests/test-labels/> This page
+ contains JavaScript (jQuery minified) that does not have proper
+ license information in the file, as it has no '@licstart' '@licend'
+ comment. It would be considered nonfree, however, the page itself
+ uses the JavaScript Web Labels method. On the page itself, you
+ will find a link labeled "JavaScript License Information", which
+ leads to a page that contains a properly formatted table with the
+ required data on the external JavaScript file. LibreJS visits this
+ link and determines the version of jQuery linked from the original
+ page is the one listed there, and flags it as free. All JavaScript
+ is executed (and the title should turn green.)
+
+Appendix D GNU Free Documentation License
+*****************************************
+
+ Version 1.3, 3 November 2008
+
+ Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+ <http://fsf.org/>
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ 0. PREAMBLE
+
+ The purpose of this License is to make a manual, textbook, or other
+ functional and useful document "free" in the sense of freedom: to
+ assure everyone the effective freedom to copy and redistribute it,
+ with or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the
+ author and publisher a way to get credit for their work, while not
+ being considered responsible for modifications made by others.
+
+ This License is a kind of "copyleft", which means that derivative
+ works of the document must themselves be free in the same sense.
+ It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
+
+ We have designed this License in order to use it for manuals for
+ free software, because free software needs free documentation: a
+ free program should come with manuals providing the same freedoms
+ that the software does. But this License is not limited to
+ software manuals; it can be used for any textual work, regardless
+ of subject matter or whether it is published as a printed book. We
+ recommend this License principally for works whose purpose is
+ instruction or reference.
+
+ 1. APPLICABILITY AND DEFINITIONS
+
+ This License applies to any manual or other work, in any medium,
+ that contains a notice placed by the copyright holder saying it can
+ be distributed under the terms of this License. Such a notice
+ grants a world-wide, royalty-free license, unlimited in duration,
+ to use that work under the conditions stated herein. The
+ "Document", below, refers to any such manual or work. Any member
+ of the public is a licensee, and is addressed as "you". You accept
+ the license if you copy, modify or distribute the work in a way
+ requiring permission under copyright law.
+
+ A "Modified Version" of the Document means any work containing the
+ Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+
+ A "Secondary Section" is a named appendix or a front-matter section
+ of the Document that deals exclusively with the relationship of the
+ publishers or authors of the Document to the Document's overall
+ subject (or to related matters) and contains nothing that could
+ fall directly within that overall subject. (Thus, if the Document
+ is in part a textbook of mathematics, a Secondary Section may not
+ explain any mathematics.) The relationship could be a matter of
+ historical connection with the subject or with related matters, or
+ of legal, commercial, philosophical, ethical or political position
+ regarding them.
+
+ The "Invariant Sections" are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in the
+ notice that says that the Document is released under this License.
+ If a section does not fit the above definition of Secondary then it
+ is not allowed to be designated as Invariant. The Document may
+ contain zero Invariant Sections. If the Document does not identify
+ any Invariant Sections then there are none.
+
+ The "Cover Texts" are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice
+ that says that the Document is released under this License. A
+ Front-Cover Text may be at most 5 words, and a Back-Cover Text may
+ be at most 25 words.
+
+ A "Transparent" copy of the Document means a machine-readable copy,
+ represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images composed
+ of pixels) generic paint programs or (for drawings) some widely
+ available drawing editor, and that is suitable for input to text
+ formatters or for automatic translation to a variety of formats
+ suitable for input to text formatters. A copy made in an otherwise
+ Transparent file format whose markup, or absence of markup, has
+ been arranged to thwart or discourage subsequent modification by
+ readers is not Transparent. An image format is not Transparent if
+ used for any substantial amount of text. A copy that is not
+ "Transparent" is called "Opaque".
+
+ Examples of suitable formats for Transparent copies include plain
+ ASCII without markup, Texinfo input format, LaTeX input format,
+ SGML or XML using a publicly available DTD, and standard-conforming
+ simple HTML, PostScript or PDF designed for human modification.
+ Examples of transparent image formats include PNG, XCF and JPG.
+ Opaque formats include proprietary formats that can be read and
+ edited only by proprietary word processors, SGML or XML for which
+ the DTD and/or processing tools are not generally available, and
+ the machine-generated HTML, PostScript or PDF produced by some word
+ processors for output purposes only.
+
+ The "Title Page" means, for a printed book, the title page itself,
+ plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For
+ works in formats which do not have any title page as such, "Title
+ Page" means the text near the most prominent appearance of the
+ work's title, preceding the beginning of the body of the text.
+
+ The "publisher" means any person or entity that distributes copies
+ of the Document to the public.
+
+ A section "Entitled XYZ" means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ
+ stands for a specific section name mentioned below, such as
+ "Acknowledgements", "Dedications", "Endorsements", or "History".)
+ To "Preserve the Title" of such a section when you modify the
+ Document means that it remains a section "Entitled XYZ" according
+ to this definition.
+
+ The Document may include Warranty Disclaimers next to the notice
+ which states that this License applies to the Document. These
+ Warranty Disclaimers are considered to be included by reference in
+ this License, but only as regards disclaiming warranties: any other
+ implication that these Warranty Disclaimers may have is void and
+ has no effect on the meaning of this License.
+
+ 2. VERBATIM COPYING
+
+ You may copy and distribute the Document in any medium, either
+ commercially or noncommercially, provided that this License, the
+ copyright notices, and the license notice saying this License
+ applies to the Document are reproduced in all copies, and that you
+ add no other conditions whatsoever to those of this License. You
+ may not use technical measures to obstruct or control the reading
+ or further copying of the copies you make or distribute. However,
+ you may accept compensation in exchange for copies. If you
+ distribute a large enough number of copies you must also follow the
+ conditions in section 3.
+
+ You may also lend copies, under the same conditions stated above,
+ and you may publicly display copies.
+
+ 3. COPYING IN QUANTITY
+
+ If you publish printed copies (or copies in media that commonly
+ have printed covers) of the Document, numbering more than 100, and
+ the Document's license notice requires Cover Texts, you must
+ enclose the copies in covers that carry, clearly and legibly, all
+ these Cover Texts: Front-Cover Texts on the front cover, and
+ Back-Cover Texts on the back cover. Both covers must also clearly
+ and legibly identify you as the publisher of these copies. The
+ front cover must present the full title with all words of the title
+ equally prominent and visible. You may add other material on the
+ covers in addition. Copying with changes limited to the covers, as
+ long as they preserve the title of the Document and satisfy these
+ conditions, can be treated as verbatim copying in other respects.
+
+ If the required texts for either cover are too voluminous to fit
+ legibly, you should put the first ones listed (as many as fit
+ reasonably) on the actual cover, and continue the rest onto
+ adjacent pages.
+
+ If you publish or distribute Opaque copies of the Document
+ numbering more than 100, you must either include a machine-readable
+ Transparent copy along with each Opaque copy, or state in or with
+ each Opaque copy a computer-network location from which the general
+ network-using public has access to download using public-standard
+ network protocols a complete Transparent copy of the Document, free
+ of added material. If you use the latter option, you must take
+ reasonably prudent steps, when you begin distribution of Opaque
+ copies in quantity, to ensure that this Transparent copy will
+ remain thus accessible at the stated location until at least one
+ year after the last time you distribute an Opaque copy (directly or
+ through your agents or retailers) of that edition to the public.
+
+ It is requested, but not required, that you contact the authors of
+ the Document well before redistributing any large number of copies,
+ to give them a chance to provide you with an updated version of the
+ Document.
+
+ 4. MODIFICATIONS
+
+ You may copy and distribute a Modified Version of the Document
+ under the conditions of sections 2 and 3 above, provided that you
+ release the Modified Version under precisely this License, with the
+ Modified Version filling the role of the Document, thus licensing
+ distribution and modification of the Modified Version to whoever
+ possesses a copy of it. In addition, you must do these things in
+ the Modified Version:
+
+ A. Use in the Title Page (and on the covers, if any) a title
+ distinct from that of the Document, and from those of previous
+ versions (which should, if there were any, be listed in the
+ History section of the Document). You may use the same title
+ as a previous version if the original publisher of that
+ version gives permission.
+
+ B. List on the Title Page, as authors, one or more persons or
+ entities responsible for authorship of the modifications in
+ the Modified Version, together with at least five of the
+ principal authors of the Document (all of its principal
+ authors, if it has fewer than five), unless they release you
+ from this requirement.
+
+ C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+
+ D. Preserve all the copyright notices of the Document.
+
+ E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+
+ F. Include, immediately after the copyright notices, a license
+ notice giving the public permission to use the Modified
+ Version under the terms of this License, in the form shown in
+ the Addendum below.
+
+ G. Preserve in that license notice the full lists of Invariant
+ Sections and required Cover Texts given in the Document's
+ license notice.
+
+ H. Include an unaltered copy of this License.
+
+ I. Preserve the section Entitled "History", Preserve its Title,
+ and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on the
+ Title Page. If there is no section Entitled "History" in the
+ Document, create one stating the title, year, authors, and
+ publisher of the Document as given on its Title Page, then add
+ an item describing the Modified Version as stated in the
+ previous sentence.
+
+ J. Preserve the network location, if any, given in the Document
+ for public access to a Transparent copy of the Document, and
+ likewise the network locations given in the Document for
+ previous versions it was based on. These may be placed in the
+ "History" section. You may omit a network location for a work
+ that was published at least four years before the Document
+ itself, or if the original publisher of the version it refers
+ to gives permission.
+
+ K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the section
+ all the substance and tone of each of the contributor
+ acknowledgements and/or dedications given therein.
+
+ L. Preserve all the Invariant Sections of the Document, unaltered
+ in their text and in their titles. Section numbers or the
+ equivalent are not considered part of the section titles.
+
+ M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+
+ N. Do not retitle any existing section to be Entitled
+ "Endorsements" or to conflict in title with any Invariant
+ Section.
+
+ O. Preserve any Warranty Disclaimers.
+
+ If the Modified Version includes new front-matter sections or
+ appendices that qualify as Secondary Sections and contain no
+ material copied from the Document, you may at your option designate
+ some or all of these sections as invariant. To do this, add their
+ titles to the list of Invariant Sections in the Modified Version's
+ license notice. These titles must be distinct from any other
+ section titles.
+
+ You may add a section Entitled "Endorsements", provided it contains
+ nothing but endorsements of your Modified Version by various
+ parties--for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative
+ definition of a standard.
+
+ You may add a passage of up to five words as a Front-Cover Text,
+ and a passage of up to 25 words as a Back-Cover Text, to the end of
+ the list of Cover Texts in the Modified Version. Only one passage
+ of Front-Cover Text and one of Back-Cover Text may be added by (or
+ through arrangements made by) any one entity. If the Document
+ already includes a cover text for the same cover, previously added
+ by you or by arrangement made by the same entity you are acting on
+ behalf of, you may not add another; but you may replace the old
+ one, on explicit permission from the previous publisher that added
+ the old one.
+
+ The author(s) and publisher(s) of the Document do not by this
+ License give permission to use their names for publicity for or to
+ assert or imply endorsement of any Modified Version.
+
+ 5. COMBINING DOCUMENTS
+
+ You may combine the Document with other documents released under
+ this License, under the terms defined in section 4 above for
+ modified versions, provided that you include in the combination all
+ of the Invariant Sections of all of the original documents,
+ unmodified, and list them all as Invariant Sections of your
+ combined work in its license notice, and that you preserve all
+ their Warranty Disclaimers.
+
+ The combined work need only contain one copy of this License, and
+ multiple identical Invariant Sections may be replaced with a single
+ copy. If there are multiple Invariant Sections with the same name
+ but different contents, make the title of each such section unique
+ by adding at the end of it, in parentheses, the name of the
+ original author or publisher of that section if known, or else a
+ unique number. Make the same adjustment to the section titles in
+ the list of Invariant Sections in the license notice of the
+ combined work.
+
+ In the combination, you must combine any sections Entitled
+ "History" in the various original documents, forming one section
+ Entitled "History"; likewise combine any sections Entitled
+ "Acknowledgements", and any sections Entitled "Dedications". You
+ must delete all sections Entitled "Endorsements."
+
+ 6. COLLECTIONS OF DOCUMENTS
+
+ You may make a collection consisting of the Document and other
+ documents released under this License, and replace the individual
+ copies of this License in the various documents with a single copy
+ that is included in the collection, provided that you follow the
+ rules of this License for verbatim copying of each of the documents
+ in all other respects.
+
+ You may extract a single document from such a collection, and
+ distribute it individually under this License, provided you insert
+ a copy of this License into the extracted document, and follow this
+ License in all other respects regarding verbatim copying of that
+ document.
+
+ 7. AGGREGATION WITH INDEPENDENT WORKS
+
+ A compilation of the Document or its derivatives with other
+ separate and independent documents or works, in or on a volume of a
+ storage or distribution medium, is called an "aggregate" if the
+ copyright resulting from the compilation is not used to limit the
+ legal rights of the compilation's users beyond what the individual
+ works permit. When the Document is included in an aggregate, this
+ License does not apply to the other works in the aggregate which
+ are not themselves derivative works of the Document.
+
+ If the Cover Text requirement of section 3 is applicable to these
+ copies of the Document, then if the Document is less than one half
+ of the entire aggregate, the Document's Cover Texts may be placed
+ on covers that bracket the Document within the aggregate, or the
+ electronic equivalent of covers if the Document is in electronic
+ form. Otherwise they must appear on printed covers that bracket
+ the whole aggregate.
+
+ 8. TRANSLATION
+
+ Translation is considered a kind of modification, so you may
+ distribute translations of the Document under the terms of section
+ 4. Replacing Invariant Sections with translations requires special
+ permission from their copyright holders, but you may include
+ translations of some or all Invariant Sections in addition to the
+ original versions of these Invariant Sections. You may include a
+ translation of this License, and all the license notices in the
+ Document, and any Warranty Disclaimers, provided that you also
+ include the original English version of this License and the
+ original versions of those notices and disclaimers. In case of a
+ disagreement between the translation and the original version of
+ this License or a notice or disclaimer, the original version will
+ prevail.
+
+ If a section in the Document is Entitled "Acknowledgements",
+ "Dedications", or "History", the requirement (section 4) to
+ Preserve its Title (section 1) will typically require changing the
+ actual title.
+
+ 9. TERMINATION
+
+ You may not copy, modify, sublicense, or distribute the Document
+ except as expressly provided under this License. Any attempt
+ otherwise to copy, modify, sublicense, or distribute it is void,
+ and will automatically terminate your rights under this License.
+
+ However, if you cease all violation of this License, then your
+ license from a particular copyright holder is reinstated (a)
+ provisionally, unless and until the copyright holder explicitly and
+ finally terminates your license, and (b) permanently, if the
+ copyright holder fails to notify you of the violation by some
+ reasonable means prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+ reinstated permanently if the copyright holder notifies you of the
+ violation by some reasonable means, this is the first time you have
+ received notice of violation of this License (for any work) from
+ that copyright holder, and you cure the violation prior to 30 days
+ after your receipt of the notice.
+
+ Termination of your rights under this section does not terminate
+ the licenses of parties who have received copies or rights from you
+ under this License. If your rights have been terminated and not
+ permanently reinstated, receipt of a copy of some or all of the
+ same material does not give you any rights to use it.
+
+ 10. FUTURE REVISIONS OF THIS LICENSE
+
+ The Free Software Foundation may publish new, revised versions of
+ the GNU Free Documentation License from time to time. Such new
+ versions will be similar in spirit to the present version, but may
+ differ in detail to address new problems or concerns. See
+ <http://www.gnu.org/copyleft/>.
+
+ Each version of the License is given a distinguishing version
+ number. If the Document specifies that a particular numbered
+ version of this License "or any later version" applies to it, you
+ have the option of following the terms and conditions either of
+ that specified version or of any later version that has been
+ published (not as a draft) by the Free Software Foundation. If the
+ Document does not specify a version number of this License, you may
+ choose any version ever published (not as a draft) by the Free
+ Software Foundation. If the Document specifies that a proxy can
+ decide which future versions of this License can be used, that
+ proxy's public statement of acceptance of a version permanently
+ authorizes you to choose that version for the Document.
+
+ 11. RELICENSING
+
+ "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
+ World Wide Web server that publishes copyrightable works and also
+ provides prominent facilities for anybody to edit those works. A
+ public wiki that anybody can edit is an example of such a server.
+ A "Massive Multiauthor Collaboration" (or "MMC") contained in the
+ site means any set of copyrightable works thus published on the MMC
+ site.
+
+ "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
+ license published by Creative Commons Corporation, a not-for-profit
+ corporation with a principal place of business in San Francisco,
+ California, as well as future copyleft versions of that license
+ published by that same organization.
+
+ "Incorporate" means to publish or republish a Document, in whole or
+ in part, as part of another Document.
+
+ An MMC is "eligible for relicensing" if it is licensed under this
+ License, and if all works that were first published under this
+ License somewhere other than this MMC, and subsequently
+ incorporated in whole or in part into the MMC, (1) had no cover
+ texts or invariant sections, and (2) were thus incorporated prior
+ to November 1, 2008.
+
+ The operator of an MMC Site may republish an MMC contained in the
+ site under CC-BY-SA on the same site at any time before August 1,
+ 2009, provided the MMC is eligible for relicensing.
+
+ADDENDUM: How to use this License for your documents
+====================================================
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and license
+notices just after the title page:
+
+ Copyright (C) YEAR YOUR NAME.
+ 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, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover
+Texts, replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with
+ the Front-Cover Texts being LIST, and with the Back-Cover Texts
+ being LIST.
+
+ If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+ If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of free
+software license, such as the GNU General Public License, to permit
+their use in free software.
+
diff --git a/doc/manual/librejs.txt.gz b/doc/manual/librejs.txt.gz
new file mode 100644
index 0000000..b59d944
--- /dev/null
+++ b/doc/manual/librejs.txt.gz
Binary files differ
diff --git a/doc/version.texi b/doc/version.texi
new file mode 100644
index 0000000..add080b
--- /dev/null
+++ b/doc/version.texi
@@ -0,0 +1,4 @@
+@set UPDATED 17 January 2015
+@set UPDATED-MONTH January 2015
+@set EDITION 2
+@set VERSION 6.0.8.20150117
diff --git a/install-sh b/install-sh
new file mode 100644
index 0000000..377bb86
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,527 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2011-11-20.07; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call 'install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names problematic for 'test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/lib/addon_management/install_uninstall.js b/lib/addon_management/install_uninstall.js
new file mode 100644
index 0000000..8ef9cbf
--- /dev/null
+++ b/lib/addon_management/install_uninstall.js
@@ -0,0 +1,65 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * The following module is intended to perform tasks when the
+ * add-on is enabled and disabled.
+ */
+
+const {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+const httpObserver = require("http_observer/http_request_observer");
+var narcissusWorker = require("parser/narcissus_worker")
+ .narcissusWorker;
+const caching = require("http_observer/caching");
+
+const prompt = Cc["@mozilla.org/embedcomp/prompt-service;1"].
+ getService(Ci.nsIPromptService);
+
+
+const tabs = require('sdk/tabs');
+
+/**
+ * Stop the httpObserver when the add-on is disabled or removed.
+ */
+exports.onUnload = function(reason) {
+ if (reason == "disable" ||
+ reason == "shutdown" ||
+ reason == "upgrade" ||
+ reason == "downgrade") {
+ require("settings/storage").librejsStorage.writeCacheToDB();
+ // remove all http notifications
+ httpObserver.removeHttpObserver();
+ // remove worker.
+ narcissusWorker.stopWorker();
+ }
+
+};
+
+exports.onLoad = function () {
+ try {
+ var clearCache = prompt.dialog(null, "LibreJS installation", "If you have tabs and windows opened prior to installing LibreJS, you will have to refresh them for their JavaScript to be analyzed and blocked. Press OK to clear the browser cache.");
+ if (clearCache) {
+ caching.clearAllCache();
+ }
+ } catch (e) {
+ console.debug(e);
+ }
+};
diff --git a/lib/addon_management/prefchange.js b/lib/addon_management/prefchange.js
new file mode 100644
index 0000000..6894be4
--- /dev/null
+++ b/lib/addon_management/prefchange.js
@@ -0,0 +1,124 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var whitelist = [];
+
+var prefSet = require("sdk/simple-prefs");
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+var prompt = Cc['@mozilla.org/embedcomp/prompt-service;1'].
+ getService(Ci.nsIPromptService);
+var scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+
+var setWhitelist = function () {
+ whitelist = [];
+
+ var str;
+ var whitelistString;
+ if (typeof prefSet.prefs.whitelist === 'undefined') {
+ whitelistString = '';
+ } else {
+ whitelistString = prefSet.prefs.whitelist.split(',');
+ }
+
+ for (var i = 0; i < whitelistString.length; i++) {
+ // remove space, trailing slash, escape any nonalpha except *,
+ // replace * with .*
+ str = whitelistString[i]
+ .replace(" ", "").replace(/\/$/, "")
+ .replace(/[^a-z0-9\*]/ig, "\\$&").replace("*", ".*");
+
+ if (str !== '') {
+ whitelist.push(
+ new RegExp('^https?:\/\/(www\\.)?' + str + '/', 'i'));
+ }
+ }
+};
+
+exports.getWhitelist = function () {
+ return whitelist;
+};
+
+exports.init = function () {
+ setWhitelist();
+};
+
+prefSet.on("whitelist", setWhitelist);
+
+/*var setDryRun = function () {
+ var dryRun = prefSet.prefs.dryrun;
+ if (dryRun === true) {
+ prompt.alert(null, "LibreJS Dry Run Mode", "Is Dry Run Mode really what you want? LibreJS will still analyze JavaScript on a page, but it will not block any of it. As a result, ALL of the JavaScript on a page will run as is, whether it is free and trivial or not. You will not be warned again. Uncheck that box if you are unsure.");
+ scriptsCached.resetCache();
+ } else {
+ prompt.alert(null, "LibreJS Dry Run Mode", "LibreJS Dry Run Mode is now disabled");
+ }
+};*/
+
+//prefSet.on("dryrun", setDryRun);
+
+/*exports.isDryRun = function () {
+ // Returns true if dryRun mode is enabled. False otherwise.
+ //return prefSet.prefs.dryrun;
+ return false;
+};*/
+
+var setComplaintTab = function () {
+ var complaintTab = prefSet.prefs.complaint_tab;
+ if (complaintTab === true) {
+ prompt.alert(null, "Turning on complaint tab", "A complaint tab will be displayed on pages where nonfree nontrivial JavaScript is found and contact information is found as well.");
+ } else {
+ prompt.alert(null, "Turning off complaint tab", "No complaint tab will appear on pages, even when nonfree nontrivial JavaScript is found.");
+ }
+};
+prefSet.on("complaint_tab", setComplaintTab);
+
+exports.isComplaintTab = function () {
+ /**
+ * Returns true if complaint tab mode is enabled. False otherwise.
+ */
+ return prefSet.prefs.complaint_tab;
+};
+
+var setDisplayNotifications = function () {
+ var displayNotifications = prefSet.prefs.display_notifications;
+ if (displayNotifications === true) {
+ prompt.alert(null, "Turning on notifications", "Notifications with code snippets will now appear while LibreJS is analyzing JavaScript on a page.");
+ } else {
+ prompt.alert(null, "Turning off notifications", "Notifications of code being analyzed will not be displayed.");
+ }
+};
+
+prefSet.on("display_notifications", setDisplayNotifications);
+
+exports.isDisplayNotifications = function () {
+ /**
+ * Returns true if complaint tab mode is enabled. False otherwise.
+ */
+ return prefSet.prefs.display_notifications;
+};
+
+exports.complaintEmailSubject = function() {
+ return prefSet.prefs.complaint_email_subject;
+};
+
+exports.complaintEmailBody = function() {
+ return prefSet.prefs.complaint_email_body;
+};
diff --git a/lib/html_script_finder/bug_fix.js b/lib/html_script_finder/bug_fix.js
new file mode 100644
index 0000000..bba7653
--- /dev/null
+++ b/lib/html_script_finder/bug_fix.js
@@ -0,0 +1,23 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+exports.END_OF_SCRIPT = 'this.narcissusBugFixLibreJS'; // value from parse tree without \n\n
+exports.narcissusBugFixLibreJS = '\n\n' + exports.END_OF_SCRIPT; // real value from source.
+
diff --git a/lib/html_script_finder/dom_handler.js b/lib/html_script_finder/dom_handler.js
new file mode 100644
index 0000000..0f461d3
--- /dev/null
+++ b/lib/html_script_finder/dom_handler.js
@@ -0,0 +1,571 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ *
+ * dom_handler.js
+ *
+ * After the HTML DOM has been parsed, domHandler finds all the scripts
+ * on a page (including inline, on-page, and external files), and triggers the
+ * JavaScript analysis for each of them.
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+var scriptProperties =
+ require("html_script_finder/dom_handler/script_properties");
+
+const scriptTypes = scriptProperties.scriptTypes;
+const statusTypes = scriptProperties.statusTypes;
+const reasons = scriptProperties.reasons;
+
+var urlHandler = require("url_handler/url_handler");
+
+var WebLabelFinder =
+ require("html_script_finder/web_labels/js_web_labels").WebLabelFinder;
+
+// object model for script entries.
+var scriptObject = require("html_script_finder/dom_handler/script_object");
+
+var privacyChecker = require("js_checker/privacy_checker").privacyCheck;
+var jsChecker = require("js_checker/js_checker");
+const types = require("js_checker/constant_types");
+
+var checkTypes = types.checkTypes;
+
+var stripCDATAOpen = /<\!\[CDATA\[/gi;
+var stripCDATAClose = /]]>/g;
+
+var isDryRun = require("addon_management/prefchange").isDryRun;
+var allowedRef = require('http_observer/allowed_referrers').allowedReferrers;
+var attributeHelpers = require("html_script_finder/dom_handler/attributes");
+
+// javascript:*
+var jsInAttrRe = attributeHelpers.jsInAttrRe;
+
+// the list of all available event attributes
+var intrinsicEvents = attributeHelpers.intrinsicEvents;
+
+var domGatherer =
+ require("html_script_finder/dom_handler/dom_gatherer").domGatherer;
+var domChecker =
+ require("html_script_finder/dom_handler/dom_checker").domChecker;
+
+/**
+ * The DomHandler object takes a whole document,
+ * finds script elements within that DOM, analyzes them
+ * using the js_checker module and finally returns a cleaned
+ * DOM depending on the result.
+ */
+var DomHandler = function() {
+ // external object with methods used
+ // in DomHandler
+ this.domGatherer = null;
+
+ // external object with methods used
+ // in DomHandler
+ this.domChecker = null;
+
+ this.dom = null;
+ this.pageURL = null;
+
+ // fragment found in url.
+ this.fragment = null;
+
+ // array containing all scripts on a page.
+ this.domScripts = [];
+
+ // array containing all scripts on a page,
+ // data related to them, such as parse tree, ...
+ this.inlineScripts = [];
+
+ this.externalScripts = [];
+
+ // all scripts.
+ this.scripts = [];
+
+ // keeps track of the number of scripts.
+ this.numScripts = 0;
+
+ // store the reference to the callback method
+ // presumably from htmlParser.
+ this.callback = function() {};
+
+ // boolean set to true if external scripts are loaded
+ // from the html page.
+ this.loadsHtmlExternalScripts = false;
+
+ this.jsCheckString = null;
+
+ /* object containing boolean property set to false if trivialness
+ is not allowed anymore (if another script defines ajax requests,
+ ...) */
+ this.allowTrivial = null;
+
+ // boolean set to true if inline JavaScript
+ // is found to be free.
+ this.inlineJsFree = null;
+
+ // boolean set to true when at least one script
+ // has been removed.
+ this.hasRemovedScripts = null;
+
+ // boolean to check if scripts were removed
+ // prevents removeAllJs from running multiple times.
+ this.removedAllScripts = null;
+
+ // will eventually contain an array of data
+ // for the js web labels licenses.
+ this.licenseList = [];
+
+ // the response status for the page (200, 404, ...)
+ this.responseStatus = null;
+
+ // number of scripts fully tested.
+ this.scriptsTested = 0;
+
+ // number of external scripts to be tested.
+ this.numExternalScripts = null;
+
+ // number of inline/inattribute scripts
+ this.numInlineScripts = null;
+};
+
+/**
+ * Initialize properties of the object
+ *
+ * @param {domObject} obj A reference of the DOM object being
+ * analyzed.
+ *
+ * @param {pageURL} string The formatted URL (with fragment
+ * removed) of the corresponding page for this DOM
+ *
+ * @param {fragment} the #fragment from the url if applicable.
+ *
+ * @param {callback} the callback function.
+ *
+ */
+DomHandler.prototype.init = function(
+ domObject, pageURL, fragment, responseStatus, callback
+) {
+ // initialize object properties.
+
+ console.debug('init', pageURL);
+ var that = this;
+
+ this.reset();
+
+ // arguments passed.
+ this.dom = domObject;
+ this.pageURL = pageURL;
+ this.fragment = fragment;
+ this.responseStatus = responseStatus;
+
+ console.debug('in dom handler, responseStatus is', this.responseStatus);
+
+ // make callback function available
+ // for the entire object.
+ this.callback = function (dom) {
+ callback(dom);
+ that.destroy();
+ };
+};
+
+DomHandler.prototype.reset = function () {
+
+ this.dom = null;
+ // arrays.
+ this.onEventElement = [];
+ this.scriptStatus = [];
+ this.inlineScripts = [];
+ this.externalScripts = [];
+ this.scripts = [];
+
+ // booleans
+ this.allowTrivial = true;
+ this.inlineJsFree = false;
+ this.hasRemovedScripts = false;
+ this.removedAllScripts = false;
+
+ // we start with 0, and will increment in
+ // dom_checker.
+ this.numExternalScripts = 0;
+
+ this.numInlineScripts = 0;
+
+ this.scriptsTested = 0;
+
+};
+
+DomHandler.prototype.destroy = function () {
+ this.domGatherer = null;
+ this.domChecker = null;
+ /* destroy callback so that it can't be called multiple times. */
+ this.callback = function() {};
+ //this.reset();
+};
+
+DomHandler.prototype.scriptHasBeenTested = function() {
+ this.scriptsTested++;
+ console.debug('incremented DomHandler.scriptsTested to',
+ this.scriptsTested);
+};
+
+/**
+ * scriptHasJsWebLabel
+ *
+ * Checks if a script was found earlier in a Js License Web Label
+ * table. See http://www.gnu.org/licenses/javascript-labels.html
+ * for more information.
+ *
+ */
+DomHandler.prototype.scriptHasJsWebLabel = function(script) {
+ if (this.licenseList) {
+
+ var url = urlHandler.resolve(this.pageURL, script.src),
+ i = 0,
+ len = this.licenseList.length;
+
+ console.debug('looking for web label');
+
+ for (; i < len; i++) {
+ if (this.licenseList[i].fileUrl === url &&
+ this.licenseList[i].free === true
+ ) {
+ console.debug('found something true');
+ console.debug(
+ this.licenseList[i].fileUrl, ' is found');
+ return true;
+ }
+ }
+ }
+ return false;
+};
+
+/**
+ * processScripts.
+ * Starts by looking for a js web labels page
+ * then calls the complete function, which runs
+ * the rest of the check.
+ */
+DomHandler.prototype.processScripts = function () {
+ var that = this;
+
+ // check for the existence of the
+ // js web labels first.
+ this.lookForJsWebLabels(function () {
+
+ // gather and check all script elements on
+ // page.
+ console.debug("Calling checkAllScripts");
+ that.checkAllScripts();
+
+ });
+
+};
+
+/**
+ * jsWebLabelsComplete
+ *
+ */
+DomHandler.prototype.checkAllScripts = function () {
+ try {
+ console.debug(
+ 'found in', this.pageURL, JSON.stringify(this.licenseList));
+ console.debug('checkAllScripts triggered async');
+
+ // use domGatherer to gather scripts.
+ this.domGatherer.findScripts();
+ this.domGatherer.gatherScriptsContent();
+ this.domGatherer.gatherIntrinsicEvents();
+
+ console.debug('fragment is', this.fragment);
+
+ if (
+ this.fragment === undefined ||
+ this.fragment === null ||
+ this.fragment.indexOf('librejs=true') < 0
+ ) {
+ try {
+
+ // use domChecker to check scripts.
+ console.debug("Calling checkAllInlineScripts");
+ this.domChecker.checkAllInlineScripts();
+ } catch (x) {
+ console.debug('error in domChecker:', x, x.lineNumber);
+ this.removeAllJs();
+ }
+ } else {
+ console.debug('This is a pageworker, removing all js');
+ // this is the Page Worker to find contact link
+ // just remove all the JS since we don't need it.
+ console.debug('fragment found, remove js');
+ this.removeAllJs();
+ }
+ } catch (x) {
+ console.debug('error', x, x.lineNumber, x.fileName);
+ }
+};
+
+/**
+ * lookForJsWebLabels
+ *
+ * Checks if a link to a js web label table exists.
+ * If it does, return an array of objects with the data
+ * gathered (script name, path, license name, url, ...)
+ *
+ */
+DomHandler.prototype.lookForJsWebLabels = function (completed) {
+ var that = this;
+ console.debug("calling lookForJsWebLabels");
+ if (this.fragment !== '#librejs=true') {
+ var webLabelFinder = new WebLabelFinder();
+ webLabelFinder.init(
+ this.dom,
+ this.pageURL,
+ function (licenseList) {
+ // assign array returned to property.
+ that.licenseList = licenseList;
+ console.debug("calling completed");
+ completed();
+ });
+ } else {
+ completed();
+ }
+};
+
+DomHandler.prototype.checkScriptForJsWebLabels = function(script) {
+ var scriptEntry;
+
+ if (this.hasSrc(script) && this.scriptHasJsWebLabel(script)) {
+ // This script is in the list of allowed scripts (through web labels)
+ scriptEntry = scriptObject.Script({
+ 'type': scriptTypes.EXTERNAL,
+ 'status': statusTypes.ACCEPTED,
+ 'element': script,
+ 'url': urlHandler.resolve(this.pageURL, script.src)
+ });
+
+ scriptEntry.tagAsAccepted(this.pageURL, reasons.FREE);
+ return true;
+ }
+};
+
+/**
+ * hasSrc
+ * Check the given script has an src attribute.
+ * @param script obj The script element.
+ * @return a string with the value of the src attribute.
+ */
+DomHandler.prototype.hasSrc = function(script) {
+ if (script.src) {
+ return script.src;
+ }
+ return false;
+};
+
+/**
+ * Uses relationChecker to guess whether the script only uses
+ * predefined functions/variables or interacts with other scripts
+ * (this is still very experimental and needs improvement.)
+ *
+ */
+DomHandler.prototype.removeScriptIfDependent = function (script) {
+ var nonWindowProps = script.tree.relationChecker.nonWindowProperties;
+
+ for (var entry in nonWindowProps) {
+ if (nonWindowProps[entry]) {
+ console.debug('script has non window properties.');
+ this.removeGivenJs(script, reasons.TRIVIAL_NOT_ALLOWED);
+ return true;
+ }
+ }
+};
+
+/**
+ * removeGivenJs
+ * Remove a single script from the DOM.
+ * @param script Obj The script element to be removed from the
+ * DOM.
+ *
+ */
+DomHandler.prototype.removeGivenJs = function (script, reason, singleton, hash) {
+ var commentedOut;
+ var isAllowed = allowedRef.urlInAllowedReferrers(this.pageURL);
+ console.debug("removing given js hash", hash);
+
+ if (script.status != statusTypes.REJECTED &&
+ script.status != statusTypes.JSWEBLABEL
+ ) {
+ console.debug('removing a', script.type);
+ if (script.type === scriptTypes.ATTRIBUTE &&
+ !isAllowed
+ ) {
+ this.removeGivenAttribute(script, reason);
+ return;
+ }
+ if (!isAllowed) {
+ // set invalid type if dry run off.
+ script.element.setAttribute('type', 'librejs/blocked');
+ // add entry as removed.
+ console.debug('removeGivenJs hash is', hash);
+ script.tagAsRemoved(this.pageURL, reason, hash);
+ } else {
+ script.element.setAttribute(
+ 'data-librejs-dryrun', 'librejs/blocked');
+ script.tagAsDryRun(this.pageURL, reason, hash);
+ }
+
+ if (singleton === true) {
+ // flag singletons.
+ script.element.setAttribute('data-singleton', 'true');
+ }
+
+ // remove src if dry run off.
+ if (script.element.getAttribute('src') !== undefined) {
+ script.element.setAttribute(
+ 'data-librejs-blocked-src',
+ script.element.getAttribute('src')
+ );
+ if (!isAllowed) {
+ script.element.removeAttribute('src');
+ }
+ }
+ if (isAllowed) {
+ comment_str = 'LibreJS: Script should be blocked, but page is whitelisted.';
+ script.status = statusTypes.ACCEPTED;
+ } else {
+ comment_str = 'LibreJS: script blocked.';
+ script.status = statusTypes.REJECTED;
+ }
+
+ commentedOut = this.dom.createComment(comment_str);
+ // add a comment for curious source readers.
+ script.element.parentNode.appendChild(commentedOut);
+ script.element.parentNode.insertBefore(commentedOut, script.element);
+ this.hasRemovedScripts = true;
+ }
+};
+
+DomHandler.prototype.removeGivenAttribute = function (script, reason) {
+ var i = 0,
+ le = script.jsAttributes.length;
+
+ console.debug('removing given attribute', script, reason);
+ script.element.setAttribute('data-librejs-blocked-event',
+ JSON.stringify(script.jsAttributes));
+
+ script.tagAsRemoved(this.pageURL, reason, script.hash || script.tree.hash);
+
+ // might need to be removed.
+ script.element.setAttribute('data-librejs-blocked-value', '');
+
+ if (!allowedRef.urlInAllowedReferrers(this.pageURL)) {
+ // only run if not in dry run mode.
+ for (; i < le; i++) {
+ console.debug('removing attribute', JSON.stringify(script.jsAttributes));
+ script.element.removeAttribute(script.jsAttributes[i].attribute);
+ }
+ } else {
+
+ }
+ this.hasRemovedScripts = true;
+};
+
+/**
+ * removeAllJs
+ * Loop through all scripts from top to bottom and add a type
+ * attribute 'librejs/blocked' to prevent their interpretation
+ * by the browser.
+ *
+ */
+DomHandler.prototype.removeAllJs = function (reason) {
+ // remove all js is useless from now on.
+ console.debug('removeAllJs');
+ this.hasRemovedScripts = true;
+
+ // removeAllJs needs not be run next time.
+ this.removedAllScripts = true;
+
+ try {
+ this.removeAllArray(this.scripts, reason);
+ this.callback(this.dom);
+ } catch (x) {
+ console.debug(
+ 'in removeAllJs method: ',
+ x,
+ 'number of scripts is',
+ this.numScripts
+ );
+ this.callback(this.dom);
+ }
+
+};
+
+DomHandler.prototype.removeAllArray = function(scriptArray, reason) {
+ var script, i = 0, le;
+ console.debug('removeAllArray');
+ try {
+ le = scriptArray.length;
+ // loop through all scripts.
+
+ for (; i < le; i++) {
+ script = scriptArray[i];
+ if (script.type === scriptTypes.INLINE ||
+ script.type === scriptTypes.EXTERNAL
+ ) {
+ this.removeGivenJs(script, reason);
+ }
+ else if (script.type === scriptTypes.ATTRIBUTE) {
+ this.removeGivenAttribute(script, reason);
+ }
+ }
+ } catch (e) {
+ this.callback("");
+ }
+
+};
+
+exports.DomHandler = DomHandler;
+
+/**
+ * exports.domHandler
+ * Instantiates a DomHandler and checks the DOM
+ * @param dom obj The given dom for analysis.
+ * @param pageURL string the URL for the page.
+ * @param callback function callback when all the work has been performed.
+ */
+exports.domHandler = function(
+ dom, pageURL, fragment, responseStatus, callback) {
+ console.debug("Creating domHandler");
+ var domHandler = new DomHandler();
+ domHandler.init(dom, pageURL, fragment, responseStatus, callback);
+
+ // use domGatherer methods.
+ domHandler.domGatherer = domGatherer(domHandler);
+
+ // use domChecker methods.
+ domHandler.domChecker = domChecker(domHandler);
+
+ // launch the whole process.
+ console.debug("Calling processScripts");
+ domHandler.processScripts();
+};
diff --git a/lib/html_script_finder/dom_handler/attributes.js b/lib/html_script_finder/dom_handler/attributes.js
new file mode 100644
index 0000000..3e95bab
--- /dev/null
+++ b/lib/html_script_finder/dom_handler/attributes.js
@@ -0,0 +1,137 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// object model for script entries.
+var scriptObject = require("html_script_finder/dom_handler/script_object");
+
+var scriptProperties = require("html_script_finder/dom_handler/script_properties");
+
+const scriptTypes = scriptProperties.scriptTypes;
+
+const statusTypes = scriptProperties.statusTypes;
+
+var jsInAttrRe = /javascript:/ig;
+
+// the list of all available event attributes
+var intrinsicEvents = [
+ "onload",
+ "onunload",
+ "onclick",
+ "ondblclick",
+ "onmousedown",
+ "onmouseup",
+ "onmouseover",
+ "onmousemove",
+ "onmouseout",
+ "onfocus",
+ "onblur",
+ "onkeypress",
+ "onkeydown",
+ "onkeyup",
+ "onsubmit",
+ "onreset",
+ "onselect",
+ "onchange"];
+
+exports.jsInAttrRe = jsInAttrRe;
+exports.intrinsicEvents = intrinsicEvents;
+
+
+/**
+ * findJSinAttribute
+ *
+ * Looks for attributes containing 'javascript:'
+ *
+ */
+exports.findJSinAttribute = function (elem, callback) {
+ var i = 0, attrLen = elem.attributes.length;
+
+ var attribPairs = [];
+
+ for (; i < attrLen; i++) {
+
+ //looping through all attributes in elem to look for "javascript:"
+ attrib = elem.attributes[i];
+
+ if (attrib.value.match(jsInAttrRe)) {
+ str = attrib.value.replace(jsInAttrRe, '');
+ attribPairs.push({attribute: attrib.name, value: str});
+ }
+
+ }
+
+ if (attribPairs.length > 0) {
+ // contains in attribute javascript.
+ scriptEntry = scriptObject.Script({'type': scriptTypes.ATTRIBUTE,
+ 'status': statusTypes.UNCHECKED,
+ 'element': elem,
+ 'jsAttributes': attribPairs
+ });
+
+ // push back to DOMHandler
+ callback(scriptEntry);
+
+ } else {
+ callback(false);
+ }
+
+};
+
+/**
+ * findOnJSAttribute.
+ *
+ * Look for attributes in on*
+ *
+ */
+exports.findOnJSAttribute = function (elem, callback) {
+
+ var i = 0, eventsLen = intrinsicEvents.length;
+
+ var attribPairs = [];
+
+ for (; i < eventsLen; i++) {
+
+ // looping through all on* attributes
+ if (elem.hasAttribute(intrinsicEvents[i])) {
+
+ attribPairs.push({
+ attribute: intrinsicEvents[i],
+ value: elem.getAttribute(intrinsicEvents[i])
+ });
+
+ }
+
+ }
+ if (attribPairs.length > 0) {
+
+ console.debug('found an attribute', scriptTypes.ATTRIBUTE);
+ scriptEntry = scriptObject.Script({'type': scriptTypes.ATTRIBUTE,
+ 'status': statusTypes.UNCHECKED,
+ 'element':elem,
+ 'jsAttributes': attribPairs
+ });
+ // Push back to DOMHandler.
+ // push back to DOMHandler
+ callback(scriptEntry);
+
+ } else {
+ callback(false);
+ }
+};
diff --git a/lib/html_script_finder/dom_handler/dom_checker.js b/lib/html_script_finder/dom_handler/dom_checker.js
new file mode 100644
index 0000000..1a0f30e
--- /dev/null
+++ b/lib/html_script_finder/dom_handler/dom_checker.js
@@ -0,0 +1,478 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * dom_checker.js
+ *
+ * checks scripts for nonfree/nontrivial.
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+var timer = require("sdk/timers");
+
+var scriptProperties = require("html_script_finder/dom_handler/script_properties");
+const scriptTypes = scriptProperties.scriptTypes;
+const statusTypes = scriptProperties.statusTypes;
+const reasons = scriptProperties.reasons;
+
+// ensure xhr won't create an infinite loop
+// with html content.
+var urlTester = require("html_script_finder/url_seen_tester").urlSeenTester;
+var urlHandler = require("url_handler/url_handler");
+
+var privacyChecker = require("js_checker/privacy_checker").privacyCheck;
+var jsChecker = require("js_checker/js_checker");
+
+const types = require("js_checker/constant_types");
+var checkTypes = types.checkTypes;
+var stripCDATAOpen = /<\!\[CDATA\[/gi;
+var stripCDATAClose = /]]>/g;
+
+const getHash = require("script_entries/scripts_cache").scriptsCached.getHash;
+
+var DomChecker = function() {
+ // reference to domHandler instance
+ // using this object.
+ this.d = null;
+};
+
+/**
+ * init
+ *
+ * assign a reference domHandler object
+ * to access/updates its properties.
+ *
+ */
+DomChecker.prototype.init = function(domHandler) {
+ "use strict";
+
+ this.d = domHandler;
+};
+
+DomChecker.prototype.destroy = function() {
+ "use strict";
+
+ this.d = null;
+};
+
+/**
+ * checkAllInlineScripts
+ *
+ * Sends all the inline/onpage scripts as a whole for a check and
+ * removes all scripts if nonfree nontrivial is found.
+ *
+ */
+DomChecker.prototype.checkAllInlineScripts = function() {
+ "use strict";
+
+ try {
+ var i = 0, len, script;
+
+ if (typeof this.d.inlineScripts !== 'undefined' &&
+ this.d.inlineScripts.length > 0
+ ) {
+ script = this.d.inlineScripts.shift();
+ console.debug("checking script for page",
+ this.d.pageURL
+ /*, JSON.stringify(script)*/);
+ if (this.d.removedAllScripts) {
+ // all js has already been removed.
+ // stop check.
+ console.debug("removed all");
+ return;
+ }
+
+ if (this.d.inlineJsFree === true) {
+ // add entry as accepted.
+ try {
+ hash = getHash(script.text);
+ script.tagAsAccepted(this.d.pageURL, reasons.FREE, hash);
+ } catch (e) {
+ console.debug(e);
+ }
+ }
+
+ // even if page is free we need to check for allow trivial.
+ if (script.type === scriptTypes.INLINE) {
+ console.debug("analyzing script", script);
+ this.analyzeJs(script,
+ script.text,
+ this.checkSingleInlineScript.bind(this));
+ } else if (script.type === scriptTypes.ATTRIBUTE) {
+ console.debug("analyzing inline script", script);
+ this.analyzeJs(script,
+ this.concatAttributes(script),
+ this.checkSingleElementAttributes.bind(this));
+ }
+ } else {
+ // no more inline scripts. Switch to external scripts.
+ this.readyForExternal();
+ }
+ } catch (x) {
+ console.debug('checkAllInlineScripts error',
+ x, x.lineNumber, x.fileName);
+ this.readyForExternal();
+ }
+};
+
+DomChecker.prototype.concatAttributes = function(script) {
+ "use strict";
+ var i = 0,
+ le = script.jsAttributes.length,
+ text = "";
+
+ // we concatenate all js in multiple attributes.
+ // because it's too much of a hassle to keep track
+ // otherwise.
+ for (; i < le; i++) {
+ text += script.jsAttributes[i].value + '\n';
+ }
+
+ return text;
+};
+
+/**
+ *
+ * check a single element with attributes
+ */
+DomChecker.prototype.checkSingleElementAttributes = function(
+ script, loadedScript, checker) {
+ "use strict";
+ var check, value,
+ i = 0,
+ le = script.jsAttributes.length,
+ text = "";
+
+ try {
+ check = checker.parseTree.freeTrivialCheck;
+ script.tree = checker;
+ script.result = check;
+ script.status = statusTypes.CHECKED;
+ } catch (e) {
+ console.debug('problem checking inline scripts', e, e.lineNumber);
+ this.d.removeGivenJs(script);
+ }
+
+ this.processInlineCheckResult(script, check, checker);
+};
+
+DomChecker.prototype.processInlineCheckResult = function(
+ script, check, checker) {
+ "use strict";
+ console.debug("check.reason is", check.reason, "and type", check.type);
+ var hash = checker.hash;
+
+ if (this.d.inlineJsFree === true) {
+ console.debug('tagging', script.text, 'as accepted', "with reason", check.reason);
+ script.tagAsAccepted(this.d.pageURL, this.d.freeReason + " -- " + check.reason, hash);
+ }
+
+ // process the result.
+ if (check.type === checkTypes.FREE) {
+ // this is free.
+ console.debug('tagging', script.text, 'as accepted with reason', check.reason);
+ this.d.inlineJsFree = true;
+ this.d.freeReason = check.reason;
+ // add entry as accepted.
+ script.tagAsAccepted(this.d.pageURL, check.reason, hash);
+ } else if (check.type === checkTypes.FREE_SINGLE_ITEM) {
+ // accept this script.
+ console.debug("free single item, ", check.reason);
+ script.tagAsAccepted(this.d.pageURL, check.reason, hash);
+ } else if (check.type === checkTypes.NONTRIVIAL) {
+ console.debug("nontrivial hash is", hash);
+ if (this.d.inlineJsFree) {
+ // inline is free. So accept.
+ console.debug('tagging', script.text, 'as accepted');
+ script.tagAsAccepted(
+ this.d.pageURL,
+ this.d.freeReason + ' -- ' + check.reason,
+ hash);
+ } else {
+ console.debug('tagging', script.text, 'as removed');
+ this.d.removeGivenJs(script, check.reason, false, hash);
+ }
+ } else if (!this.d.inlineJsFree &&
+ this.d.loadsHtmlExternalScripts &&
+ check.type === checkTypes.TRIVIAL_DEFINES_FUNCTION
+ ) {
+ // nontrivial, because defines function and loads
+ // external scripts
+ console.debug('tagging', script.text, 'as removed');
+ this.d.removeGivenJs(script, reasons.FUNCTIONS_INLINE, false, hash);
+ } else if (!this.d.loadsHtmlExternalScripts &&
+ check === checkTypes.TRIVIAL_DEFINES_FUNCTION
+ ) {
+ console.debug("Tag as accepted doesn't load another external script");
+ script.tagAsAccepted(this.d.pageURL, check.reason, hash);
+ } else if (check.type === checkTypes.TRIVIAL ||
+ check.type === checkTypes.TRIVIAL_DEFINES_FUNCTION ||
+ check.type === checkTypes.WHITELISTED
+ ) {
+ // add entry as accepted.
+ console.debug("Trivial accepted");
+ script.tagAsAccepted(this.d.pageURL, check.reason, hash);
+ }
+
+ // next inline script, if applicable.
+ this.checkAllInlineScripts();
+};
+
+DomChecker.prototype.readyForExternal = function() {
+ "use strict";
+
+ console.debug('DomChecker.readyForExternal');
+ // done with those inline scripts, continue with
+ // the rest.
+ this.checkExternalScripts();
+};
+
+/**
+ * check a single inline script.
+ */
+DomChecker.prototype.checkSingleInlineScript = function(
+ script, loadedScript, checker) {
+ "use strict";
+ var check, text;
+
+ console.debug('DomChecker.checkSingleInlineScript');
+
+ try {
+
+ check = checker.parseTree.freeTrivialCheck;
+
+ // update status.
+ script.tree = checker;
+ script.result = check;
+ console.debug("script result is", check.type);
+ script.status = statusTypes.CHECKED;
+
+ } catch (e) {
+ console.debug('problem checking inline scripts', e, e.lineNumber);
+ this.d.removeGivenJs(script, '', false, checker.hash);
+ }
+
+ this.processInlineCheckResult(script, check, checker);
+
+};
+
+/**
+ * checkExternalScripts
+ * Loop through series of external scripts,
+ * perform xhr to get their data, and check them
+ * to see whether they are free/nontrivial
+ *
+ */
+DomChecker.prototype.checkExternalScripts = function() {
+ "use strict";
+
+ console.debug('DomChecker.checkExternalScripts');
+
+ var i = 0;
+ var len = this.d.externalScripts.length;
+ var that = this;
+
+ console.debug("externalScripts length", len);
+ if (this.d.removedAllScripts || len === 0) {
+ // all js has already been removed.
+ // stop check.
+ this.wrapUpBeforeLeaving();
+ return;
+ }
+
+ for (; i < len; i++) {
+ this.xhr(
+ this.d.externalScripts[i],
+ function(script, scriptText) {
+ console.debug("In xhr callback for script url:", script.url);
+ if (scriptText === false) {
+ that.d.removeGivenJs(script);
+ that.d.scriptHasBeenTested();
+ that.externalCheckIsDone();
+ return;
+ }
+
+ console.debug('about to analyzeJS for script:', script.url);
+ that.analyzeJs(
+ script,
+ scriptText,
+ that.checkSingleExternalScript.bind(that));
+ }
+ );
+ }
+};
+
+DomChecker.prototype.wrapUpBeforeLeaving = function() {
+ "use strict";
+
+ console.debug("wrap up before leaving triggered");
+ console.debug('wrapping up');
+ this.d.callback(this.d.dom);
+
+};
+
+DomChecker.prototype.analyzeJs = function(script, scriptText, callback) {
+ "use strict";
+ console.debug('DomChecker.analyzeJs for script:', script.url);
+ try {
+ var checker = jsChecker.jsChecker();
+ var url = "";
+ if (typeof script.url !== "undefined") {
+ url = script.url;
+ } else {
+ url = this.pageURL;
+ }
+ checker.searchJs(scriptText, function() {
+ console.debug("Analyze JS"/*, JSON.stringify(checker)*/);
+ timer.setTimeout(function() {
+ callback(script, scriptText, checker);
+ }, 0);
+ }, url);
+ } catch (x) {
+ console.debug('error', x, x.lineNumber, x.fileName);
+ }
+};
+
+/**
+ * Check a single external script.
+ */
+DomChecker.prototype.checkSingleExternalScript = function(
+ script, loadedScript, checker
+) {
+ "use strict";
+ var check;
+
+ console.debug('DomChecker.checkSingleExternalScript()');
+ try {
+ check = checker.parseTree.freeTrivialCheck;
+
+ script.tree = checker;
+ script.result = check;
+ console.debug('in checkSingleExternalScript, checker.hash is',
+ checker.hash);
+ if (script.status != statusTypes.JSWEBLABEL) {
+ script.status = statusTypes.CHECKED;
+ }
+
+ if (check.type === checkTypes.FREE ||
+ check.type === checkTypes.FREE_SINGLE_ITEM
+ ) {
+ // add entry as accepted.
+ script.tagAsAccepted(this.d.pageURL, check.reason, checker.hash);
+ }
+
+ else if (check.type === checkTypes.NONTRIVIAL) {
+ console.debug("Removing given js", check.reason);
+ this.d.removeGivenJs(script, check.reason, false, checker.hash);
+ }
+
+ else if (check.type === checkTypes.TRIVIAL ||
+ check.type === checkTypes.WHITELISTED
+ ) {
+ // if it's accepted, allow.
+ script.tagAsAccepted(this.d.pageURL, check.reason, checker.hash);
+ } else {
+ // anything else is nontrivial. Including TRIVIAL_DEFINES_FUNCTION.
+ console.debug("checker hash for remove is ", checker.hash);
+ this.d.removeGivenJs(
+ script, reasons.FUNCTIONS_EXTERNAL, false, checker.hash);
+ }
+
+ } catch (e) {
+ console.debug('error in checkExternalScript',
+ e, e.lineNumber, 'for script', script.url);
+
+ this.d.removeAllJs();
+ this.destroy();
+ return;
+ }
+ console.debug('script url is', script.url, 'result is', script.result);
+ this.d.scriptHasBeenTested();
+ this.externalCheckIsDone();
+};
+
+DomChecker.prototype.externalCheckIsDone = function() {
+ "use strict";
+ console.debug('DomChecker.externalCheckIsDone');
+
+ console.debug('scriptsTested is', this.d.scriptsTested);
+ console.debug('num external', this.d.numExternalScripts);
+
+ if (this.d.scriptsTested >= this.d.numExternalScripts) {
+ console.debug('wrapping up external');
+ this.wrapUpBeforeLeaving();
+ } else {
+ var scriptsToCheck = this.d.numExternalScripts - this.d.scriptsTested;
+ console.debug('Not wrapping up! Waiting to check ' + scriptsToCheck +
+ ' more script(s)');
+
+ if (this.d.externalScripts[0]) {
+ console.debug('script 0 is', this.d.externalScripts[0]);
+ }
+ if (this.d.externalScripts[1]) {
+ console.debug('script 1 is', this.d.externalScripts[1]);
+ }
+ }
+};
+
+/**
+ * xhr
+ * Perform a XMLHttpRequest on the url given.
+ * @param url string A URL.
+ * @return The response text.
+ */
+DomChecker.prototype.xhr = function(script, responseCallback) {
+ "use strict";
+
+ var regex = /^text\/html/i;
+ var url = script.url;
+
+ try {
+ // add url to whitelist.
+ urlTester.addUrl(url);
+
+ // request module. Compatible with Https-Everywhere.
+ require('html_script_finder/dom_handler/request')
+ .request(script, responseCallback).request();
+ } catch (x) {
+ console.debug('error', x, x.lineNumber, x.fileName);
+ responseCallback(script, false);
+ }
+};
+
+/**
+ * exports.domChecker
+ * Instantiate a brand new clone of the domChecker.
+ * @param dom obj The given dom for analysis.
+ * @param pageURL string the URL for the page.
+ * @param callback function callback when all the work has been performed.
+ */
+exports.domChecker = function(domHandler) {
+ "use strict";
+
+ var domChecker = new DomChecker();
+
+ domChecker.init(domHandler);
+
+ return domChecker;
+};
+
+exports.xhr = new DomChecker().xhr;
diff --git a/lib/html_script_finder/dom_handler/dom_gatherer.js b/lib/html_script_finder/dom_handler/dom_gatherer.js
new file mode 100644
index 0000000..4fcee88
--- /dev/null
+++ b/lib/html_script_finder/dom_handler/dom_gatherer.js
@@ -0,0 +1,281 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var scriptProperties = require("html_script_finder/dom_handler/script_properties");
+
+const scriptTypes = scriptProperties.scriptTypes;
+const scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+
+const statusTypes = scriptProperties.statusTypes;
+// object model for script entries.
+var scriptObject = require("html_script_finder/dom_handler/script_object");
+
+var urlHandler = require("url_handler/url_handler");
+
+var attributeHelpers = require("html_script_finder/dom_handler/attributes");
+
+// javascript:*
+var jsInAttrRe = attributeHelpers.jsInAttrRe;
+
+// the list of all available event attributes
+var intrinsicEvents = attributeHelpers.intrinsicEvents;
+
+var privacyChecker = require("js_checker/privacy_checker").privacyCheck;
+
+const types = require("js_checker/constant_types");
+
+var checkTypes = types.checkTypes;
+
+// array reflex valid types as listed in
+// http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsScriptLoader.cpp#437
+// anything appended to end of strings is considered valid:
+var jsValidTypes = [
+ /^text\/javascript/i,
+ /^text\/ecmascript/i,
+ /^application\/javascript/i,
+ /^application\/ecmascript/i,
+ /^application\/x-javascript/i
+];
+
+var stripCDATAOpen = /<\!\[CDATA\[/gi;
+var stripCDATAClose = /]]>/g;
+
+var stripHtmlCommentsInScript = function (s) {
+ s = s.replace(stripCDATAOpen, '');
+ s = s.replace(stripCDATAClose, '');
+ return s;
+};
+
+
+// gather scripts and javascript in attributes across a dom object.
+var DomGatherer = function() {
+ // domHandler object.
+ this.d = null;
+};
+
+/**
+ * init
+ *
+ * assign a reference domHandler object
+ * to access/updates its properties.
+ *
+ */
+DomGatherer.prototype.init = function (domHandler) {
+ this.d = domHandler;
+};
+
+/**
+ * scriptHasInvalidType
+ *
+ * Checks that a script does not have a js "template" type.
+ * Normally any script that has a type attribute other than the
+ * few allowed ones is not interpreted. But by security, we only
+ * discard a few of them.
+ *
+ * @param script obj The script element.
+ * @return returns true if it matches a template type.
+ *
+ */
+DomGatherer.prototype.scriptHasInvalidType = function (script) {
+ var i = 0,
+ le = jsValidTypes.length;
+
+ var type = script.getAttribute('type');
+
+ if (type === 'librejs/blocked') {
+ // js has already been blocked.
+ return true;
+ }
+
+ if (!type) {
+ // type isn't set, don't look further.
+ return false;
+ }
+
+ for (; i < le; i++) {
+ if (jsValidTypes[i].test(type)) {
+ return false;
+ }
+ }
+
+ // type is invalid and
+ // hence cannot be executed.
+ return true;
+};
+
+/**
+ * findScripts
+ *
+ * Assigns the array of scripts in the dom to a property
+ * as well as a number of scripts present for looping purposing.
+ */
+DomGatherer.prototype.findScripts = function() {
+ this.d.domScripts = this.d.dom.getElementsByTagName('script');
+ this.d.numScripts = this.d.domScripts.length;
+};
+
+/**
+ * gatherIntrinsicEvents
+ *
+ * Fetches all the event attributes that might contain JavaScript
+ * as well as all element attributes that start with
+ * "javascript:".
+ *
+ */
+DomGatherer.prototype.gatherIntrinsicEvents = function() {
+ var i = 0, j, k,
+ all = this.d.dom.getElementsByTagName('*'),
+ max = all.length,
+ that = this,
+ attrLen, attrib, str, scriptEntry;
+
+ for (; i < max; i++) {
+ // look for attributes with value javascript:*
+ attributeHelpers.findJSinAttribute(
+ all[i],
+ function (scriptEntry) {
+ if (scriptEntry !== false) {
+
+ that.d.inlineScripts.push(scriptEntry);
+ that.d.scripts.push(scriptEntry);
+
+ // add inline script in the count.
+ that.d.numInlineScripts++;
+ }
+ });
+
+ // look for attributes of on* (onLoad, ...)
+ attributeHelpers.findOnJSAttribute(
+ all[i],
+ function (scriptEntry) {
+ if (scriptEntry !== false) {
+ that.d.inlineScripts.push(scriptEntry);
+ that.d.scripts.push(scriptEntry);
+
+ // add inline script in the count.
+ that.d.numInlineScripts++;
+ }
+ });
+ }
+
+};
+
+/**
+ * gatherScriptsContent
+ *
+ * Aggregate all content within on-page JavaScript code.
+ * Keep a list of all absolute urls to external scripts.
+ *
+ */
+DomGatherer.prototype.gatherScriptsContent = function() {
+ var i = 0, currentScript = '', absolutePath, scriptEntry,
+ that = this;
+ try {
+ for (; i < this.d.numScripts; i++) {
+ if (this.d.checkScriptForJsWebLabels(this.d.domScripts[i])) {
+ //break;
+ absolutePath = urlHandler.resolve(
+ this.d.pageURL, this.d.domScripts[i].src);
+ scriptEntry = scriptObject.Script(
+ {'type': scriptTypes.EXTERNAL,
+ 'status': statusTypes.JSWEBLABEL,
+ 'element': this.d.domScripts[i],
+ 'url': absolutePath});
+ scriptEntry.tree = {};
+
+ this.d.externalScripts.push(scriptEntry);
+ that.d.scripts.push(scriptEntry);
+
+ this.d.loadsHtmlExternalScripts = true;
+
+ // increment number of scripts found.
+ this.d.numExternalScripts++;
+ }
+
+ // check that script has valid type
+ else if (!this.scriptHasInvalidType(this.d.domScripts[i])) {
+
+
+ if (this.d.hasSrc(this.d.domScripts[i]) &&
+ !this.d.scriptHasJsWebLabel(this.d.domScripts[i])) {
+
+ console.debug('an external script', this.d.domScripts[i]);
+
+ absolutePath = urlHandler.resolve(
+ this.d.pageURL, this.d.domScripts[i].src);
+ scriptEntry = scriptObject.Script(
+ {'type': scriptTypes.EXTERNAL,
+ 'status': statusTypes.UNCHECKED,
+ 'element': this.d.domScripts[i],
+ 'url': absolutePath});
+ this.d.externalScripts.push(scriptEntry);
+ that.d.scripts.push(scriptEntry);
+
+ this.d.loadsHtmlExternalScripts = true;
+
+ // increment number of scripts found.
+ this.d.numExternalScripts++;
+
+ } else if (privacyChecker.checkScriptPrivacyThreat(this.d.domScripts[i].text)) {
+ this.d.removeGivenJs(scriptObject.Script(
+ {'type': scriptTypes.SINGLETON,
+ 'status': statusTypes.UNCHECKED,
+ 'element': this.d.domScripts[i],
+ 'text': this.d.domScripts[i].text
+ }), '', true);
+ } else if (this.d.domScripts[i].text !== '') {
+ // using else if since script text is
+ // ignored if src attribute is set.
+ // adding this.narcissusBugFixLibreJS to fix comment bug.
+ var bugfix = require('html_script_finder/bug_fix').narcissusBugFixLibreJS;
+ currentScript = stripHtmlCommentsInScript(this.d.domScripts[i].text + bugfix);
+
+ scriptEntry = scriptObject.Script(
+ {'type': scriptTypes.INLINE,
+ 'status': statusTypes.UNCHECKED,
+ 'element': this.d.domScripts[i],
+ 'text': currentScript});
+ this.d.inlineScripts.push(scriptEntry);
+ this.d.scripts.push(scriptEntry);
+
+ // add inline script in the count.
+ this.d.numInlineScripts++;
+ }
+ }
+ }
+ } catch (e) {
+ // Any problem arising, we remove the script.
+ console.debug('problem gathering scripts', e, e.lineNumber);
+ this.d.removeAllJs();
+ }
+};
+
+/*
+ * exports.domGatherer
+ * Instantiate a brand new clone of the domGatherer.
+ * @param dom obj The given dom for analysis.
+ * @param pageURL string the URL for the page.
+ * @param callback function callback when all the work has been performed.
+ */
+exports.domGatherer = function (domHandler) {
+ var dg = new DomGatherer();
+ dg.init(domHandler);
+ return dg;
+};
diff --git a/lib/html_script_finder/dom_handler/request.js b/lib/html_script_finder/dom_handler/request.js
new file mode 100644
index 0000000..7f217ef
--- /dev/null
+++ b/lib/html_script_finder/dom_handler/request.js
@@ -0,0 +1,115 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var timer = require("sdk/timers");
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+var {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+
+// ensure xhr won't create an infinite loop
+// with html content.
+var urlTester = require("html_script_finder/url_seen_tester").urlSeenTester;
+var urlHandler = require("url_handler/url_handler");
+const scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+
+var Request = function() {
+ this.url = null;
+ this.channel = null;
+ this.script = null;
+ this.responseCallback = null;
+};
+
+/**
+ * init
+ */
+Request.prototype.init = function(script, callback) {
+ this.script = script;
+ // set initial url
+ this.url = this.script.url;
+
+ console.debug('In Request.init() for url:', this.url);
+
+ this.responseCallback = callback;
+
+ var iOService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+
+ this.channel = iOService.newChannel(this.url, null, null);
+};
+
+Request.prototype.request = function() {
+ var that = this;
+ var responseReceived = function (data) {
+ that.responseCallback(that.script, data);
+ };
+ try {
+ this.channel.asyncOpen({
+ QueryInterface: XPCOMUtils.generateQI(
+ [Ci.nsIRequestObserver, Ci.nsIStreamListener]),
+ data: "",
+ charset: null,
+
+ onStartRequest: function(request, context) {
+ this.charset = request.contentCharset || "UTF-8";
+ },
+
+ onDataAvailable: function (request, context, stream, offset, count) {
+ try {
+ var binaryInputStream = Cc["@mozilla.org/binaryinputstream;1"]
+ .createInstance(Ci.nsIBinaryInputStream);
+ binaryInputStream.setInputStream(stream);
+ var data = binaryInputStream.readBytes(count);
+ this.data += data;
+ } catch (x) {
+ console.debug('error in request', x, x.lineNumber);
+ responseReceived("");
+ }
+ },
+
+ onStopRequest: function (request, context, result) {
+ try {
+ if (this.charset.toLowerCase() != "utf-8") {
+ var uConv = Cc["@mozilla.org/intl/utf8converterservice;1"]
+ .createInstance(Ci.nsIUTF8ConverterService);
+
+ this.data = uConv.convertStringToUTF8(
+ this.data, this.charset, true);
+ }
+ } catch (e) {
+ console.debug("Issue with nsIUTF8ConverterService", e);
+ console.debug("Charset was", this.charset);
+ responseReceived("");
+ }
+ responseReceived(this.data);
+ }
+ }, null);
+ } catch(e) {
+ console.debug("asyncOpen exception", e);
+ responseReceived("");
+ }
+};
+
+// Instantiate a Request
+exports.request = function(script, callback) {
+ var obj = new Request();
+ obj.init(script, callback);
+ return obj;
+};
diff --git a/lib/html_script_finder/dom_handler/script_object.js b/lib/html_script_finder/dom_handler/script_object.js
new file mode 100644
index 0000000..5431cf6
--- /dev/null
+++ b/lib/html_script_finder/dom_handler/script_object.js
@@ -0,0 +1,208 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var removedScripts = require("script_entries/removed_scripts").removedScripts;
+
+var acceptedScripts = require("script_entries/accepted_scripts")
+ .acceptedScripts;
+var dryRunScripts = require("script_entries/dryrun_scripts").dryRunScripts;
+
+var Script = function(props) {
+ // can be an attribute, an inline script,
+ // or an external script.
+ this.type = null;
+
+ /*
+ * Script.status - The script's current status.
+ *
+ * Possible values are:
+ *
+ * 0 - unchecked
+ * 1 - checked
+ * 2 - accepted
+ * 3 - rejected
+ * 4 - jsweblabel
+ *
+ * See script_properties.js for definitions.
+ */
+ this.status = null;
+
+ // contains the dom element
+ this.element = null;
+
+ // the attribute name, if applicable.
+ this.attribute = null;
+
+ // the script text as a string.
+ this.value = null;
+
+ // the src url if external.
+ this.url = null;
+
+ // the script text if inline.
+ this.text = null;
+
+ this.init(props);
+};
+
+Script.prototype.init = function(props) {
+ // check the required elements are present.
+ if (typeof props === 'undefined') {
+ throw "Error, missing script entry value in script_object.js";
+ }
+
+ // required properties
+ if (typeof props.type !== 'undefined') {
+ this.type = props.type;
+ } else {
+ throw "type is missing";
+ }
+
+ if (typeof props.status !== 'undefined') {
+ this.status = props.status;
+ } else {
+ throw "status is missing";
+ }
+
+ if (typeof props.element !== 'undefined') {
+ this.element = props.element;
+ } else {
+ throw "element is missing";
+ }
+
+ // conditional properties.
+ this.url = (props.url) ? props.url : null;
+ this.text = (props.text) ? props.text : null;
+ this.jsAttributes = (props.jsAttributes) ? props.jsAttributes : null;
+
+ if (typeof this.text !== 'string' &&
+ this.tree !== null &&
+ typeof this.tree === 'object' &&
+ this.tree.hasOwnProperty('jsCode')
+ ) {
+ this.text = this.tree.jsCode;
+ }
+};
+
+Script.prototype.tagAsDryRun = function(pageURL, reason, hash) {
+ var content = this.findContentType();
+ var inline = (this.url != undefined) ? false : true;
+ var url = (inline == false ? this.url : null);
+ console.debug("url is", url);
+ this.element.setAttribute('data-librejs', 'dryrun');
+ this.element.setAttribute('data-librejs-reason', reason);
+
+ dryRunScripts.addAScript(
+ pageURL,
+ {'inline': inline,
+ 'contents': content,
+ 'reason': reason,
+ 'url': url,
+ 'hash': hash
+ });
+};
+
+Script.prototype.tagAsAccepted = function(pageURL, reason, hash) {
+ var content = this.findContentType();
+ var inline = (this.url != undefined) ? false : true;
+ var url = (inline == false ? this.url : null);
+ console.debug("url is", url);
+ this.element.setAttribute('data-librejs', 'accepted');
+ this.element.setAttribute('data-librejs-reason', reason);
+
+ acceptedScripts.addAScript(
+ pageURL,
+ {'inline': inline,
+ 'contents': content,
+ 'reason': reason,
+ 'url': url,
+ 'hash': hash
+ });
+
+};
+
+Script.prototype.tagAsRemoved = function(pageURL, reason, hash) {
+ var content = this.findContentType();
+ var inline = (this.url != undefined) ? false : true;
+ var url = (inline == false ? this.url : null);
+ this.element.setAttribute('data-librejs', 'rejected');
+ this.element.setAttribute('data-librejs-reason', reason);
+ console.debug("tagAsRemoved hash is", hash);
+ removedScripts.addAScript(pageURL, {
+ 'inline': inline,
+ 'contents': content,
+ 'reason': reason,
+ 'url': url,
+ 'hash': hash
+ });
+
+};
+
+Script.prototype.tagAsDryRun = function(pageURL, reason, hash) {
+ var content = this.findContentType();
+ var inline = (this.url != undefined) ? false : true;
+ var url = (inline == false ? this.url : null);
+ this.element.setAttribute('data-librejs', 'dryrun');
+ this.element.setAttribute('data-librejs-reason', reason);
+
+ dryRunScripts.addAScript(
+ pageURL,
+ {'inline': inline,
+ 'contents': content,
+ 'reason': reason,
+ 'url': url,
+ 'hash': hash
+ });
+};
+
+/**
+ * removeNarcissusBugLine
+ *
+ * Removes the line that is appended to all
+ * inline scripts and prevent the bug that prevent
+ * script tags with comments only from being checked.
+ *
+ */
+Script.prototype.removeNarcissusBugLine = function(str) {
+ return str.replace('\n\nthis.narcissusBugFixLibreJS', '');
+};
+
+/**
+ * findContentType
+ *
+ * Figure out whether it's an external script,
+ * an inline script, or an attribute from the property
+ * that has been set, rather than blindly trusting the given
+ * constant.
+ */
+Script.prototype.findContentType = function() {
+ if (this.url != undefined) {
+ return "";
+ } else if (this.text != undefined) {
+ return this.element.text;
+ } else if (this.jsAttributes != undefined) {
+ // return the array.
+ return JSON.stringify(this.jsAttributes);
+ }
+};
+
+exports.Script = function(props) {
+ return new Script(props);
+};
diff --git a/lib/html_script_finder/dom_handler/script_properties.js b/lib/html_script_finder/dom_handler/script_properties.js
new file mode 100644
index 0000000..2eeeedb
--- /dev/null
+++ b/lib/html_script_finder/dom_handler/script_properties.js
@@ -0,0 +1,43 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+exports.scriptTypes = {
+ INLINE: 0,
+ EXTERNAL: 1,
+ ATTRIBUTE: 2,
+ SINGLETON: 3
+};
+
+exports.statusTypes = {
+ UNCHECKED: 0,
+ CHECKED: 1,
+ ACCEPTED: 2,
+ REJECTED: 3,
+ JSWEBLABEL: 4
+};
+
+exports.reasons = {
+ 'FUNCTIONS_INLINE': 'This script is detected as inline, nonfree, defining functions or methods, and the rest of the page as loading external scripts',
+ 'FUNCTIONS_EXTERNAL': 'This script is detected as nonfree, external, and as defining functions or methods',
+ 'CONSTRUCT': 'This script is detected as nonfree and as defining nontrivial constructs',
+ 'FREE': 'This script is detected as free',
+ 'TRIVIAL': 'This script is detected as trivial',
+ 'TRIVIAL_NOT_ALLOWED': 'This script is detected as trivial, but trivial is not allowed here because of other scripts'
+};
diff --git a/lib/html_script_finder/html_parser.js b/lib/html_script_finder/html_parser.js
new file mode 100644
index 0000000..69b2acc
--- /dev/null
+++ b/lib/html_script_finder/html_parser.js
@@ -0,0 +1,158 @@
+/*
+ # ***** BEGIN LICENSE BLOCK *****
+ # Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ #
+ # The contents of this file are subject to the Mozilla Public License Version
+ # 1.1 (the "License"); you may not use this file except in compliance with
+ # the License. You may obtain a copy of the License at
+ # http://www.mozilla.org/MPL/
+ #
+ # Software distributed under the License is distributed on an "AS IS" basis,
+ # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ # for the specific language governing rights and limitations under the
+ # License.
+ #
+ # The Original Code is Microsummarizer.
+ #
+ # The Initial Developer of the Original Code is Mozilla.
+ # Portions created by the Initial Developer are Copyright (C) 2006
+ # the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s):
+ # Myk Melez <myk@mozilla.org> (Original Author)
+ # Simon Bünzli <zeniko@gmail.com>
+ # Asaf Romano <mano@mozilla.com>
+ # Dan Mills <thunder@mozilla.com>
+ # Ryan Flint <rflint@dslr.net>
+ #
+ # Alternatively, the contents of this file may be used under the terms of
+ # either the GNU General Public License Version 2 or later (the "GPL"), or
+ # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ # in which case the provisions of the GPL or the LGPL are applicable instead
+ # of those above. If you wish to allow use of your version of this file only
+ # under the terms of either the GPL or the LGPL, and not to allow others to
+ # use your version of this file under the terms of the MPL, indicate your
+ # decision by deleting the provisions above and replace them with the notice
+ # and other provisions required by the GPL or the LGPL. If you do not delete
+ # the provisions above, a recipient may use your version of this file under
+ # the terms of any one of the MPL, the GPL or the LGPL.
+ #
+ # ***** END LICENSE BLOCK *****
+ */
+
+/*
+ * The original file is located here:
+ * http://mxr.mozilla.org/mozilla/source/browser/components/microsummaries/src/nsMicrosummaryService.js?raw=1
+ *
+ */
+
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * html_parser
+ *
+ * Takes in an http response (string), loads it into a secured iframe
+ * so that it can be manipulated as a DOM object. It then returns a
+ * modified string to be passed along as a replacement of the original
+ * response.
+ *
+ */
+
+var {Cc, Ci, Cu} = require("chrome");
+
+var domHandlerModule = require("html_script_finder/dom_handler");
+
+const PR_UINT32_MAX = 2147483647;
+
+
+exports.htmlParser = function () {
+
+ return {
+ charset: null,
+ htmlText: null,
+ pageURL: null,
+ fragment: null,
+ contentType: null,
+ responseStatus: null,
+
+ parse: function (htmlText, charset, contentType, url, fragment,
+ responseStatus, parseResult) {
+
+ // DOMParser still has too many issues.
+ this.htmlText = htmlText;
+ this.charset = charset;
+
+ if (this.charset === "" || this.charset === undefined) {
+ this.charset = "utf-8";
+ }
+ this.contentType = contentType;
+ this.pageURL = url;
+ this.fragment = fragment;
+ this.responseStatus = responseStatus;
+ var that = this;
+
+ var domParser = Cc["@mozilla.org/xmlextras/domparser;1"].
+ createInstance(Ci.nsIDOMParser);
+
+ var dom = domParser.parseFromString(this.htmlText, this.contentType);
+ // console.debug(dom.getElementsByTagName('body')[0].innerHTML);
+ domHandlerModule.domHandler(dom, this.pageURL, this.fragment, this.responseStatus, function (newDom) {
+ parseResult(that.serializeToStream(newDom, that));
+ });
+
+ },
+
+ /**
+ * serializeToStream
+ * Serializes an HTML DOM into a binary stream. Uses
+ * nsIDOMSerializer only as a backup to when the
+ * reconstituteHtmlString method fails (not sure if/when it
+ * happens).
+ * @param dom obj Reference to the dom object
+ * @param that obj Reference to the object returned by htmlParser.
+ * This allows to give access to the iframe.
+ * @return a binary stream.
+ */
+ serializeToStream: function (dom, that) {
+
+ var newData, len;
+
+ try {
+ var storageStream = Cc["@mozilla.org/storagestream;1"].createInstance(Ci.nsIStorageStream);
+ var binaryOutputStream = Cc["@mozilla.org/binaryoutputstream;1"].createInstance(Ci.nsIBinaryOutputStream);
+ var serializer = Cc["@mozilla.org/xmlextras/xmlserializer;1"].createInstance(Ci.nsIDOMSerializer);
+ var encoder = Cc["@mozilla.org/layout/documentEncoder;1?type=" + this.contentType]
+ .createInstance(Ci.nsIDocumentEncoder);
+
+ encoder.setCharset(this.charset);
+ encoder.init(dom, this.contentType, 0);
+ storageStream.init(8192, PR_UINT32_MAX, null);
+
+ binaryOutputStream.setOutputStream(storageStream.getOutputStream(0));
+ encoder.encodeToStream(binaryOutputStream);
+ return storageStream;
+ } catch (e) {
+ console.debug('issue with serializer', e, e.lineNumber);
+ }
+ }
+
+ };
+};
diff --git a/lib/html_script_finder/url_seen_tester.js b/lib/html_script_finder/url_seen_tester.js
new file mode 100644
index 0000000..d2f38a9
--- /dev/null
+++ b/lib/html_script_finder/url_seen_tester.js
@@ -0,0 +1,78 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var httpRe = /^(http:)/i;
+var httpsRe = /^(https:)/i;
+
+exports.urlSeenTester = {
+ whitelist: {},
+
+ httpToHttps: function (url) {
+ try {
+
+ if (httpRe.test(url)) {
+
+ return url.replace(httpRe, 'https:');
+
+ } else if (httpsRe.test(url)) {
+
+ return url.replace(httpsRe, 'http:');
+
+ } else {
+
+ return url;
+
+ }
+ } catch (x) {
+ console.debug('error', x);
+ }
+ },
+
+ clearUrls: function () {
+ this.whitelist = {};
+ },
+
+ clearUrl: function (url) {
+ if (this.whitelist[url]) {
+
+ // console.debug('disallowing', url);
+ delete this.whitelist[url];
+ }
+ },
+
+ addUrl: function (url) {
+ console.debug('adding', url);
+
+ if (!this.isWhitelisted(url)) {
+
+ console.debug('allowing', url);
+ this.whitelist[url] = true;
+ }
+ },
+
+ isWhitelisted: function (url) {
+ if (this.whitelist[url] || this.whitelist[this.httpToHttps(url)]) {
+ console.debug('found to be whitelisted', url);
+ return true;
+ }
+ return false;
+ }
+
+};
diff --git a/lib/html_script_finder/web_labels/find_js_labels.js b/lib/html_script_finder/web_labels/find_js_labels.js
new file mode 100644
index 0000000..6404c49
--- /dev/null
+++ b/lib/html_script_finder/web_labels/find_js_labels.js
@@ -0,0 +1,131 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * This file works in conjunction with lib/html_script_finder/js_web_labels.js
+ * to find mentions of external JavaScript files and their license information.
+ * This allows the dom_handler to allow them by default.
+ */
+
+/**
+ * @param {Array} licenses - An array of html nodes.
+ *
+ * @return {Array} - An array of simple license objects.
+ */
+function getLicensesArrayFromElements(licenses) {
+ var a = [];
+ // Convert the html node into a simpler object
+ for (var i = 0; i < licenses.length; i++) {
+ a.push({
+ licenseName: licenses[i].textContent,
+ licenseUrl: licenses[i].href
+ });
+ }
+ return a;
+}
+
+/**
+ * @param {Array} sources - An array of html nodes.
+ *
+ * @return {Array} - An array of simple source objects.
+ */
+function getSourcesArrayFromElements(sources) {
+ var a = [];
+ for (var i = 0; i < sources.length; i++) {
+ a.push({
+ sourceName: sources[i].textContent,
+ sourceUrl: sources[i].href
+ });
+ }
+ return a;
+}
+
+// find table.
+exports.getLicenseList = function(document) {
+ var tbl = document.getElementById('jslicense-labels1');
+ var jsList = [];
+ var i = 0;
+ var le;
+ var rows;
+ var link;
+ var fileCell;
+ var licenseCell;
+ var sourceCell;
+ var row;
+
+ if (tbl) {
+ try {
+ rows = tbl.getElementsByTagName('tr');
+ le = rows.length;
+ var mockElem = {textContent: 'Unknown', href: 'Unknown'};
+ // loop through rows, and add each valid element to
+ // the array.
+ for (; i < le; i++) {
+ row = rows[i].getElementsByTagName('td');
+
+ // Find script url
+ if (row[0] && row[0].getElementsByTagName('a')[0]) {
+ fileCell = row[0].getElementsByTagName('a')[0];
+ } else {
+ fileCell = mockElem;
+ }
+
+ // 'licenses' and 'sources' will, for normal cases, just
+ // contain one element. If the fileCell is pointing to a
+ // combined JS file with multiple licenses, though, these
+ // arrays will contain multiple elements.
+
+ // Find license info
+ var licenses = [mockElem];
+ if (row[1] && row[1].getElementsByTagName('a').length > 0) {
+ licenses = getLicensesArrayFromElements(
+ row[1].getElementsByTagName('a'));
+ }
+
+ // Find original source info
+ var sources = [mockElem];
+ if (row[2] && row[2].getElementsByTagName('a').length > 0) {
+ sources = getSourcesArrayFromElements(
+ row[2].getElementsByTagName('a'));
+ }
+
+ if (fileCell.href !== 'Unknown') {
+ jsList.push({
+ 'fileName': fileCell.textContent,
+ 'fileUrl': fileCell.href,
+
+ // we'll fill this with value when needed to compare
+ // script.
+ 'fileHash': null,
+
+ 'licenses': licenses,
+ 'sources': sources
+ });
+ }
+ }
+ } catch (e) {
+ console.debug(
+ 'Error fetching JS Web Label licenses',
+ e, e.lineNumber, e.fileName, 'index is', i);
+ }
+ }
+
+ return jsList;
+};
diff --git a/lib/html_script_finder/web_labels/js_web_labels.js b/lib/html_script_finder/web_labels/js_web_labels.js
new file mode 100644
index 0000000..b3fe063
--- /dev/null
+++ b/lib/html_script_finder/web_labels/js_web_labels.js
@@ -0,0 +1,279 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// node.js url module. Makes it easier to resolve
+// urls in that datauri loaded dom
+var urlHandler = require("url_handler/url_handler");
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+var data = require("sdk/self").data;
+
+// license definitions, we are using canonical urls and license
+// identifiers.
+var licenses = require('js_checker/license_definitions').licenses;
+
+var getLicenseList = require('html_script_finder/web_labels/find_js_labels')
+ .getLicenseList;
+const types = require("js_checker/constant_types");
+
+const addToCache = require("html_script_finder/web_labels/script_hash_worker")
+ .addToCache;
+
+// keep web labels in memory so that they can be checked even when they
+// are embedded dynamically.
+var jsWebLabelEntries = {};
+
+// store the url to js web labels already visited during this session
+var jsLabelsPagesVisited = {};
+
+var WebLabelFinder = function () {
+ this.dom = null;
+ this.pageURL = null;
+ this.jslicenseURL = null;
+ this.pageContent = null;
+ this.licenseList = null;
+ this.callback = null;
+};
+
+WebLabelFinder.prototype.init = function(dom, pageURL, callback) {
+ var that = this;
+ this.pageURL = pageURL;
+ this.dom = dom;
+ this.callback = function (a) {
+ if (typeof a === 'undefined') {
+ a = null;
+ }
+
+ // rewrite callback as soon as it is triggered once.
+ that.callback = function () {
+ console.debug("Callback already called");
+ };
+
+ callback(a);
+ };
+ this.findJavaScriptLicenses();
+ this.pageContent = '';
+ this.jslicenseURL = '';
+};
+
+WebLabelFinder.prototype.findJavaScriptLicenses = function () {
+ this.searchForJsLink();
+
+ if (this.jslicenseURL && !(jsLabelsPagesVisited[this.jslicenseURL])) {
+ // get content from license page.
+ console.debug('called fetch license page for', this.jslicenseURL);
+ this.pageContent = this.fetchLicensePage();
+ } else {
+ console.debug(this.jslicenseURL, "already visited");
+ this.callback();
+ }
+};
+
+WebLabelFinder.prototype.searchForJsLink = function() {
+ console.debug('triggered searchForJsLink');
+ if (this.dom) {
+ var linkTags = this.dom.getElementsByTagName('a'),
+ i = 0,
+ len = linkTags.length,
+ path;
+
+ // loop through all a tags.
+ for (; i < len; i++) {
+ if (
+ (linkTags[i].hasAttribute('rel') &&
+ linkTags[i].getAttribute('rel') === 'jslicense') ||
+ (linkTags[i].hasAttribute('data-jslicense') &&
+ linkTags[i].getAttribute('data-jslicense') === '1')
+ ) {
+ // This page has a web labels link
+ return this.formatURL(linkTags[i]);
+ }
+ }
+ }
+
+ // no js web labels were found. call back.
+ this.callback();
+ return false;
+};
+
+WebLabelFinder.prototype.formatURL = function(link) {
+ this.jslicenseURL = urlHandler.resolve(this.pageURL, link.href);
+ this.jslicenseURL = urlHandler.addFragment(this.jslicenseURL, 'librejs=true');
+ console.debug('license URL found', this.jslicenseURL);
+ return this.jslicenseURL;
+};
+
+WebLabelFinder.prototype.fetchLicensePage = function() {
+ var that = this;
+ try {
+ var req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
+
+ req.onload = function() {
+ console.debug("Fetching License!");
+ console.debug("URL is ", this._url);
+
+ that.licenseList = getLicenseList(this.responseXML);
+ console.debug("the license list", that.licenseList);
+ that.matchListWithDefs(this._url);
+
+ // add these entries to the global
+ // object for dynamically embedded scripts.
+ jsWebLabelEntries[that.pageURL] = that.licenseList;
+ jsLabelsPagesVisited[req._url] = 1;
+ };
+ console.debug(this.jslicenseURL);
+ req.open('GET', this.jslicenseURL, true);
+ req._url = this.jslicenseURL;
+ req.responseType = "document";
+ req.send();
+ } catch (e) {
+ console.debug(e, e.lineNumber, e.fileName, this.jslicenseURL);
+ this.callback({});
+ }
+};
+
+/**
+ * @method isLicenseFree
+ * Returns true if the given web labels row refers to a script that
+ * can be executed by LibreJS.
+ *
+ * This method has some side effects :-/
+ *
+ * @param {Object} lic - A license node from a JS web labels page. It's
+ * expected to contain one or more licenses.
+ * @return {Boolean}
+ */
+WebLabelFinder.prototype.isLicenseFree = function(
+ lic, jslicenseURL, callback
+) {
+ // For each license that this license row contains.
+ var isFree = false;
+ // licenseStatuses is later used to determine isFree.
+ var licenseStatuses = [];
+
+ for (var i = 0; i < lic.licenses.length; i++) {
+ var license;
+ var found = false;
+
+ // For each license from the internal license definitions
+ for (license in licenses) {
+ if (found === true) {
+ break;
+ }
+ var licDef = licenses[license];
+ var licArray = [];
+ if (!licDef.canonicalUrl) {
+ continue;
+ }
+ if (typeof licDef.canonicalUrl === 'string') {
+ licArray = [licDef.canonicalUrl];
+ } else {
+ licArray = licDef.canonicalUrl;
+ }
+
+ // For each of the canonical URLs recognized by this license
+ // definition
+ for (var j = 0; j < licArray.length; j++) {
+ if (urlHandler.removeFragment(licArray[j]) ===
+ urlHandler.removeFragment(lic.licenses[i].licenseUrl)
+ ) {
+ if (!require("sdk/url").isValidURI(lic.fileUrl)) {
+ console.debug(lic.fileUrl, " is not a valid URL");
+ callback();
+ }
+
+ // This license was recognized, and it was free. Add it
+ // to the array of license status, which we'll look at
+ // when we're done with this web label row.
+ licenseStatuses.push(true);
+
+ console.debug("about TO ADD TO XHR: ", lic.fileUrl);
+ this.listCheck[lic.fileUrl] = 0;
+ addToCache(lic, 0, jslicenseURL, callback);
+
+ // Break out of the nearest two loops cause we found
+ // a matching license
+ found = true;
+ break;
+ }
+ }
+ }
+ }
+
+ // Tally up the licenses we were able to match.
+ if (licenseStatuses.length > 0 &&
+ // If the number of licenses we matched is at least one, and
+ // it's the same number as the number of licenses in this Web
+ // Label column, only then can we recognize this script as free.
+ // licenseStatus.length should never be larger than
+ // lic.licenses.length.
+ licenseStatuses.length >= lic.licenses.length
+ ) {
+ isFree = true;
+ }
+
+ return isFree;
+};
+
+WebLabelFinder.prototype.matchListWithDefs = function(jslicenseURL) {
+ var that = this;
+ var licDef,
+ license, script;
+ var cacheCalls = 0;
+ this.listCheck = {};
+
+ // nested loop.
+ cacheCalls = 0;
+ var callback = function (url) {
+ cacheCalls++;
+ that.listCheck[url] = 1;
+ if (cacheCalls === Object.keys(that.listCheck).length) {
+ console.debug("triggering callback duh");
+ // return array to requester object
+ callback = false;
+ that.callback(that.licenseList);
+ }
+ };
+ require("sdk/timers").setTimeout(function () {
+ // callback after 60 seconds if it's still not returned.
+ // using this as a safeguard.
+ // return array to requester object
+ if (callback !== false) {
+ that.callback(that.licenseList);
+ console.debug(that.listCheck);
+ }
+ }, 15000);
+
+
+
+ for (var i = 0; i < this.licenseList.length; i++) {
+ // this.licenseList[i] is the web labels license column
+ var lic = this.licenseList[i];
+ if (this.isLicenseFree(lic, jslicenseURL, callback)) {
+ lic.free = true;
+ }
+ }
+};
+
+exports.WebLabelFinder = WebLabelFinder;
+
+// Store the web labels harvested across webpages (only in this session).
+exports.jsWebLabelEntries = jsWebLabelEntries;
+
+exports.jsLabelsPagesVisited = jsLabelsPagesVisited;
diff --git a/lib/html_script_finder/web_labels/script_hash_worker.js b/lib/html_script_finder/web_labels/script_hash_worker.js
new file mode 100644
index 0000000..6d8d837
--- /dev/null
+++ b/lib/html_script_finder/web_labels/script_hash_worker.js
@@ -0,0 +1,62 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const types = require("js_checker/constant_types");
+const scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+const xhr = require('html_script_finder/dom_handler/dom_checker').xhr;
+const timers = require("sdk/timers");
+
+exports.addToCache = function (lic, delay, jsWebLabelsURL, callback) {
+ console.debug("jslicenseURL is", jsWebLabelsURL);
+ if (typeof delay === 'undefined') {
+ delay = 0;
+ }
+
+ // get file hash and store as cached.
+ console.debug('performing xhr for', lic.fileUrl);
+ timers.setTimeout(function() {
+ var cb = function (script, contents) {
+ try {
+ // add a cache entry.
+ var hash = scriptsCached.addEntryIfNotCached(
+ contents,
+ types.freeWithComment(
+ 'This script is free according to a JS Web Labels ' +
+ 'page visited recently (at ' +
+ jsWebLabelsURL.replace("librejs=true", "") + ' )'
+ ),
+ {},
+ true,
+ lic.fileUrl
+ );
+ console.debug('returning xhr from', lic.fileUrl);
+ callback(lic.fileUrl);
+ } catch (e) {
+ callback(lic.fileUrl);
+ }
+ };
+ // just callback after 5 seconds if we don't get the answer yet.
+ timers.setTimeout(function() {
+ cb = function() {};
+ callback(lic.fileUrl); }, 20000);
+
+ xhr({'url': lic.fileUrl}, cb);
+ }, delay);
+};
diff --git a/lib/http_observer/allowed_referrers.js b/lib/http_observer/allowed_referrers.js
new file mode 100644
index 0000000..797284b
--- /dev/null
+++ b/lib/http_observer/allowed_referrers.js
@@ -0,0 +1,67 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var prefChange = require("addon_management/prefchange");
+
+var allowed = {};
+
+/**
+ * Contains a list of pages that are allowed
+ * to execute JavaScript regardless of whether it is
+ * nonfree and nontrivial.
+ */
+var AllowedReferrers = function() {
+};
+
+AllowedReferrers.prototype.addPage = function(url) {
+ allowed[url] = 1;
+};
+
+AllowedReferrers.prototype.urlInAllowedReferrers = function (url) {
+ if (allowed[url] === 1) {
+ return true;
+ }
+ // check if whitelisted.
+ return this.urlInWhitelist(url);
+};
+
+AllowedReferrers.prototype.urlInWhitelist = function(url) {
+ var whitelist = prefChange.getWhitelist();
+ var i = 0, le = whitelist.length;
+ for (; i < le; i++) {
+ if (whitelist[i].test(url)) {
+ return true;
+ }
+ }
+};
+
+AllowedReferrers.prototype.clearSinglePageEntry = function(url) {
+ var index = allowed[url];
+
+ if (allowed[url] === 1) {
+ delete allowed[url];
+ }
+};
+
+AllowedReferrers.prototype.clearAllEntries = function() {
+ allowed = {};
+};
+
+exports.allowedReferrers = new AllowedReferrers();
diff --git a/lib/http_observer/caching.js b/lib/http_observer/caching.js
new file mode 100644
index 0000000..1463b1c
--- /dev/null
+++ b/lib/http_observer/caching.js
@@ -0,0 +1,30 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+const nsICacheService = Ci.nsICacheService;
+const cacheService = Cc["@mozilla.org/network/cache-service;1"].getService(nsICacheService);
+
+exports.clearAllCache = function () {
+ cacheService.evictEntries(Ci.nsICache.STORE_ON_DISK);
+ cacheService.evictEntries(Ci.nsICache.STORE_IN_MEMORY);
+};
+
diff --git a/lib/http_observer/http_request_observer.js b/lib/http_observer/http_request_observer.js
new file mode 100644
index 0000000..3b24aed
--- /dev/null
+++ b/lib/http_observer/http_request_observer.js
@@ -0,0 +1,146 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+var observerService = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
+
+// these are our target mime types for response interception.
+var targetMimeTypes = /.*(javascript|ecmascript|html).*/i;
+//var targetMimeTypes = /.*(html).*/i;
+
+// ensure xhr won't create an infinite loop
+// with html content.
+var urlTester = require("html_script_finder/url_seen_tester").urlSeenTester;
+var streamLoader = require("http_observer/stream_loader").streamLoader;
+
+var httpRequestObserver = {
+ observe: function(request, aTopic, aData) {
+ console.debug('atopic is', aTopic);
+ var url, newListener, status;
+
+ if (aTopic === "http-on-examine-response" ||
+ aTopic === "http-on-examine-cached-response" ||
+ aTopic === "http-on-examine-merged-response"
+ ) {
+ request.QueryInterface(Ci.nsIHttpChannel);
+
+ if (request.URI.scheme !== 'chrome' &&
+ (request.responseStatus < 300 ||
+ request.responseStatus > 399) &&
+ (targetMimeTypes.test(request.contentType) ||
+ request.contentType === undefined) &&
+ (!urlTester.isWhitelisted(request.URI.spec) &&
+ !urlTester.isWhitelisted(request.originalURI.spec))
+ ) {
+ newListener = new TracingListener();
+ request.QueryInterface(Ci.nsITraceableChannel);
+ newListener.originalListener = request.setNewListener(newListener);
+ } else if (urlTester.isWhitelisted(request.URI.spec) ||
+ urlTester.isWhitelisted(request.originalURI.spec)
+ ) {
+ urlTester.clearUrl(request.URI.spec);
+ urlTester.clearUrl(request.originalURI.spec);
+ }
+
+ }
+ },
+
+ QueryInterface: function (aIID) {
+ if (aIID.equals(Ci.nsIObserver) ||
+ aIID.equals(Ci.nsISupports)
+ ) {
+ return this;
+ }
+ throw Cr.NS_NOINTERFACE;
+ }
+};
+
+// Copy response listener implementation.
+function TracingListener() {
+ this.originalListener = null;
+ this.streamLoader = streamLoader();
+}
+
+TracingListener.prototype = {
+ onDataAvailable: function(request, context, inputStream, offset, count) {
+ try {
+ this.streamLoader.loader.onDataAvailable(
+ request, context, inputStream, offset, count);
+ } catch (x) {
+ console.debug(x, x.lineNumber, x.fileName, "In this case, charset is");
+ }
+ },
+
+ onStartRequest: function(request, context) {
+ this.streamLoader.setOriginalListener(this.originalListener);
+ this.streamLoader.loader.onStartRequest(request, context);
+ this.originalListener.onStartRequest(request, context);
+ },
+
+ onStopRequest: function(request, context, statusCode) {
+ try {
+ this.streamLoader.loader.onStopRequest(request, context, statusCode);
+ } catch (e) {
+ console.debug('error in onStopRequest', e, e.lineNumber);
+ }
+ },
+
+ QueryInterface: function (aIID) {
+ if (aIID.equals(Ci.nsIStreamListener) ||
+ aIID.equals(Ci.nsISupports)
+ ) {
+ return this;
+ }
+ throw Cr.NS_NOINTERFACE;
+ },
+};
+
+exports.startHttpObserver = function() {
+ try {
+ observerService.addObserver(httpRequestObserver,
+ "http-on-examine-response", false);
+ observerService.addObserver(httpRequestObserver,
+ "http-on-examine-cached-response", false);
+ observerService.addObserver(httpRequestObserver,
+ "http-on-examine-merged-response", false);
+ console.debug('turned on http observer');
+ } catch (e) {
+ console.debug(e);
+ }
+};
+
+exports.startHttpObserver();
+
+/* remove observer */
+exports.removeHttpObserver = function() {
+ try {
+ observerService.removeObserver(httpRequestObserver,
+ "http-on-examine-response");
+ observerService.removeObserver(httpRequestObserver,
+ "http-on-examine-cached-response");
+ observerService.removeObserver(httpRequestObserver,
+ "http-on-examine-merged-response");
+ console.debug('turned off http observer');
+ } catch (e) {
+ console.debug(e);
+ }
+};
diff --git a/lib/http_observer/process_response.js b/lib/http_observer/process_response.js
new file mode 100644
index 0000000..b407ef6
--- /dev/null
+++ b/lib/http_observer/process_response.js
@@ -0,0 +1,429 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * This module checks http responses by mime type and returns a
+ * modified response.
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+var jsChecker = require("js_checker/js_checker");
+
+const types = require("js_checker/constant_types");
+var checkTypes = types.checkTypes;
+
+// check if scripts embedded dynamically have a jsWebLabel entry indexed by referrer.
+var jsWebLabelEntries = require("html_script_finder/web_labels/js_web_labels").jsWebLabelEntries;
+
+var htmlParser = require("html_script_finder/html_parser");
+
+var removedScripts = require("script_entries/removed_scripts").removedScripts;
+var allowedRef = require('http_observer/allowed_referrers').allowedReferrers;
+
+var acceptedScripts = require("script_entries/accepted_scripts").acceptedScripts;
+
+// used to display info when a url is whitelisted.
+var dryRunScripts = require("script_entries/dryrun_scripts").dryRunScripts;
+
+// node.js url module. Makes it easier to resolve
+// urls in that datauri loaded dom
+var urlHandler = require("url_handler/url_handler");
+var isDryRun = require("addon_management/prefchange").isDryRun;
+
+var jsMimeTypeRe = /.*(javascript|ecmascript).*/i;
+var htmlMimeTypeRe = /.*(xhtml\+xml|html|multipart\/x-mixed-replace).*/i;
+
+
+var processResponseObject = {
+ data: null,
+ myParser: null,
+ url: null,
+ scriptFinder: null,
+ jsCheckString: null,
+ referrer: null,
+ contentType: null,
+ resInfo: null,
+ listener: null,
+ req: null,
+
+ /**
+ * starts the handling of a new response.
+ */
+ init: function (listener, resInfo) {
+ this.resInfo = resInfo;
+ this.req = resInfo.request;
+ /* needed for this.req.referrer */
+ this.req.QueryInterface(Ci.nsIHttpChannel);
+ this.listener = listener;
+ this.setData();
+ this.setContentType();
+ this.setUrls();
+ },
+
+ /**
+ * genBinaryOutput
+ * Set or reset binaryOutputStream and storageStream.
+ */
+ genBinaryOutput: function () {
+ this.storageStream = Cc["@mozilla.org/storagestream;1"]
+ .createInstance(Ci.nsIStorageStream);
+ this.binaryOutputStream = Cc["@mozilla.org/binaryoutputstream;1"]
+ .createInstance(Ci.nsIBinaryOutputStream);
+ },
+
+ /**
+ * Gather the data gathered from onDataAvailable.
+ */
+ setData: function () {
+ this.data = this.resInfo.receivedData;
+ //console.debug("\n\nDump of whole data:\n\n", this.data, "\n\n end of dump");
+ // Prevents the http response body from being empty,
+ // which would throw an error.
+ if (this.data == '' || this.data == undefined) {
+ this.data = " ";
+ }
+ },
+
+ /**
+ * Set a standardized lowercase mime type.
+ */
+ setContentType: function() {
+ if (this.req.contentType != undefined) {
+ this.contentType = String(this.req.contentType).toLowerCase();
+ }
+ },
+
+ /**
+ * setUrls
+ * Set the current URL of the response, and
+ * set referrer if applicable.
+ */
+ setUrls: function() {
+
+ if (this.req.URI != undefined) {
+ this.fragment = urlHandler.getFragment(this.req.URI.spec);
+ console.debug('fragment is', this.fragment);
+ this.url = urlHandler.removeFragment(this.req.URI.spec);
+ }
+ if (this.req.referrer != undefined) {
+ this.referrerFragment = urlHandler.getFragment(this.req.referrer.spec);
+ this.referrer = urlHandler.removeFragment(this.req.referrer.spec);
+ }
+ },
+
+ /**
+ * processHTML
+ * Modifies a string of html
+ */
+ processHTML: function() {
+ var charset = this.req.contentCharset, myParser;
+
+ if (this.req.contentCharset != undefined && this.req.contentCharset != "") {
+ charset = this.req.contentCharset;
+ } else {
+ charset = "";
+ }
+ acceptedScripts.clearScripts(this.req.URI.spec);
+ removedScripts.clearScripts(this.req.URI.spec);
+ dryRunScripts.clearScripts(this.req.URI.spec);
+
+ console.debug('charset is', charset);
+ console.debug(
+ 'responseStatus for', this.url, 'is', this.req.responseStatus);
+
+ // send data to htmlParser, and pass on modified data to
+ // originalListener.
+
+ myParser = htmlParser.htmlParser().parse(
+ this.data,
+ charset,
+ this.contentType,
+ this.url,
+ this.fragment,
+ this.req.responseStatus,
+ this.htmlParseCallback.bind(this));
+ },
+
+ /**
+ *
+ * htmlParseCallback
+ *
+ * Passed on the callback result to
+ * the originalListener.
+ *
+ */
+ htmlParseCallback: function(result) {
+
+ var len = result.length;
+
+ try {
+
+ this.listener.onDataAvailable(
+ this.req,
+ this.resInfo.context,
+ result.newInputStream(0), 0, len);
+
+
+ } catch (e) {
+
+ this.req.cancel(this.req.NS_BINDING_ABORTED);
+
+ }
+
+ this.listener.onStopRequest(
+ this.req,
+ this.resInfo.context, this.resInfo.statusCode);
+
+ },
+
+ /**
+ * processJS
+ * Process and modify a string of JavaScript.
+ */
+ processJS: function() {
+ var checker, check, jsCheckString,
+ that = this;
+ //var start = Date.now(), end;
+
+ try {
+ // make sure script isn't already listed as free
+ // in a JS web labels table.
+ if (this.checkJsWebLabelsForScript()) {
+ // this is free. we are done.
+ this.jsListenerCallback();
+ return;
+
+ }
+
+ // analyze javascript in response.
+ checker = jsChecker.jsChecker();
+ check = checker.searchJs(this.data, function () {
+ //console.debug("Has been analyzing", that.data);
+ that.processJsCallback(checker);
+ }, that.url);
+
+
+
+ } catch(e) {
+
+ // any error is considered nontrivial.
+ console.debug('js error in js app, removing script', e);
+ console.debug("error", e, e.lineNumber);
+ // modify data that will be sent to the browser.
+ this.data = '// LibreJS: Script contents were removed when it was loaded from a page, because another script attempted to load this one dynamically. Please place your cursor in the url bar and press the enter key to see the source.';
+ this.jsListenerCallback();
+ }
+
+ },
+
+ /**
+ * checkJsWebLabelsForScript
+ *
+ * check whether script that's been received has an entry
+ * in a js web labels table (lookup referrer.)
+ *
+ */
+ checkJsWebLabelsForScript: function () {
+
+ console.debug('checking script', this.url);
+ console.debug('current list is', JSON.stringify(jsWebLabelEntries));
+ if (jsWebLabelEntries[this.referrer] != undefined) {
+
+ var scriptList = jsWebLabelEntries[this.referrer],
+ i = 0,
+ len = scriptList.length;
+
+ for (; i < len; i++) {
+
+ if (scriptList[i].fileUrl === this.url &&
+ scriptList[i].free === true) {
+
+ console.debug(this.url, "is free and dynamic!");
+
+ var scriptObj = {
+ inline: false,
+ url: this.url,
+ contents: this.url,
+ reason: "This script is free (see JS Web Labels page for detail)"
+ };
+
+ acceptedScripts.addAScript(
+ this.req.referrer.spec, scriptObj, "Script is free");
+
+ return true;
+
+ }
+
+ }
+ }
+ },
+
+ processJsCallback: function(checker) {
+ try {
+ var scriptObj;
+
+ var jsCheckString = checker.parseTree.freeTrivialCheck;
+ console.debug("analyzing js callback for", this.url);
+ // for testing only.
+ //var jsCheckString = {'type': checkTypes.FREE_SINGLE_ITEM };
+ console.debug('jscheckstring is', jsCheckString.type);
+
+ if (jsCheckString.type === checkTypes.NONTRIVIAL) {
+ if (!allowedRef.urlInAllowedReferrers(this.req.referrer.spec)) {
+ //if (true) {
+ console.debug(
+ "url",
+ this.url,
+ " is found nontrivial",
+ "with reason",
+ jsCheckString.reason);
+ scriptObj = {
+ inline: false,
+ contents: '',
+ removalReason: 'nontrivial',
+ reason: jsCheckString.reason,
+ url: this.url,
+ hash: checker.hash
+ };
+ removedScripts.addAScript(this.req.referrer.spec, scriptObj);
+
+ // modify data that will be sent to the browser.
+ this.data = '// LibreJS: Script contents were removed when it was loaded from a page, because another script attempted to load this one dynamically and its contents appear to be nonfree/nontrivial. Please hit enter in the location bar to see the actual source.';
+ } else {
+ console.debug("writing to dry run", this.url);
+ scriptObj = {
+ inline:false,
+ contents: '',
+ removalReason: 'nontrivial',
+ reason: jsCheckString.reason,
+ url: this.url,
+ hash:checker.hash
+ };
+ dryRunScripts.addAScript(this.req.referrer.spec, scriptObj);
+ }
+
+ this.jsListenerCallback();
+
+ } else if (jsCheckString.type === checkTypes.FREE ||
+ jsCheckString.type === checkTypes.FREE_SINGLE_ITEM ||
+ jsCheckString.type === checkTypes.TRIVIAL ||
+ jsCheckString.type === checkTypes.TRIVIAL_DEFINES_FUNCTION ||
+ jsCheckString.type === checkTypes.WHITELISTED) {
+ console.debug(
+ "found a free script for",
+ this.url,
+ this.req.referrer.spec,
+ jsCheckString.reason);
+ console.debug('found a free script', this.req.referrer.spec);
+
+ scriptObj = {inline: false,
+ contents: '',
+ reason: jsCheckString.reason,
+ url: this.url,
+ hash:checker.hash};
+
+ acceptedScripts.addAScript(this.req.referrer.spec, scriptObj);
+ this.jsListenerCallback();
+ }
+
+ //var end = Date.now();
+ console.debug('exec time', this.url, ' -- ', end - start);
+ } catch (x) {
+ console.debug('error', x);
+ }
+ },
+
+ /**
+ * ProcessAllTypes
+ * Calls processHTML or JS if it finds an appropriate content
+ * type. For everything else it just passes on the data to the
+ * original listener.
+ */
+ processAllTypes: function() {
+ // toggle xlibrejs if X-LibreJS is set.
+
+ // process HTML
+ if ((htmlMimeTypeRe.test(this.contentType) ||
+ this.req.contentType === undefined)) {
+ this.processHTML();
+ return;
+ }
+
+ else {
+ // process external JS files that are called from another
+ // file (and hence have a referrer).
+
+ if (this.referrer != undefined &&
+ jsMimeTypeRe.test(this.contentType) &&
+ !(acceptedScripts.isFound(this.referrer, {
+ inline: false, contents: this.url})) &&
+ !(acceptedScripts.isFound(this.referrer, {
+ inline:false, contents:this.req.originalURI.spec}))) {
+
+ // console.debug('process js triggered for', this.url);
+ this.processJS();
+
+ } else {
+ this.jsListenerCallback();
+ }
+
+ }
+
+ },
+
+ jsListenerCallback: function () {
+
+ var len = this.data.length;
+
+ this.genBinaryOutput();
+
+ this.storageStream.init(8192, len, null);
+ this.binaryOutputStream.setOutputStream(
+ this.storageStream.getOutputStream(0));
+ this.binaryOutputStream.writeBytes(this.data, len);
+
+ try {
+ this.listener.onDataAvailable(
+ this.req,
+ this.resInfo.context,
+ this.storageStream.newInputStream(0),
+ 0, len);
+ } catch (e) {
+ this.req.cancel(this.req.NS_BINDING_ABORTED);
+ }
+
+ this.listener.onStopRequest(
+ this.req,
+ this.resInfo.context,
+ this.resInfo.statusCode);
+
+ }
+
+
+};
+
+// creates an instance of processResponseObject.
+exports.ProcessResponse = function (listener, resInfo) {
+ console.debug('triggered');
+ var procResponse = Object.create(processResponseObject);
+ procResponse.init(listener, resInfo);
+ return procResponse;
+};
diff --git a/lib/http_observer/stream_loader.js b/lib/http_observer/stream_loader.js
new file mode 100644
index 0000000..db136db
--- /dev/null
+++ b/lib/http_observer/stream_loader.js
@@ -0,0 +1,111 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+const processResponse = require('http_observer/process_response');
+
+var StreamLoader = function() {
+ this.loader = null;
+ this.listener = null;
+ this.originalListener = null;
+};
+
+StreamLoader.prototype.setOriginalListener = function(listener) {
+ this.originalListener = listener;
+};
+
+StreamLoader.prototype.init = function() {
+ try {
+ var that = this;
+ this.listener = new StreamListener();
+
+ this.listener.callback = function (loader, context, status, data) {
+ //console.debug("here is the data", data);
+ var responseInfo = {'request': loader.channel,
+ 'context': context,
+ 'statusCode': status,
+ 'receivedData': data};
+ var responseHandler = processResponse.ProcessResponse(that.originalListener, responseInfo);
+ responseHandler.processAllTypes();
+
+ that.destroy();
+ };
+
+ this.loader = Cc["@mozilla.org/network/unichar-stream-loader;1"].
+ createInstance(Ci.nsIUnicharStreamLoader);
+
+ this.loader.init(this.listener);
+ } catch (e) {
+ console.debug(e);
+ }
+};
+
+StreamLoader.prototype.destroy = function () {
+ this.loader = null;
+ this.listener = null;
+};
+
+var getRegexForContentType = function (contentType) {
+ if (/xhtml/i.test(contentType)) {
+ return /<\?[^>]*?encoding=(?:["']*)([^"'\s\?>]+)(?:["']*)/i;
+ }
+
+ // return the regular html regexp for anything else.
+ return /<meta[^>]*?charset=(?:["']*)([^"'\s>]+)(?:["']*)/i;
+};
+
+var StreamListener = function() {};
+
+StreamListener.prototype.QueryInterface = function listener_qi(iid) {
+ if (iid.equals(Ci.nsISupports) ||
+ iid.equals(Ci.nsIUnicharStreamLoaderObserver)) {
+ return this;
+ }
+ throw Cr.NS_ERROR_NO_INTERFACE;
+};
+
+StreamListener.prototype.onStreamComplete = function onStreamComplete(
+ loader, context, status, data) {
+ this.callback(loader, context, status, data);
+};
+
+StreamListener.prototype.onDetermineCharset = function onDetermineCharset(
+ loader, context, data) {
+ var match, regex;
+ if (loader.channel.contentCharset !== undefined &&
+ loader.channel.contentCharset !== ""
+ ) {
+ return loader.channel.contentCharset;
+ } else {
+ match = getRegexForContentType(loader.channel.contentType).exec(data);
+ if (match) {
+ loader.channel.contentCharset = match[1];
+ return match[1];
+ } else {
+ return "UTF-8";
+ }
+ }
+};
+
+exports.streamLoader = function () {
+ var l = new StreamLoader();
+ l.init();
+ return l;
+};
diff --git a/lib/js_checker/constant_types.js b/lib/js_checker/constant_types.js
new file mode 100644
index 0000000..59e7489
--- /dev/null
+++ b/lib/js_checker/constant_types.js
@@ -0,0 +1,190 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+//var debug = require("debug/debug");
+
+// token list from exports.init();
+exports.token = {
+ END: 0,
+ NEWLINE: 1,
+ SEMICOLON: 2,
+ COMMA: 3,
+ ASSIGN: 4,
+ HOOK: 5,
+ COLON: 6,
+ CONDITIONAL: 7,
+ OR: 8,
+ AND: 9,
+ BITWISE_OR: 10,
+ BITWISE_XOR: 11,
+ BITWISE_AND: 12,
+ EQ: 13,
+ NE: 14,
+ STRICT_EQ: 15,
+ STRICT_NE: 16,
+ LT: 17,
+ LE: 18,
+ GE: 19,
+ GT: 20,
+ LSH: 21,
+ RSH: 22,
+ URSH: 23,
+ PLUS: 24,
+ MINUS: 25,
+ MUL: 26,
+ DIV: 27,
+ MOD: 28,
+ NOT: 29,
+ BITWISE_NOT: 30,
+ UNARY_PLUS: 31,
+ UNARY_MINUS: 32,
+ INCREMENT: 33,
+ DECREMENT: 34,
+ DOT: 35,
+ LEFT_BRACKET: 36,
+ RIGHT_BRACKET: 37,
+ LEFT_CURLY: 38,
+ RIGHT_CURLY: 39,
+ LEFT_PAREN: 40,
+ RIGHT_PAREN: 41,
+ SCRIPT: 42,
+ BLOCK: 43,
+ LABEL: 44,
+ FOR_IN: 45,
+ CALL: 46,
+ NEW_WITH_ARGS: 47,
+ INDEX: 48,
+ ARRAY_INIT: 49,
+ OBJECT_INIT: 50,
+ PROPERTY_INIT: 51,
+ GETTER: 52,
+ SETTER: 53,
+ GROUP: 54,
+ LIST: 55,
+ LET_BLOCK: 56,
+ ARRAY_COMP: 57,
+ GENERATOR: 58,
+ COMP_TAIL: 59,
+ IDENTIFIER: 60,
+ NUMBER: 61,
+ STRING: 62,
+ REGEXP: 63,
+ BREAK: 64,
+ CASE: 65,
+ CATCH: 66,
+ CONST: 67,
+ CONTINUE: 68,
+ DEBUGGER: 69,
+ DEFAULT: 70,
+ DELETE: 71,
+ DO: 72,
+ ELSE: 73,
+ EXPORT: 74,
+ FALSE: 75,
+ FINALLY: 76,
+ FOR: 77,
+ FUNCTION: 78,
+ IF: 79,
+ IMPORT: 80,
+ IN: 81,
+ INSTANCEOF: 82,
+ LET: 83,
+ MODULE: 84,
+ NEW: 85,
+ NULL: 86,
+ RETURN: 87,
+ SWITCH: 88,
+ THIS: 89,
+ THROW: 90,
+ TRUE: 91,
+ TRY: 92,
+ TYPEOF: 93,
+ VAR: 94,
+ VOID: 95,
+ YIELD: 96,
+ WHILE: 97,
+ WITH: 98
+};
+
+var checkTypes = {
+ // trivial.
+ TRIVIAL: 1,
+
+ // defines functions, and so might or might not
+ // be trivial in the end.
+ TRIVIAL_DEFINES_FUNCTION: 2,
+
+ NONTRIVIAL: 3,
+
+ // Free
+ FREE: 4,
+ FREE_SINGLE_ITEM: 5,
+ WHITELISTED: 6
+};
+
+exports.checkTypes = checkTypes;
+
+exports.emptyTypeObj = function() {
+ return {
+ 'type': null,
+ 'reason': null
+ };
+};
+
+exports.nontrivialWithComment = function(comment) {
+ return {
+ 'type': checkTypes.NONTRIVIAL,
+ 'reason': comment
+ };
+};
+
+exports.trivialWithComment = function(comment) {
+ return {
+ 'type': checkTypes.TRIVIAL,
+ 'reason': comment
+ };
+};
+
+exports.trivialFuncWithComment = function(comment) {
+ return {
+ 'type': checkTypes.TRIVIAL_DEFINES_FUNCTION,
+ 'reason': comment
+ };
+};
+
+exports.freeWithComment = function(comment) {
+ return {
+ 'type': checkTypes.FREE,
+ 'reason': comment
+ };
+};
+
+exports.singleFreeWithComment = function(comment) {
+ return {
+ 'type': checkTypes.FREE_SINGLE_ITEM,
+ 'reason': comment
+ };
+};
+
+exports.whitelisted = function(comment) {
+ return {
+ 'type': checkTypes.WHITELISTED,
+ 'reason': comment + ' -- whitelisted by user'
+ };
+};
diff --git a/lib/js_checker/free_checker.js b/lib/js_checker/free_checker.js
new file mode 100644
index 0000000..9aaa262
--- /dev/null
+++ b/lib/js_checker/free_checker.js
@@ -0,0 +1,231 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var licenses = require('js_checker/license_definitions');
+var simpleStorage = require("sdk/simple-storage");
+const LAZY = licenses.types.LAZY;
+var licenseRegex = [];
+const END_OF_SCRIPT = require('html_script_finder/bug_fix').END_OF_SCRIPT;
+const types = require("js_checker/constant_types");
+
+const token = types.token;
+
+var patternUtils = require('js_checker/pattern_utils').patternUtils;
+
+var licStartLicEndRe = /@licstartThefollowingistheentirelicensenoticefortheJavaScriptcodeinthis(?:page|file)(.*)?@licendTheaboveistheentirelicensenoticefortheJavaScriptcodeinthis(?:page|file)/mi;
+var licenseMagnet = /.*@license ?(magnet\:\?xt=urn\:btih\:[0-9A-Za-z]+).*/;
+var licenseEndMagnet = /.*@license-end.*/i;
+exports.freeCheck = {
+ initLicenses: function (licenses) {
+ for (var item in licenses) {
+ this.stripLicenseToRegexp(licenses[item]);
+ }
+ },
+
+ /**
+ * stripLicenseToRegexp
+ *
+ * Removes all non-alphanumeric characters except for the
+ * special tokens, and replace the text values that are
+ * hardcoded in license_definitions.js
+ *
+ */
+ stripLicenseToRegexp: function (license) {
+ var i = 0,
+ max = license.licenseFragments.length,
+ item;
+
+ for (; i < max; i++) {
+ item = license.licenseFragments[i];
+ item.regex = patternUtils.removeNonalpha(item.text);
+
+ if (license.licenseFragments[i].type === LAZY) {
+
+ // do not permit words before. Since "Not" could be added
+ // and make it nonfree. e.g.: Not licensed under the GPLv3.
+ item.regex = '^(?!.*not).*' + item.regex;
+
+ }
+
+ item.regex = new RegExp(
+ patternUtils.replaceTokens(item.regex), 'i');
+ }
+
+ return license;
+ },
+
+ /**
+ * checkNodeFreeLicense
+ *
+ * Check if the node mentions a free license
+ * in one of its comments.
+ *
+ */
+ checkNodeFreeLicense: function (n, queue) {
+ var strippedComment,
+ magnetLink,
+ comment = this.getComment(n),
+ list = licenses.licenses,
+ i, j,
+ max,
+ regex,
+ frag,
+ matchLicStart,
+ matchMagnet,
+ license,
+ isMagnetValid = false;
+
+ if (n.counter === 2 &&
+ n.parent != undefined &&
+ n.parent.type === token.SCRIPT &&
+ comment != undefined &&
+ comment != " "
+ ) {
+ strippedComment = patternUtils.removeNonalpha(comment);
+ matchLicStart = strippedComment.match(licStartLicEndRe);
+ console.debug("matchMagnet is", matchMagnet);
+ if (matchLicStart) {
+ strippedComment = matchLicStart[1];
+ for (license in list) {
+ frag = list[license].licenseFragments;
+ max = list[license].licenseFragments.length;
+ for (i = 0; i < max; i++) {
+ if (frag[i].regex.test(strippedComment)) {
+ return {
+ licenseName: list[license].licenseName,
+ type: types.checkTypes.FREE
+ };
+
+ }
+ }
+ }
+ }
+ // check for @license -- @license-end notation.
+ return this.matchMagnet(comment, queue);
+ }
+ },
+
+ /**
+ * matchMagnet
+ * Attempts to find valid @license [magnet]
+ * and @license-end notation.
+ */
+ matchMagnet: function (comment, queue) {
+ let matchMagnet = comment.match(licenseMagnet);
+ if (matchMagnet) {
+ let magnetLinkRe = new RegExp(
+ matchMagnet[1].replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
+ );
+ let list = licenses.licenses;
+ let queue_end = queue.length;
+
+ for (var license in list) {
+ frag = list[license].canonicalUrl;
+ console.debug("frag is ", frag);
+ if (frag != undefined) {
+ max = list[license].canonicalUrl.length;
+ console.debug("max is", max);
+ for (i = 0;i < max; i++) {
+ console.debug("current frag is", frag[i]);
+ if (frag[i].match(magnetLinkRe)) {
+ for (let i = 0; i < queue_end; i++) {
+ console.debug(queue[i]);
+ let n = queue[i];
+ comment = this.getComment(n);
+ if (comment != undefined &&
+ comment.match(licenseEndMagnet) &&
+ this.checkIsLastNode(n)
+ ) {
+ // found a closing match. Just accept this script.
+ return {
+ licenseName: list[license].licenseName,
+ type: types.checkTypes.FREE_SINGLE_ITEM
+ };
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return;
+ },
+
+ /**
+ * checkIsLastJsNode.
+ * returns true if n is the last node.
+ * Or if nodes before it are only comments etc (not valid code.)
+ * A special LibreJS node is appended at the end of a script tree to
+ * check if this is the last (and also for narcissus to keep the last comment
+ * in the tree.)
+ * TODO: Refactor LibreJS so that END nodes can have a comment.
+ */
+ checkIsLastNode: function (n) {
+ // first check if the comment is part of the very last statement.
+ if (n.value == "this" && n.next == undefined) {
+ // just make sure the last node is indeed our harmless bit of
+ // js.
+ if (n.tokenizer) {
+ let source = n.tokenizer.source;
+ let substring = source.substr(n.start, n.end+23);
+ if (substring == END_OF_SCRIPT) {
+ return true;
+ }
+ else {
+ console.debug("substring is ", substring);
+ return false;
+ }
+ }
+ console.debug("Hurra! This is the end of our script");
+ return true;
+ }
+
+ // isn't our last node.
+ return false;
+ },
+
+ /**
+ * getComment
+ *
+ * Grab the comment(s) from the node. Concatenates
+ * multiple comments.
+ *
+ */
+ getComment: function (n) {
+ var i = 0, length, comment = "";
+
+ if (n.blockComments == undefined || n.blockComments == " ") {
+ return;
+ }
+
+ length = n.blockComments.length;
+ if (length > 0) {
+ for (; i < length; i++) {
+ comment += n.blockComments[i];
+ }
+ }
+ if (comment == "") {
+ return;
+ }
+ return comment;
+ }
+};
+
+exports.freeCheck.initLicenses(licenses.licenses);
diff --git a/lib/js_checker/js_checker.js b/lib/js_checker/js_checker.js
new file mode 100644
index 0000000..0cf06e3
--- /dev/null
+++ b/lib/js_checker/js_checker.js
@@ -0,0 +1,518 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+var narcissusWorker = require("parser/narcissus_worker")
+ .narcissusWorker;
+
+const nonTrivialModule = require("js_checker/nontrivial_checker");
+const freeChecker = require("js_checker/free_checker");
+const relationChecker = require("js_checker/relation_checker");
+const types = require("js_checker/constant_types");
+
+const scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+var isDryRun = require("addon_management/prefchange").isDryRun;
+
+var checkTypes = types.checkTypes;
+
+const token = types.token;
+
+// for setTimeout.
+const timer = require("sdk/timers");
+
+var callbackMap = {};
+
+/**
+ *
+ * Pairs a hash with a given callback
+ * method from an object.
+ *
+ */
+var setHashCallback = function(hash, callback, notification) {
+ console.debug('setHashCallback', hash);
+ if (hash in callbackMap && isDryRun()) {
+ // workaround for issue with dryrun after checking box.
+ // do nothing.
+ callbackMap[hash] = callback;
+ } else if (hash in callbackMap) {
+ console.debug("callback", callbackMap[hash]);
+ if (notification && typeof notification.close === 'function') {
+ notification.close();
+ }
+ throw Error("already being checked.");
+ } else {
+ console.debug('setting callbackMap for', hash, 'to', callback);
+ callbackMap[hash] = callback;
+ }
+ console.debug("callback is type: ", callback.constructor);
+ //callbackMap[hash] = callback;
+};
+
+var removeHashCallback = function(hash) {
+ if (hash in callbackMap) {
+ delete callbackMap[hash];
+ }
+};
+
+/**
+ * find callback and return result (parse tree).
+ *
+ */
+exports.callbackHashResult = function(hash, result) {
+ console.debug('typeof callbackMap function:', typeof callbackMap[hash]);
+ console.debug('for hash', hash);
+ try {
+ callbackMap[hash](result, hash);
+ } catch (x) {
+ console.debug('error in jsChecker', x, 'hash:', hash);
+ // return tree as false.
+ console.debug("Error with", x);
+ if (typeof callbackMap[hash] === 'function') {
+ callbackMap[hash](false, hash);
+ } else {
+ console.debug('callbackHashResult Error', x);
+ }
+ }
+ // remove callback after it's been called.
+ console.debug('JsChecker.callbackHashResult: calling removeHashCallback');
+ removeHashCallback(hash);
+};
+
+var JsChecker = function() {
+ this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+ this.nonTrivialChecker = null;
+ this.freeToken = false;
+ this.nontrivialness = false;
+ this.parseTree = null;
+ this.relationChecker = null;
+ this.jsCode = null;
+ this.resultReady = null;
+ this.notification = null;
+ this.walkTreeCancelled = false;
+ this.shortText = null;
+ this.hash = null;
+ this.queue = null; // will contain the nodes of the script.
+};
+
+/**
+ * searchJs
+ *
+ * Takes in some javascript code (as string).
+ * Uses Narcissus parser to build an abstract syntax tree.
+ * Checks for trivialness.
+ *
+ */
+JsChecker.prototype.searchJs = function(jsCode, resultReady, url) {
+ var that = this;
+ var bugfix = require('html_script_finder/bug_fix').narcissusBugFixLibreJS;
+ console.debug('JsChecker.searchJs for script url:', url);
+ this.url = url;
+ this.resultReady = resultReady;
+ this.jsCode = jsCode;
+ this.shortText = jsCode.replace(bugfix, '').substring(0,100);
+ this.notification = require("ui/notification")
+ .createNotification(this.shortText).notification;
+
+ var verbatimCode = this.jsCode.replace(bugfix, '');
+ this.hash = scriptsCached.getHash(verbatimCode);
+ var isCached = scriptsCached.isCached(verbatimCode, this.hash);
+ if (isCached) {
+ console.debug("We have it cached indeed!");
+ // there is an existing entry for this exact copy
+ // of script text.
+ console.debug('this script result is cached', this.hash,
+ isCached.result.type);
+ console.debug("Return right away");
+ // we are not generating a parse tree.
+ this.parseTree = {};
+ // fake the result is from parse tree.
+ this.parseTree.freeTrivialCheck = isCached.result;
+
+ this.relationChecker = isCached.relationChecker;
+ // leave without doing parsing/analysis part.
+ this.resultReady();
+ this.removeNotification();
+ return;
+ }
+
+ console.debug('url is not cached:', url);
+
+ try {
+ // no cache, continue.
+ this.relationChecker = relationChecker.relationChecker();
+ this.freeToken = types.emptyTypeObj();
+ this.nontrivialness = types.emptyTypeObj();
+
+ // use this.hash to keep track of comments made by the nontrivial
+ // checker code about why/how the code is found to be nontrivial.
+ this.nonTrivialChecker =
+ nonTrivialModule.nonTrivialChecker(this.hash);
+
+ // register callback and hash. So that result
+ // can be passed.
+ setHashCallback(
+ this.hash, this.handleTree.bind(this), this.notification);
+
+ // parse using ChromeWorker.
+ console.debug(
+ 'JsChecker.searchJs(): starting narcissusWorker.parse()');
+ narcissusWorker.parse(this.jsCode, this.hash);
+ } catch (x) {
+ console.debug('error', x);
+ this.handleTree(false, x);
+ this.removeNotification();
+ }
+};
+
+JsChecker.prototype.handleTree = function(tree, errorMessage) {
+ var that = this;
+
+ if (tree == false || tree == undefined) {
+ // error parsing tree. Just return nonfree nontrivial.
+ this.parseTree = {};
+ this.parseTree.freeTrivialCheck = types.nontrivialWithComment(
+ 'error parsing: ' + errorMessage);
+
+ // cache result with hash of script for future checks.
+ scriptsCached.addEntry(this.jsCode, this.parseTree.freeTrivialCheck,
+ this.relationChecker, true, this.url);
+ this.resultReady();
+ } else {
+ try {
+ // no need to keep parseTree in property
+ this.parseTree = {}; //tree;
+ //console.debug(tree);
+ this.walkTree(tree);
+ } catch (x) {
+ console.debug(x, x.lineNumber, x.fileName);
+ }
+ }
+};
+
+/**
+ * getCheckerResult
+ *
+ * Callback to Assign result from walkTree to property.
+ * reset parse tree. create cache entry.
+ *
+ */
+JsChecker.prototype.getCheckerResult = function(result) {
+ // done with parse tree. Get rid of it.
+ this.parseTree = {};
+ this.removeNotification();
+
+ this.parseTree.nonTrivialChecker = this.nonTrivialChecker;
+
+ // actual result stored here. hack since we used parseTree before.
+ this.parseTree.freeTrivialCheck = result;
+
+ // cache result with hash of script for future checks.
+ scriptsCached.addEntry(this.jsCode, this.parseTree.freeTrivialCheck,
+ this.relationChecker, true, this.url);
+
+ this.resultReady();
+};
+
+/**
+ * trivialCheck
+ *
+ * Runs nodes through a series of conditional statements
+ * to find out whether it is trivial or not.
+ *
+ * @param {object} n. The current node being studied.
+ * @param {string} t. The type of node being studied
+ * (initializer, functionbody, try block, ...)
+ *
+ */
+JsChecker.prototype.trivialCheck = function(n) {
+ return this.nonTrivialChecker.checkNontrivial(n);
+};
+
+/**
+ * freeCheck
+ *
+ * Check if comments above current node could be a free licence.
+ * If it is, then the script will be flagged as free.
+ *
+ * @param {object} n. The current node being studied.
+ * (initializer, functionbody, try block, ...)
+ *
+ */
+JsChecker.prototype.freeCheck = function(n, ntype) {
+ var check = freeChecker.freeCheck.checkNodeFreeLicense(n, this.queue);
+ return check;
+};
+
+/**
+ * walkTree
+ *
+ * An iterative functionwalking the parse tree generated by
+ * Narcissus.
+ *
+ * @param {object} node. The original node.
+ *
+ */
+JsChecker.prototype.walkTree = function(node) {
+ var queue = [node];
+ var i,
+ len,
+ n, counter = 0,
+ result,
+ processQueue,
+ that = this;
+
+ this.queue = queue; // set as property.
+
+ // set top node as visited.
+ node.visited = true;
+
+ /**
+ * functionwalking the tree for a given
+ * amount of time, before calling itself again.
+ */
+ processQueue = function() {
+ var nodeResult, end;
+
+ // record start time of functionexecution.
+ var start = Date.now();
+
+ if (that.walkTreeCancelled) {
+ // tree walking already completed.
+ return;
+ }
+
+ while (queue.length) {
+ n = queue.shift();
+ n.counter = counter++;
+ console.debug("Under review", n.type);
+ if (n.children != undefined) {
+ // fetch all the children.
+ len = n.children.length;
+ for (i = 0; i < len; i++) {
+ if (n.children[i] != undefined &&
+ n.children[i].visited == undefined
+ ) {
+ // figure out siblings.
+ if (i > 0) {
+ n.children[i].previous = n.children[i-1];
+ }
+
+ if (i < len) {
+ n.children[i].next = n.children[i+1];
+ }
+ // set parent property.
+ n.children[i].parent = n;
+ n.children[i].visited = true;
+ queue.push(n.children[i]);
+ }
+ }
+ }
+
+ if (n.type != undefined) {
+ // fetch all properties that may have nodes.
+ for (var item in n) {
+ if (item != 'tokenizer' &&
+ item != 'children' &&
+ item != 'length' &&
+ n[item] != null &&
+ typeof n[item] === 'object' &&
+ n[item].type != undefined &&
+ n[item].visited == undefined
+ ) {
+ n[item].visited = true;
+ // set parent property
+ n[item].parent = n;
+ queue.push(n[item]);
+ }
+ }
+ }
+
+ that.checkNode(n);
+
+ if (that.freeToken.type === checkTypes.FREE ||
+ that.freeToken.type === checkTypes.FREE_SINGLE_ITEM
+ ) {
+ // nothing more to look for. We are done.
+ that.walkTreeComplete(that.freeToken);
+ return;
+ } else if (that.nontrivialness.type === checkTypes.NONTRIVIAL) {
+ // nontrivial
+ // we are done.
+ that.walkTreeComplete(that.nontrivialness);
+ return;
+ }
+ // call processQueue again if needed.
+ end = Date.now();
+
+ if (queue.length) {
+ // there are more nodes in the queue.
+
+ if ((end - start) > 30) {
+
+ // been running more than 20ms, pause
+ // for 10 ms before calling processQueue
+ // again.
+ timer.setTimeout(processQueue, 8);
+ return;
+ }
+ } else {
+ // we are done.
+ that.removeNotification();
+ that.walkTreeComplete();
+ return;
+ }
+ }
+ };
+
+ if (node.type === token.SCRIPT) {
+ // this is the global scope.
+ node.global = true;
+ node.parent = null;
+
+ this.relationChecker.storeGlobalDeclarations(node);
+
+ queue.push(node);
+ processQueue();
+ }
+};
+
+/**
+ * set walk tree cancelled bool as true.
+ * the walk tree method won't run after the variable
+ * is set to true.
+ */
+JsChecker.prototype.cancelWalkTree = function() {
+ // prevent any further work on node codes.
+ this.walkTreeCancelled = true;
+};
+
+/**
+ * walkTreeComplete
+ *
+ * Trigger when the walkTree has been completed or
+ * when it has been cut short.
+ *
+ */
+JsChecker.prototype.walkTreeComplete = function(result) {
+ var that = this;
+ this.removeNotification();
+
+ if (this.walkTreeCancelled) {
+ // we already triggered complete.
+ return;
+ }
+
+ // we set the token to cancel further processing.
+ this.cancelWalkTree();
+
+ if (result != undefined) {
+ // walkTree was returned faster, use it instead.
+ this.getCheckerResult(result);
+
+ // we are done.
+ return;
+ }
+
+ // if all code was fully analyzed.
+ if (this.nontrivialness.type === checkTypes.NONTRIVIAL) {
+ this.getCheckerResult(this.nontrivialness);
+ } else if (this.freeToken.type === checkTypes.FREE) {
+ // this is free and may or may not define functions, we don't care.
+ this.getCheckerResult(this.freeToken);
+ } else if (this.nontrivialness.type ===
+ checkTypes.TRIVIAL_DEFINES_FUNCTION) {
+ // trivial scripts should become nontrivial if an external script.
+ // it may or may not be trivial if inline.
+ this.getCheckerResult(this.nontrivialness);
+ } else {
+ // found no nontrivial constructs or free license, so it's
+ // trivial.
+
+ this.getCheckerResult(
+ types.trivialFuncWithComment("This script is trivial"));
+ }
+};
+
+
+/**
+ * checkNode
+ *
+ * checks a single node.
+ *
+ */
+JsChecker.prototype.checkNode = function(n) {
+ var sub;
+ var fc = this.freeCheck(n);
+ var tc = this.trivialCheck(n);
+
+ var nodeResult;
+
+ // check if identifier may be window property (assumption).
+ this.relationChecker.checkIdentifierIsWindowProperty(n);
+
+ /*if (fc) {
+ console.debug("FC is", fc, "type is", fc.type);
+ }*/
+ if (fc && fc.type == checkTypes.FREE) {
+ // this is free!
+ // freeToken is persistent across nodes analyzed and valid
+ // for an entire script.
+ this.freeToken = types.freeWithComment(
+ "Script appears to be free under the following license: " +
+ fc.licenseName);
+ return;
+ } else if (fc && fc.type == checkTypes.FREE_SINGLE_ITEM) {
+ console.debug("free single item");
+ this.freeToken = types.singleFreeWithComment(
+ "Script appears to be free under the following license: " +
+ fc.licenseName);
+ return;
+ }
+
+ if (tc) {
+ if (tc.type === checkTypes.NONTRIVIAL) {
+ // nontrivial_global is deprecated
+ this.nontrivialness = tc;
+ return;
+ } else if (tc.type === checkTypes.TRIVIAL_DEFINES_FUNCTION) {
+ this.nontrivialness = tc;
+ return;
+ }
+ }
+};
+
+JsChecker.prototype.removeNotification = function() {
+ console.debug('JsChecker.removeNotification()');
+ if (this.notification &&
+ typeof this.notification.close === 'function'
+ ) {
+ console.debug('removing', this.shortText);
+ // remove notification early on.
+ this.notification.close();
+ this.notification = null;
+ }
+};
+
+exports.jsChecker = function() {
+ return new JsChecker();
+};
+
+exports.removeHashCallback = removeHashCallback;
diff --git a/lib/js_checker/license_definitions.js b/lib/js_checker/license_definitions.js
new file mode 100644
index 0000000..79e5090
--- /dev/null
+++ b/lib/js_checker/license_definitions.js
@@ -0,0 +1,249 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+exports.types = {
+ SHORT: 'short',
+ LAZY: 'lazy',
+ FULL: 'full'
+};
+
+var type = exports.types;
+
+/**
+ * List of all the licenses.
+ * Currently only short substrings are used with regex.
+ */
+exports.licenses = {
+ CC0: {
+ licenseName: 'Creative Commons CC0 1.0 Universal',
+ canonicalUrl: [
+ 'http://creativecommons.org/publicdomain/zero/1.0/legalcode',
+ 'magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt'
+ ],
+ identifier: 'CC0-1.0',
+ licenseFragments: []
+ },
+
+
+ gplv2: {
+ licenseName: 'GNU General Public License (GPL) version 2',
+ canonicalUrl: [
+ 'http://www.gnu.org/licenses/gpl-2.0.html',
+ 'magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt'
+ ],
+ identifier: 'GNU-GPL-2.0',
+ licenseFragments: [{text: "<THISPROGRAM> is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.", type: type.SHORT},
+ {text:"Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the \"GPL\"), or the GNU Lesser General Public License Version 2.1 or later (the \"LGPL\"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL.", type: type.SHORT}]
+ },
+
+ gplv3: {
+ licenseName: 'GNU General Public License (GPL) version 3',
+ canonicalUrl: [
+ 'http://www.gnu.org/licenses/gpl-3.0.html',
+ 'magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt'
+ ],
+ identifier: 'GNU-GPL-3.0',
+ licenseFragments: [
+ {text: "The JavaScript code in this page is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License (GNU GPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The code is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. As additional permission under GNU GPL version 3 section 7, you may distribute non-source (e.g., minimized or compacted) forms of that code without the copy of the GNU GPL normally required by section 4, provided you include this license notice and a URL through which recipients can access the Corresponding Source.", type: type.SHORT},
+ {text: "<THISPROGRAM> is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.", type: type.SHORT}]
+ },
+
+ gnuAllPermissive: {
+ licenseName: 'GNU All-Permissive License',
+ licenseFragments: [{text: "Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.", type: type.SHORT}]
+ },
+
+ apache_2License: {
+ licenseName: 'Apache License, Version 2.0',
+ canonicalUrl: [
+ 'http://www.apache.org/licenses/LICENSE-2.0',
+ 'magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt'
+ ],
+ identifier: 'Apache-2.0',
+ licenseFragments: [{text: "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0", type: type.SHORT}]
+ },
+
+ lgpl21: {
+ licenseName: 'GNU Lesser General Public License, version 2.1',
+ canonicalUrl: [
+ 'http://www.gnu.org/licenses/lgpl-2.1.html',
+ 'magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt'
+ ],
+ identifier: 'GNU-LGPL-2.1',
+ licenseFragments: [{text: "<THISLIBRARY> is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.", type: type.SHORT}]
+ },
+
+ lgplv3: {
+ licenseName: 'GNU Lesser General Public License, version 3',
+ canonicalUrl: [
+ 'http://www.gnu.org/licenses/lgpl-3.0.html',
+ 'magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt'
+ ],
+ identifier: 'GNU-LGPL-3.0',
+ licenseFragments: [{text: "<THISPROGRAM> is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.", type: type.SHORT}]
+ },
+
+ agplv3: {
+ licenseName: 'GNU AFFERO GENERAL PUBLIC LICENSE version 3',
+ canonicalUrl: [
+ 'http://www.gnu.org/licenses/agpl-3.0.html',
+ 'magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt'
+ ],
+ identifier: 'GNU-AGPL-3.0',
+ licenseFragments: [{text: "<THISPROGRAM> is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.", type: type.SHORT}]
+ },
+
+ boostSoftware: {
+ licenseName: 'Boost Software License',
+ canonicalUrl: [
+ 'http://www.boost.org/LICENSE_1_0.txt',
+ 'magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&dn=Boost-1.0.txt'
+ ],
+ licenseFragments: [{text: "Boost Software License <VERSION> <DATE> Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the \"Software\") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following", type: type.SHORT}]
+ },
+
+ bsd3: {
+ licenseName: "BSD 3-Clause License",
+ canonicalUrl: [
+ 'http://opensource.org/licenses/BSD-3-Clause',
+ 'magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt'
+ ],
+ licenseFragments: [{text: "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.", type: type.SHORT}]
+ },
+
+ bsd2: {
+ licenseName: "BSD 2-Clause License",
+ licenseFragments: [{text: "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.", type: type.SHORT}]
+ },
+
+ epl_1_0: {
+ licenseName: "Eclipse Public License Version 1.0",
+ identifier: "EPL-1.0",
+ canonicalUrl: [
+ "http://www.eclipse.org/legal/epl-v10.html",
+ "magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&dn=epl-1.0.txt"
+ ],
+ licenseFragments: [
+ {
+ text: "THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (\"AGREEMENT\"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.",
+ type: type.SHORT
+ }
+ ]
+ },
+
+ mozillaPublicLicense_2_0: {
+ licenseName: 'Mozilla Public License Version 2.0',
+ identifier: 'MPL-2.0',
+ canonicalUrl: [
+ 'http://www.mozilla.org/MPL/2.0',
+ 'magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt'
+ ],
+ licenseFragments: [{text: "This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.", type: type.SHORT }]
+ },
+
+ expat: {
+ licenseName: 'Expat License (sometimes called MIT Licensed)',
+ identifier: 'Expat',
+ canonicalUrl: [
+ 'http://www.jclark.com/xml/copying.txt',
+ 'magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt'
+ ],
+ licenseFragments: [{text: "Copyright <YEAR> <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.", type: type.SHORT}]
+ },
+
+ X11: {
+ licenseName: 'X11 License',
+ canonicalUrl: [
+ 'magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt'
+ ],
+ licenseFragments: [{text: "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.", type: type.SHORT}]
+ },
+
+ XFree86: {
+ licenseName: "XFree86 License",
+ identifier: 'Modified-BSD',
+ canonicalUrl: [
+ 'http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3',
+ 'http://www.xfree86.org/current/LICENSE4.html',
+ 'magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&dn=xfree86.txt'
+ ],
+ licenseFragments: [{text: "All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution, and in the same place and form as other copyright, license and disclaimer information.\n3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: \"This product includes software developed by The XFree86 Project, Inc (http://www.xfree86.org/) and its contributors\", in the same place and form as other third-party acknowledgments. Alternately, this acknowledgment may appear in the software itself, in the same form and location as other such third-party acknowledgments.4. Except as contained in this notice, the name of The XFree86 Project, Inc shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project, Inc.", type: type.SHORT}
+ ]
+ },
+
+ FreeBSD: {
+ licenseName: "FreeBSD License",
+ canonicalUrl: [
+ 'http://www.freebsd.org/copyright/freebsd-license.html',
+ 'magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&dn=freebsd.txt'
+ ],
+ licenseFragments: [{text: "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.", type: type.SHORT}]
+ },
+
+ ISC: {
+ licenseName: "The ISC License",
+ canonicalUrl: [
+ 'https://www.isc.org/downloads/software-support-policy/isc-license/',
+ 'magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&dn=ISC.txt'
+ ],
+ licenseFragments: [{text: "Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.", type: type.SHORT},
+ {text: "Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.", type: type.SHORT}]
+ },
+
+ jQueryTools: {
+ licenseName: "jQuery Tools",
+ licenseFragments: [{text: 'NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.', type: type.SHORT}]
+ },
+
+ ArtisticLicense2: {
+ licenseName: "Artistic License 2.0",
+ canonicalUrl: [
+ "http://www.perlfoundation.org/artistic_license_2_0",
+ "magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&dn=artistic-2.0.txt"
+ ],
+ licenseFragments: []
+ },
+
+ PublicDomain: {
+ licenseName: "Public Domain",
+ canonicalUrl: [
+ 'magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt'
+ ],
+ licenseFragments: []
+ },
+
+ CPALv1: {
+ licenseName: 'Common Public Attribution License Version 1.0 (CPAL)',
+ canonicalUrl: [
+ 'http://opensource.org/licenses/cpal_1.0',
+ 'magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&dn=cpal-1.0.txt'
+ ],
+ identifier: 'CPAL-1.0',
+ licenseFragments: [
+ {
+ text: 'The contents of this file are subject to the Common Public Attribution License Version 1.0',
+ type: type.SHORT
+ },
+ {
+ text: 'The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2.',
+ type: type.SHORT
+ }
+ ]
+ }
+};
diff --git a/lib/js_checker/nontrivial_checker.js b/lib/js_checker/nontrivial_checker.js
new file mode 100644
index 0000000..4d3bc8b
--- /dev/null
+++ b/lib/js_checker/nontrivial_checker.js
@@ -0,0 +1,374 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+const types = require("js_checker/constant_types");
+
+// constants from Narcissus for function types.
+const DECLARED_FORM = 0, EXPRESSED_FORM = 1, STATEMENT_FORM = 2;
+
+const token = types.token;
+
+var checkTypes = types.checkTypes;
+
+var utils = {
+ /**
+ * nodeContains
+ * Checks that node contains both a type and a value.
+ * Shortcut to check for null/undefined.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if matching.
+ */
+ nodeContains: function (n, type, value) {
+ if (n != undefined) {
+ return n.type === type &&
+ n.value === value;
+ }
+ },
+
+ /**
+ * isType
+ * Checks that node is of a certain type.
+ * Shortcut to check for null/undefined.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean}. True if it's the right type.
+ */
+ isType: function (n, type) {
+ return n != undefined && n.type === type;
+ },
+
+ isNotType: function (n, type) {
+ return n != undefined && n.type !== type;
+ },
+
+ /**
+ * hasChildren
+ *
+ * Checks the token on the left
+ * and on the right.
+ *
+ * @param {object} n. The current node being studied.
+ * @param {leftType} token constant. The type on the
+ * left.
+ * @param {rightType} token constant. The type of child
+ * on the right
+ *
+ */
+ hasChildren: function (n, leftType, rightType) {
+ if (types == undefined) {
+ return false;
+ }
+ return this.isType(n.children[0], leftType) &&
+ this.isType(n.children[1], rightType);
+ },
+
+ /**
+ * findScriptTag
+ *
+ * This method should probably be replaced with DOM testing
+ * as regex is rather insufficiant, and this wouldn't cover
+ * tricky constructs as shown in http://ha.ckers.org/xss.html.
+ */
+ findScriptTag: function (n) {
+ return n.value != undefined &&
+ /<script[^>]*?>/i.test(n.value);
+ }
+};
+
+var NonTrivialChecker = function() {
+ this.definesFunction = false;
+ this.hash = null;
+};
+
+/**
+ * definesFunctionFound
+ *
+ * Returns true if it finds a node of type FUNCTION
+ * that isn't a callback or an IIFE.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ */
+NonTrivialChecker.prototype.definesFunctionFound = function (n) {
+ var isFunction = false;
+ if (n.type === token.FUNCTION &&
+ n.body != undefined) {
+
+ if (n.functionForm !== token.DECLARED_FORM &&
+ ((n.parent.type === token.LIST &&
+ n.parent.parent.type === token.CALL) ||
+ n.parent.type === token.CALL) &&
+ n.name == undefined) {
+ // this is a callback or an immediately
+ // invoked function expression "IIFE".
+ isFunction = false;
+ } else {
+ // this is a regular function declaration or
+ // function expression assigned to a variable.
+ //console.log("THIS DEFINES FUNCTION");
+ isFunction = true;
+ }
+ }
+
+ // look for Function constructor.
+ if (n.type === token.IDENTIFIER &&
+ n.value === 'Function' &&
+ (n.parent.type === token.NEW_WITH_ARGS ||
+ n.parent.type === token.CALL)) {
+ // this is a Function constructor.
+ //console.log("THIS DEFINES FUNCTION");
+ isFunction = true;
+ }
+
+ return isFunction;
+};
+
+
+/**
+ * invokesEval
+ *
+ * Returns true (nontrivial) if it finds any use of
+ * the eval function. For simplicity, we assume any
+ * use of an identifier "eval" is the eval function.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ */
+NonTrivialChecker.prototype.invokesEval = function (n) {
+ return (n.type === token.CALL &&
+ utils.nodeContains(n.children[0], token.IDENTIFIER, 'eval') ||
+ n.type === token.IDENTIFIER && n.value === 'eval');
+};
+
+/**
+ * evalIdentifier
+ *
+ * Returns true (nontrivial) if it finds any use of
+ * the eval function. For simplicity, we assume any
+ * use of an identifier "eval" is the eval function.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ */
+NonTrivialChecker.prototype.evalIdentifier = function (n) {
+ return n.type === token.IDENTIFIER && n.value === 'eval';
+};
+
+
+/**
+ * invokesMethodBracketSuffix
+ *
+ * Finds a method being invoked using the bracket suffix notation
+ * rather than the dot notation. It is difficult without keeping track of
+ * variable values to check for what method is actually being called.
+ * So we're just flagging any use of this construct as nontrivial.
+ * e.g., should catch: xhr[a+b]('GET', 'http://www.example.com');
+ * Should not catch other uses such as: myArray[num];
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ */
+NonTrivialChecker.prototype.invokesMethodBracketSuffix = function (n) {
+ return n.type === token.CALL && utils.isType(n.children[0], token.INDEX);
+};
+
+/**
+ * createsXhrObject
+ *
+ * Creates an xhr object.
+ * Since all "new XMLHttpRequest", "XMLHttpRequest()",
+ * and "new window.XMLHttpRequest" instantiate the xhr object,
+ * we assume (without further proof) that any use
+ * of the identifier "XMLHttpRequest" and "ActiveXObject"
+ * is an xhr object.
+ * Constructs like window[a+b]() are already caught by the
+ * bracket suffix check.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ */
+NonTrivialChecker.prototype.createsXhrObject = function (n) {
+ return (n.type === token.IDENTIFIER) &&
+ (n.value === 'XMLHttpRequest' ||
+ n.value === 'ActiveXObject');
+};
+
+/**
+ * invokesXhrOpen
+ *
+ * Here we assume the call of an open method must be an xhr request
+ * (and not some other object) by checking the number of arguments.
+ * In most cases this method won't be used since createsXhrObject
+ * will already have caught the xhr.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ *
+ */
+NonTrivialChecker.prototype.invokesXhrOpen = function (n) {
+ return n.type === token.CALL &&
+ utils.hasChildren(n, token.DOT, token.LIST) &&
+ utils.isType(n.children[0].children[0], token.IDENTIFIER) &&
+ utils.nodeContains(n.children[0].children[1], token.IDENTIFIER, 'open') &&
+ n.children[1].children.length > 1;
+};
+
+/**
+ * createsScriptElement
+ *
+ * Checks for document.createElement() that create a script. In the case
+ * it creates an element from a variable, we assume it's a script. In the
+ * future we might want to check for the value of that string variable
+ * (e.g., if a variable is assigned 'script', raise a flag)
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ *
+ *
+ */
+NonTrivialChecker.prototype.createsScriptElement = function (n) {
+ return n.type === token.CALL &&
+ utils.hasChildren(n, token.DOT, token.LIST) &&
+ utils.isType(n.children[0].children[0], token.IDENTIFIER) &&
+ utils.nodeContains(n.children[0].children[1], token.IDENTIFIER, 'createElement') &&
+ (utils.nodeContains(n.children[1].children[0], token.STRING, 'script') ||
+ utils.isType(n.children[1].children[0], token.IDENTIFIER));
+};
+
+/**
+ * writesScriptAsHtmlString
+ *
+ * catches myObj.write('<script></script>');
+ * or any myObj.write(myStringVariable);
+ * or concatenation such as:
+ * myObj.write('<scri' + stringVariable);
+ * or 'something' + 'somethingelse'.
+ *
+ * To check for javascript here we might want to look at the list
+ * from ha.ckers.org/xss.html for the future.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ *
+ */
+NonTrivialChecker.prototype.writesScriptAsHtmlString = function (n) {
+ var listArg;
+
+ if (n.type === token.CALL &&
+ utils.hasChildren(n, token.DOT, token.LIST) &&
+ utils.isType(n.children[0].children[0], token.IDENTIFIER) &&
+ utils.nodeContains(n.children[0].children[1], token.IDENTIFIER, 'write')
+ ) {
+ if (utils.isNotType(n.children[1].children[0], token.STRING)) {
+ // return true if any operation or concatenation.
+ // We are cautious (as it could
+ // embed a script) and flag this as nontrivial.
+
+ return true;
+ }
+ return utils.findScriptTag(n.children[1].children[0]);
+ } else {
+ return false;
+ }
+};
+
+/**
+ * nontrivial anytime we see an identifier as innerHTML
+ */
+NonTrivialChecker.prototype.innerHTMLIdentifier = function (n) {
+ if ((n.type === token.IDENTIFIER ||
+ n.type === token.STRING) &&
+ n.value === 'innerHTML'
+ ) {
+ return true;
+ }
+};
+
+/**
+ * checkNontrivial
+ *
+ * Contains all the conditionals that try to identify,
+ * step by step, all code that could be flagged as
+ * nontrivial.
+ *
+ * @param {object} n. The current node being studied.
+ * @return {boolean} . True if found.
+ *
+ */
+NonTrivialChecker.prototype.checkNontrivial = function (n, t) {
+
+ if (n.type === token.IDENTIFIER && this.evalIdentifier(n)) {
+ //console.log("NONTRIVIAL: eval has been found in code");
+ return types.nontrivialWithComment("NONTRIVIAL: eval has been found in code");
+ }
+
+ if (this.innerHTMLIdentifier(n)) {
+ //console.log("NONTRIVIAL: innerHTML identifier");
+ return types.nontrivialWithComment("NONTRIVIAL: innerHTML identifier");
+ }
+
+ // the node is an identifier
+ if (n.type === token.IDENTIFIER && this.createsXhrObject(n)) {
+ //console.log('NONTRIVIAL: Creates an xhr object');
+ return types.nontrivialWithComment('NONTRIVIAL: Creates an xhr object');
+ }
+
+ // this is a method/function call
+ if (n.type === token.CALL) {
+
+ if (this.invokesEval(n)) {
+ //console.log("NONTRIVIAL: eval has been found in code");
+ return types.nontrivialWithComment("NONTRIVIAL: eval has been found in code");
+ }
+
+ if (this.invokesMethodBracketSuffix(n)) {
+ //console.log('NONTRIVIAL: square bracket suffix method call detected');
+ return types.nontrivialWithComment("NONTRIVIAL: eval has been found in code");
+ }
+
+ if (this.invokesXhrOpen(n)) {
+ //console.log('NONTRIVIAL: an open method similar to xhr.open is used');
+ return types.nontrivialWithComment('NONTRIVIAL: square bracket suffix method call detected');
+ }
+
+ if (this.createsScriptElement(n)) {
+ //console.log('NONTRIVIAL: creates script element dynamically.');
+ return types.nontrivialWithComment('NONTRIVIAL: an open method similar to xhr.open is used');
+ }
+
+ if (this.writesScriptAsHtmlString(n)) {
+ //console.log('NONTRIVIAL: writes script as html dynamically.');
+ return types.nontrivialWithComment('NONTRIVIAL: creates script element dynamically.');
+ }
+ }
+
+ // The node is a function definition.
+ // Most common occurence.
+ if (this.definesFunctionFound(n)) {
+ return types.trivialFuncWithComment("Script is trivial but defines one or more functions");
+ }
+
+ // found nothing else, so trivial.
+ return types.trivialWithComment("Script is trivial");
+};
+
+exports.nonTrivialChecker = function () {
+ return new NonTrivialChecker();
+};
diff --git a/lib/js_checker/pattern_utils.js b/lib/js_checker/pattern_utils.js
new file mode 100644
index 0000000..00b0c26
--- /dev/null
+++ b/lib/js_checker/pattern_utils.js
@@ -0,0 +1,40 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+exports.patternUtils = {
+ /**
+ * removeNonalpha
+ *
+ * Remove all nonalphanumeric values, except for
+ * < and >, since they are what we use for tokens.
+ *
+ */
+ removeNonalpha: function (str) {
+ var regex = /[^a-z0-9<>@]+/gi;
+ return str.replace(regex, '');
+ },
+ removeWhitespace: function (str) {
+ return str.replace(/\s+/gmi, '');
+ },
+ replaceTokens: function (str) {
+ var regex = /<.*?>/gi;
+ return str.replace(regex, '.*?');
+ }
+};
diff --git a/lib/js_checker/privacy_checker.js b/lib/js_checker/privacy_checker.js
new file mode 100644
index 0000000..7b8917a
--- /dev/null
+++ b/lib/js_checker/privacy_checker.js
@@ -0,0 +1,44 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const privacyThreatJs = require('js_checker/privacy_threat_definitions.js');
+const patternUtils = require('js_checker/pattern_utils').patternUtils;
+
+exports.privacyCheck = {
+ checkScriptPrivacyThreat: function (currentScript) {
+ var list = privacyThreatJs.js;
+ var i;
+ var item;
+ var max;
+
+ currentScript = patternUtils.removeWhitespace(currentScript);
+
+ for (item in list) {
+ max = list[item].length;
+
+ for (i = 0; i < max; i++) {
+ if (list[item][i].test(currentScript)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+};
diff --git a/lib/js_checker/privacy_threat_definitions.js b/lib/js_checker/privacy_threat_definitions.js
new file mode 100644
index 0000000..66b073d
--- /dev/null
+++ b/lib/js_checker/privacy_threat_definitions.js
@@ -0,0 +1,52 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+exports.js = {
+ /**
+ * googleAnalytics
+ * Tracking code for Google Analytics.
+ * It corresponds to:
+ * var _gaq = _gaq || [];
+ * _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
+ * _gaq.push(['_trackPageview']);
+ *
+ * (function() {
+ * var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ * ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ * var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ * })();
+ *
+ * It also matches GA code that doesn't track a page view, like this:
+ * var _gaq = _gaq || [];
+ * _gaq.push(['_setAccount', 'UA-5936383-6']);
+ *
+ * (function() {
+ * var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ * ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ * var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ * })();
+ *
+ */
+ googleAnalytics: [
+ /var_gaq=_gaq\|\|\[\];_gaq\.push\(\['_setAccount','UA[0-9\-]*?'\]\);(_gaq.push\(\['_setDomainName','[a-z\.]*?'\]\);)?(_gaq\.push\(\['_trackPageview'\]\);)?\(function\(\){varga=document\.createElement\('script'\);ga\.type='text\/javascript\';ga\.async=true;ga\.src=\(\'https:\'==document\.location\.protocol\?'https:\/\/ssl':'http:\/\/www'\)\+'\.google\-analytics\.com\/ga\.js';vars=document\.getElementsByTagName\('script'\)\[0\];s\.parentNode\.insertBefore\(ga,s\);}\)\(\);/i,
+ /vargaJsHost\=\(\(\"https\:\"\=\=document\.location\.protocol\)\?\"https\:\/\/ssl\.\"\:\"http\:\/\/www\.\"\)\;document\.write\(unescape\(\"\%3Cscriptsrc\=\'\"\+gaJsHost\+\"google\-analytics\.com\/ga\.js\'type\=\'text\/javascript\'\%3E\%3C\/script\%3E\"\)\)\;/i,
+ /try{varpageTracker\=\_gat\.\_getTracker\(\"UA[0-9\-]*?\"\)\;pageTracker\.\_trackPageview\(\)\;}catch\(err\){}/i
+ ]
+};
diff --git a/lib/js_checker/relation_checker.js b/lib/js_checker/relation_checker.js
new file mode 100644
index 0000000..1904812
--- /dev/null
+++ b/lib/js_checker/relation_checker.js
@@ -0,0 +1,289 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+/**
+ * relation_checker.js
+ *
+ * Finds out if two scripts are related to each other.
+ *
+ */
+const types = require("js_checker/constant_types");
+
+const token = types.token;
+
+// all predefined window properties (methods and variables).
+const windowPropertiesHash = {
+ "addEventListener": 1, "alert": 1, "applicationCache": 1,
+ "Array": 1, "ArrayBuffer": 1, "atob": 1, "back": 1, "blur": 1,
+ "Boolean": 1, "btoa": 1, "captureEvents": 1, "CharacterData": 1,
+ "clearInterval": 1, "clearTimeout": 1, "close": 1, "closed": 1,
+ "Components": 1, "confirm": 1, "console": 1, "constructor": 1,
+ "content": 1, "controllers": 1, "crypto": 1,
+ "CSSStyleDeclaration": 1, "Date": 1, "decodeURI": 1,
+ "decodeURIComponent": 1, "defaultStatus": 1,
+ "disableExternalCapture": 1, "dispatchEvent": 1, "Document": 1,
+ "document": 1, "DocumentType": 1, "dump": 1, "Element": 1,
+ "enableExternalCapture": 1, "encodeURI": 1, "encodeURIComponent": 1,
+ "Error": 1, "escape": 1, "eval": 1, "EvalError": 1, "Event": 1,
+ "find": 1, "Float32Array": 1, "Float64Array": 1, "focus": 1,
+ "forward": 1, "frameElement": 1, "frames": 1, "fullScreen": 1,
+ "Function": 1, "Generator": 1, "getComputedStyle": 1,
+ "getInterface": 1, "getSelection": 1, "globalStorage": 1,
+ "history": 1, "home": 1, "HTMLBodyElement": 1, "HTMLCollection": 1,
+ "HTMLDivElement": 1, "HTMLDocument": 1, "HTMLElement": 1,
+ "HTMLHeadElement": 1, "HTMLHeadingElement": 1, "HTMLHtmlElement": 1,
+ "HTMLStyleElement": 1, "HTMLUnknownElement": 1, "Infinity": 1,
+ "innerHeight": 1, "innerWidth": 1, "InstallTrigger": 1,
+ "Int16Array": 1, "Int32Array": 1, "Int8Array": 1, "InternalError": 1,
+ "isFinite": 1, "isNaN": 1, "isXMLName": 1, "Iterator": 1,
+ "JSON": 1, "length": 1, "localStorage": 1, "Location": 1,
+ "location": 1, "locationbar": 1, "matchMedia": 1, "Math": 1,
+ "menubar": 1, "moveBy": 1, "moveTo": 1, "mozAnimationStartTime": 1,
+ "mozIndexedDB": 1, "mozInnerScreenX": 1, "mozInnerScreenY": 1,
+ "mozPaintCount": 1, "mozRequestAnimationFrame": 1, "name": 1,
+ "Namespace": 1, "NaN": 1, "navigator": 1, "netscape": 1,
+ "Node": 1, "NodeList": 1, "Number": 1, "Object": 1, "open": 1,
+ "openDialog": 1, "opener": 1, "outerHeight": 1, "outerWidth": 1,
+ "pageXOffset": 1, "pageYOffset": 1, "parent": 1, "parseFloat": 1,
+ "parseInt": 1, "performance": 1, "personalbar": 1, "pkcs11": 1,
+ "postMessage": 1, "print": 1, "prompt": 1, "QName": 1,
+ "RangeError": 1, "ReferenceError": 1, "RegExp": 1,
+ "releaseEvents": 1, "removeEventListener": 1, "resizeBy": 1,
+ "resizeTo": 1, "routeEvent": 1, "screen": 1, "screenX": 1,
+ "screenY": 1, "scroll": 1, "scrollbars": 1, "scrollBy": 1,
+ "scrollByLines": 1, "scrollByPages": 1, "scrollMaxX": 1,
+ "scrollMaxY": 1, "scrollTo": 1, "scrollX": 1, "scrollY": 1,
+ "self": 1, "sessionStorage": 1, "setInterval": 1, "setResizable": 1,
+ "setTimeout": 1, "showModalDialog": 1, "sizeToContent": 1,
+ "status": 1, "statusbar": 1, "stop": 1, "StopIteration": 1,
+ "StorageList": 1, "String": 1, "SyntaxError": 1, "Text": 1,
+ "toolbar": 1, "top": 1, "TypeError": 1, "Uint16Array": 1,
+ "Uint32Array": 1, "Uint8Array": 1, "Uint8ClampedArray": 1,
+ "undefined": 1, "unescape": 1, "uneval": 1, "updateCommands": 1,
+ "URIError": 1, "URL": 1, "WeakMap": 1, "Window": 1, "window": 1,
+ "XML": 1, "XMLList": 1, "XPCNativeWrapper": 1};
+
+// all predefined document properties.
+const documentPropertiesHash = {'activeElement': 1, 'addBinding': 1,
+ 'addEventListener': 1, 'adoptNode': 1, 'alinkColor': 1, 'anchors': 1,
+ 'appendChild': 1, 'applets': 1, 'ATTRIBUTE_NODE': 1, 'attributes': 1,
+ 'baseURI': 1, 'bgColor': 1, 'body': 1, 'captureEvents': 1,
+ 'CDATA_SECTION_NODE': 1, 'characterSet': 1, 'childNodes': 1, 'clear':
+ 1, 'cloneNode': 1, 'close': 1, 'COMMENT_NODE': 1,
+ 'compareDocumentPosition': 1, 'compatMode': 1, 'contentType': 1,
+ 'cookie': 1, 'createAttribute': 1, 'createAttributeNS': 1,
+ 'createCDATASection': 1, 'createComment': 1, 'createDocumentFragment':
+ 1, 'createElement': 1, 'createElementNS': 1, 'createEvent': 1,
+ 'createExpression': 1, 'createNodeIterator': 1, 'createNSResolver': 1,
+ 'createProcessingInstruction': 1, 'createRange': 1, 'createTextNode':
+ 1, 'createTreeWalker': 1, 'currentScript': 1, 'defaultView': 1,
+ 'designMode': 1, 'dir': 1, 'dispatchEvent': 1, 'doctype': 1,
+ 'DOCUMENT_FRAGMENT_NODE': 1, 'DOCUMENT_NODE': 1,
+ 'DOCUMENT_POSITION_CONTAINED_BY': 1, 'DOCUMENT_POSITION_CONTAINS': 1,
+ 'DOCUMENT_POSITION_DISCONNECTED': 1, 'DOCUMENT_POSITION_FOLLOWING': 1,
+ 'DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC': 1,
+ 'DOCUMENT_POSITION_PRECEDING': 1, 'DOCUMENT_TYPE_NODE': 1,
+ 'documentElement': 1, 'documentURI': 1, 'domain': 1, 'ELEMENT_NODE':
+ 1, 'elementFromPoint': 1, 'embeds': 1, 'enableStyleSheetsForSet': 1,
+ 'ENTITY_NODE': 1, 'ENTITY_REFERENCE_NODE': 1, 'evaluate': 1,
+ 'execCommand': 1, 'execCommandShowHelp': 1, 'fgColor': 1,
+ 'firstChild': 1, 'forms': 1, 'getAnonymousElementByAttribute': 1,
+ 'getAnonymousNodes': 1, 'getBindingParent': 1, 'getElementById': 1,
+ 'getElementsByClassName': 1, 'getElementsByName': 1,
+ 'getElementsByTagName': 1, 'getElementsByTagNameNS': 1,
+ 'getSelection': 1, 'getUserData': 1, 'hasAttributes': 1,
+ 'hasChildNodes': 1, 'hasFocus': 1, 'head': 1, 'images': 1,
+ 'implementation': 1, 'importNode': 1, 'inputEncoding': 1,
+ 'insertBefore': 1, 'isDefaultNamespace': 1, 'isEqualNode': 1,
+ 'isSameNode': 1, 'isSupported': 1, 'lastChild': 1, 'lastModified': 1,
+ 'lastStyleSheetSet': 1, 'linkColor': 1, 'links': 1,
+ 'loadBindingDocument': 1, 'localName': 1, 'location': 1,
+ 'lookupNamespaceURI': 1, 'lookupPrefix': 1, 'mozSetImageElement': 1,
+ 'mozSyntheticDocument': 1, 'namespaceURI': 1, 'nextSibling': 1,
+ 'nodeName': 1, 'nodeType': 1, 'nodeValue': 1, 'normalize': 1,
+ 'NOTATION_NODE': 1, 'open': 1, 'ownerDocument': 1, 'parentNode': 1,
+ 'plugins': 1, 'preferredStyleSheetSet': 1, 'prefix': 1,
+ 'previousSibling': 1, 'PROCESSING_INSTRUCTION_NODE': 1,
+ 'queryCommandEnabled': 1, 'queryCommandIndeterm': 1,
+ 'queryCommandState': 1, 'queryCommandSupported': 1,
+ 'queryCommandText': 1, 'queryCommandValue': 1, 'querySelector': 1,
+ 'querySelectorAll': 1, 'readyState': 1, 'referrer': 1,
+ 'releaseCapture': 1, 'releaseEvents': 1, 'removeBinding': 1,
+ 'removeChild': 1, 'removeEventListener': 1, 'replaceChild': 1,
+ 'routeEvent': 1, 'selectedStyleSheetSet': 1, 'setUserData': 1,
+ 'styleSheets': 1, 'styleSheetSets': 1, 'TEXT_NODE': 1, 'textContent':
+ 1, 'title': 1, 'URL': 1, 'vlinkColor': 1, 'write': 1, 'writeln': 1,
+ 'xmlEncoding': 1, 'xmlStandalone': 1, 'xmlVersion': 1};
+
+var relationChecker = {
+
+ // identifies scripts across modules.
+ scriptId: null,
+
+ // stores all left-side identifier in 'assign' types.
+ assignments: null,
+
+ // stores var declarations in global scope.
+ variableDeclarations: null,
+
+ // stores top declarations in global scope.
+ functionDeclarations: null,
+
+ nonWindowProperties: null,
+
+ init: function (scriptId) {
+ this.scriptId = scriptId;
+ this.assignments = [];
+ this.variableDeclarations = {};
+ this.functionDeclarations = {};
+ this.nonWindowProperties = {};
+ },
+
+ isWindowProperty: function (identifier) {
+ return (identifier in windowPropertiesHash) ? true : false;
+ },
+
+ isDocumentProperty: function (identifier) {
+ return (identifier in documentPropertiesHash) ? true : false;
+ },
+
+ storeNodeVars: function (n) {
+ if (n.varDecls != undefined) {
+ var i = 0, le = n.varDecls.length;
+ for (; i < le; i++) {
+ this.variableDeclarations[n.varDecls[i].value] = 1;
+ }
+ }
+ },
+
+ storeNodeFunctions: function (n) {
+ if (n.funDecls != undefined) {
+ var i = 0, le = n.funDecls.length;
+ for (; i < le; i++) {
+ this.functionDeclarations[n.funDecls[i].name] = 1;
+ }
+ }
+ },
+ storeGlobalDeclarations: function (topNode) {
+ this.storeNodeVars(topNode);
+ this.storeNodeFunctions(topNode);
+ },
+ storeNodeGlobalDeclarations: function (n) {
+ if (n.global === true) {
+ this.storeNodeVars(n);
+ this.storeNodeFunctions(n);
+ }
+ },
+
+ storeNodeAssignments: function (n) {
+ if (n.type === token.ASSIGN &&
+ n.children != undefined &&
+ n.children[0].type === token.IDENTIFIER) {
+ this.assignments.push(n.children[0].value);
+ }
+ },
+
+ // checks the parent script is in global scope.
+ isInGlobalScope: function (n) {
+ var currentNode = n;
+
+ while (currentNode != undefined) {
+ if (currentNode.type === token.SCRIPT &&
+ currentNode.global === true) {
+ return true;
+ } else if (currentNode.type === token.SCRIPT) {
+ return false;
+ }
+ currentNode = currentNode.parent;
+ }
+ },
+
+ // looks for an identifier being declared as either a
+ // variable or a function within the scope. Currently,
+ // we don't care about assignments.
+ lookForIdentifierInAllScopes: function (n, val) {
+
+ var currentNode = n, i, le, vars, funcs;
+ while (currentNode != undefined) {
+ if (currentNode.varDecls != undefined) {
+ vars = currentNode.varDecls;
+ le = vars.length;
+ for (i = 0; i < le; i++) {
+ if (vars[i].value === val) {
+ console.debug('FOUND declaration for', val);
+ return true;
+ }
+ }
+ }
+ if (currentNode.funDecls != undefined) {
+ funcs = currentNode.funDecls;
+ le = funcs.length;
+ for (i = 0; i < le; i++) {
+ if (funcs[i].name === val) {
+ console.debug('FOUND function declaration for', val);
+ return true;
+ }
+ }
+ }
+ currentNode = currentNode.parent;
+ }
+ console.debug('did not find declaration or assignment for', val);
+ },
+
+ // Heuristic method for window properties.
+ // this doesn't prove they are window properties, but
+ // it allows to make a good guess. These variables could have
+ // been assigned to something else...
+ checkIdentifierIsWindowProperty: function (n) {
+
+ if (n.type === token.IDENTIFIER &&
+ (n.parent.type === token.CALL ||
+ (n.parent.type === token.DOT &&
+ n.previous != undefined &&
+ (n.previous.type === token.THIS ||
+ (n.previous.type === token.IDENTIFIER &&
+ n.previous.value === 'window')))) &&
+ n.value in windowPropertiesHash) {
+
+ this.lookForIdentifierInAllScopes(n, n.value);
+
+ }
+
+ else if (n.type === token.IDENTIFIER &&
+ n.parent != undefined &&
+ n.parent.type === token.DOT &&
+ n.previous != undefined &&
+ n.previous.type === token.THIS &&
+ this.isInGlobalScope(n)) {
+ console.debug(n.type, 'use of this in the global scope, seems ok.', n.value);
+ }
+ else if (n.type === token.IDENTIFIER) {
+ // not found.
+ console.debug(n.type, 'probably not a window prop', n.value);
+ this.nonWindowProperties[n.value] = 1;
+ }
+ }
+
+};
+
+exports.relationChecker = function (scriptId) {
+ var obj = Object.create(relationChecker);
+ obj.init(scriptId);
+ return obj;
+};
diff --git a/lib/js_load_observer/js_load_observer.js b/lib/js_load_observer/js_load_observer.js
new file mode 100644
index 0000000..a8792e2
--- /dev/null
+++ b/lib/js_load_observer/js_load_observer.js
@@ -0,0 +1,143 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+var observerService = Cc["@mozilla.org/observer-service;1"]
+.getService(Ci.nsIObserverService);
+
+var acceptedScripts = require("script_entries/accepted_scripts").acceptedScripts;
+var allowedRef = require('http_observer/allowed_referrers').allowedReferrers;
+
+var urlHandler = require("url_handler/url_handler");
+
+var ScriptAnalyzer = function() {
+ // the URL of the current page.
+ this.pageURL = null;
+};
+
+/*
+ * analyzeScriptBeforeExec
+ *
+ * Ensure that the script is found in the acceptedScript before
+ * allowing to execute it.
+ *
+ */
+ScriptAnalyzer.prototype.analyzeScriptBeforeExec = function (e) {
+ if (typeof e.target.textContent === 'undefined') {
+ throw new TypeError('event.target must be a script element');
+ }
+ console.debug('analyzeScriptBeforeExec executed');
+
+ var script = e.target, isAccepted;
+ var text = script.src ?
+ script.src : script.textContent.substring(0,100);
+ var notif = require("ui/notification")
+ .createNotification(text).notification;
+ this.pageURL = urlHandler.removeFragment(script.ownerDocument.URL);
+ if (!allowedRef.urlInAllowedReferrers(this.pageURL)) {
+
+ if (script.src !== undefined && script.src !== '') {
+ isAccepted = this.checkExternalScript(script);
+ } else {
+ isAccepted = this.checkInlineScript(script);
+ }
+
+ if (isAccepted === false &&
+ !(/^(file:\/\/|chrome:\/\/|about\:)/.test(this.pageURL))
+ ) {
+ console.debug(this.pageURL);
+ // file:// types of pages are allowed.
+
+ // set invalid type so that the script is detected
+ // by LibreJS as blocked (although it's blocked using
+ // preventDefault().
+ script.setAttribute('type', 'librejs/blocked');
+ //script.setAttribute('data-librejs-blocked', 'dynamically');
+ script.setAttribute('data-librejs-blocked-src', script.src);
+ script.removeAttribute('src');
+
+ e.preventDefault();
+ return false;
+ } else {
+ console.debug("script is accepted", script.src);
+ script.setAttribute('data-librejs-accepted', 'dynamically');
+ return true;
+ }
+
+ } else {
+ return true;
+ }
+
+ return false;
+};
+
+ScriptAnalyzer.prototype.checkExternalScript = function (script) {
+ var url = urlHandler.resolve(this.pageURL, script.src);
+
+ if (this.isScriptAccepted(url, false)) {
+ // url in src attribute is found as accepted.
+ return true;
+ }
+
+ else {
+ // the script hasn't been accepted before.
+ // block it.
+ console.debug("script is not accepted", script.src);
+ return false;
+ }
+
+};
+
+ScriptAnalyzer.prototype.checkInlineScript = function (script) {
+ return this.isScriptAccepted(script.text, true);
+};
+
+ScriptAnalyzer.prototype.isScriptAccepted = function (contents, inline) {
+
+ if (!acceptedScripts.isFound(this.pageURL, {'inline': inline, 'contents': contents})) {
+ return false;
+ }
+
+ else {
+ return true;
+ }
+};
+
+var scriptAnalyzer = new ScriptAnalyzer();
+
+var jsLoadObserver = {
+ observe: function (domWindow) {
+ domWindow.document.addEventListener(
+ "beforescriptexecute",
+ scriptAnalyzer.analyzeScriptBeforeExec.bind(scriptAnalyzer),
+ false);
+ }
+};
+
+observerService.addObserver(jsLoadObserver,
+ 'content-document-global-created',
+ false);
+
+exports.removeJsLoadObserver = function () {
+ observerService.removeObserver(jsLoadObserver,
+ 'content-document-global-created');
+ console.debug('removing jsLoadObserver');
+};
diff --git a/lib/main.js b/lib/main.js
new file mode 100644
index 0000000..d042eb5
--- /dev/null
+++ b/lib/main.js
@@ -0,0 +1,70 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// Uncomment the following to start debugging, or do it from about:config.
+// var name = "extensions.jid1-KtlZuoiikVfFew@jetpack.sdk.console.logLevel";
+// require("sdk/preferences/service").set(name, "all");
+
+const { Cc, Ci } = require("chrome");
+
+const librejsStorage = require("settings/storage").librejsStorage;
+let addonManage = require("addon_management/install_uninstall");
+let httpObserver = require("http_observer/http_request_observer");
+let prefObserver = require("pref_observer/pref_observer");
+let prefChange = require("addon_management/prefchange");
+let uiInfo = require("ui/ui_info");
+let scriptPanel = require("ui/script_panel.js");
+const removeHashCallback = require("js_checker/js_checker").removeHashCallback;
+
+require('ui');
+
+// set whitelist at startup.
+prefChange.init();
+var widgetIsOn = false;
+
+// read storage file.
+var cachedResult = librejsStorage.init();
+librejsStorage.generateCacheFromDB();
+
+exports.main = function(options, callbacks) {
+ if (options.loadReason === 'enable' ||
+ options.loadReason === 'install'
+ ) {
+ addonManage.onLoad();
+ }
+};
+
+exports.onUnload = addonManage.onUnload;
+exports.onLoad = addonManage.onLoad;
+
+var prefs = require('sdk/preferences/service');
+var isJavaScriptEnabled = prefs.get('javascript.enabled');
+if (!isJavaScriptEnabled) {
+ console.debug('JS disabled in add-on init');
+ // remove all http notifications
+ httpObserver.removeHttpObserver();
+ // TODO: the narcissus worker could also be stopped at this
+ // point, but I'm not doing that right now because I don't
+ // know how to re-enable it.
+ //narcissusWorker.stopWorker();
+} else {
+ console.debug('JS enabled in add-on init');
+}
+prefObserver.register();
diff --git a/lib/parser/narcissus_worker.js b/lib/parser/narcissus_worker.js
new file mode 100644
index 0000000..57f9920
--- /dev/null
+++ b/lib/parser/narcissus_worker.js
@@ -0,0 +1,79 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var data = require("sdk/self").data;
+var {Cu} = require("chrome");
+var {ChromeWorker} = Cu.import("resource://gre/modules/Services.jsm", null);
+var worker = new ChromeWorker(
+ data.url("chrome_worker/parser/parse.js"));
+
+var NarcissusWorker = function() {
+ this.worker = worker;
+ var that = this;
+
+ this.worker.onmessage = function(e) {
+ var jsChecker = require("js_checker/js_checker");
+
+ console.debug('onmessage', e.data.hash);
+ try {
+ console.debug('calling jsChecker.callbackHashResult() for hash:',
+ e.data.hash);
+ jsChecker.callbackHashResult(e.data.hash, e.data.tree);
+ } catch (x) {
+ console.debug('error on message', x);
+ jsChecker.callbackHashResult(e.data.hash, false);
+ }
+ jsChecker = null;
+ };
+
+ // Enabling the catch clause in data/chrome_worker/parser
+ // instead of here because we can get the hash from there.
+ /*this.worker.onerror = function (e) {
+ console.debug(
+ 'error', e.lineno,
+ 'in', e.filename,
+ 'e', e.message,
+ 'full message', e
+ );
+ // can't get hash from this context
+ that.worker.postMessage(JSON.stringify({'hash': null}));
+ };*/
+};
+
+NarcissusWorker.prototype.stopWorker = function() {
+ console.debug('stopping worker');
+ this.worker.postMessage('stop');
+};
+
+NarcissusWorker.prototype.parse = function(scriptText, hash) {
+ console.debug('parsing', hash);
+ try {
+ this.worker.postMessage(JSON.stringify({
+ 'code': scriptText,
+ 'hash': hash
+ }));
+ } catch (x) {
+ console.debug('error in lib/narcissus_worker.js', x, x.lineNumber);
+ }
+
+};
+
+var narcissusWorker = new NarcissusWorker();
+exports.narcissusWorker = narcissusWorker;
diff --git a/lib/pref_observer/pref_observer.js b/lib/pref_observer/pref_observer.js
new file mode 100644
index 0000000..60afb82
--- /dev/null
+++ b/lib/pref_observer/pref_observer.js
@@ -0,0 +1,71 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var {Cc, Ci} = require("chrome");
+const httpObserver = require("http_observer/http_request_observer");
+
+// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Preferences#Using_preference_observers
+var prefObserver = {
+ register: function() {
+ // First we'll need the preference services to look for preferences.
+ var prefService = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefService);
+
+ // For this.branch we ask for the preferences for
+ // extensions.myextension. and children
+ this.branch = prefService.getBranch("javascript.");
+
+ // Finally add the observer.
+ this.branch.addObserver("", this, false);
+ },
+
+ unregister: function() {
+ this.branch.removeObserver("", this);
+ },
+
+ observe: function(aSubject, aTopic, aData) {
+ // aSubject is the nsIPrefBranch we're observing (after appropriate QI)
+ // aData is the name of the pref that's been changed (relative to
+ // aSubject)
+ switch (aData) {
+ case "enabled":
+ var prefs = require('sdk/preferences/service');
+ var isJavaScriptEnabled = prefs.get('javascript.enabled');
+ if (!isJavaScriptEnabled) {
+ console.debug('JS disabled in observer');
+ // remove all http notifications
+ httpObserver.removeHttpObserver();
+
+ // TODO: the narcissus worker could also be stopped at this
+ // point, but I'm not doing that right now because I don't
+ // know how to re-enable it.
+ // narcissusWorker.stopWorker();
+ } else {
+ console.debug('JS enabled in observer');
+ httpObserver.startHttpObserver();
+ }
+ break;
+ }
+ }
+};
+
+exports.register = function() {
+ prefObserver.register();
+};
diff --git a/lib/preferences/preferences.js b/lib/preferences/preferences.js
new file mode 100644
index 0000000..2685484
--- /dev/null
+++ b/lib/preferences/preferences.js
@@ -0,0 +1,72 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+var data = require("sdk/self").data;
+var panel = require("sdk/panel");
+var simpleStorage = require("sdk/simple-storage");
+
+/*
+ *Create pref panel
+ */
+exports.prefpanel = panel.Panel({
+ contentURL: data.url("preferences_panel/preferences_panel.html"),
+ contentScriptFile: data.url("preferences_panel/contentscript.js"),
+ contentScriptWhen: "ready",
+ widht:400,
+ height:400,
+ onMessage: function(message) {
+ handlePrefPanelMessage(message);
+ },
+ onShow: function() {
+ getAllPrefPanelPrefs();
+ }
+});
+
+var prefpanel = exports.prefpanel;
+
+function handlePrefPanelMessage(message) {
+ var prefSplit = message.split(":");
+ if(prefSplit[0] == "SETPREF") {
+ simpleStorage.storage[prefSplit[1]] = prefSplit[2];
+ } else {
+ console.debug(message);
+ }
+}
+
+function getAllPrefPanelPrefs() {
+ var allprefnames = ['INCOMING PREFS', 'nolazy'];
+
+ var allprefvalues = [];
+
+ allprefvalues[0] = "INCOMINGPREFS";
+
+ for(var i = 1; i < allprefnames.length+1; i++) {
+ var pref = simpleStorage.storage[allprefnames[i]];
+
+ if(typeof(pref) == 'undefined') {
+ // If it doesn't exist yet, default to false and set it for the future
+ simpleStorage.storage[allprefnames[i]] = "false";
+ pref = "false";
+ }
+
+ allprefvalues[i] = allprefnames[i] + ":" + pref;
+ }
+
+ prefpanel.postMessage(allprefvalues);
+}
diff --git a/lib/script_entries/accepted_scripts.js b/lib/script_entries/accepted_scripts.js
new file mode 100644
index 0000000..1a8ac9a
--- /dev/null
+++ b/lib/script_entries/accepted_scripts.js
@@ -0,0 +1,67 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var allScripts = require('script_entries/all_scripts').allScripts;
+
+var AcceptedScripts = function() {
+ this.scripts = {};
+ this.truncateJsData = allScripts.truncateJsData;
+ this.getScripts = allScripts.getScripts;
+ this.isFound = allScripts.isFound;
+ this.returnWhenFound = allScripts.returnWhenFound;
+ this.getOrInitScripts = allScripts.getOrInitScripts;
+ this.setHash = allScripts.setHash;
+};
+
+AcceptedScripts.prototype.clearScripts = function (url) {
+ this.scripts[url] = [];
+};
+
+/**
+ * addAScript
+ * adds a single script to the scripts array.
+ * @param {string} url - the url of the page where it is loaded.
+ * @param {object} scriptObj - Additional data regarding this script,
+ * including: inline: boolean,
+ * contents: string,
+ * removalReason: string.
+ */
+AcceptedScripts.prototype.addAScript = function (url, scriptObj) {
+ var exists;
+
+ if (this.scripts[url] === undefined) {
+ this.clearScripts(url);
+ }
+
+ // check if content is actually js code.
+ if (scriptObj.inline === true) {
+ this.setHash(scriptObj);
+ this.truncateJsData(scriptObj);
+ }
+ exists = this.isFound(url, scriptObj);
+ if (!exists) {
+ this.scripts[url].push(scriptObj);
+ return true;
+ } else {
+ return false;
+ }
+};
+
+exports.acceptedScripts = new AcceptedScripts();
diff --git a/lib/script_entries/all_scripts.js b/lib/script_entries/all_scripts.js
new file mode 100644
index 0000000..c08b4ac
--- /dev/null
+++ b/lib/script_entries/all_scripts.js
@@ -0,0 +1,108 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var crypto = require('script_entries/crypto');
+
+var AllScripts = function() {
+ this.scripts = {};
+};
+
+AllScripts.prototype.truncateJsData = function (scriptObj) {
+ if (scriptObj.contents === undefined) {
+ console.debug('this is an inline script', scriptObj.value);
+ console.debug('this is an src', scriptObj.url);
+ }
+ if (scriptObj.contents.length > 1000) {
+ scriptObj.contents = scriptObj.contents.substring(0, 1000);
+ scriptObj.contents += '…';
+ }
+};
+
+AllScripts.prototype.setHash = function (scriptObj) {
+ scriptObj.hash = crypto.sha1Encrypt(scriptObj.contents);
+ return scriptObj.hash;
+};
+
+AllScripts.prototype.getScripts = function (url) {
+ if (!this.scripts[url]) {
+ return false;
+ } else {
+ return this.scripts[url];
+ }
+};
+
+AllScripts.prototype.reverseArray = function (url) {
+ this.scripts[url].reverse();
+};
+
+AllScripts.prototype.getOrInitScripts = function (url) {
+ if (this.scripts[url] === undefined) {
+ this.scripts[url] = [];
+ }
+ return this.scripts[url];
+};
+
+AllScripts.prototype.returnWhenFound = function(url, data) {
+ var pageScripts = this.getOrInitScripts(url),
+ i = 0,
+ le = pageScripts.length;
+
+ // check that entry doesn't exist.
+ if (data.inline === false) {
+ for (; i < le; i++) {
+ if (pageScripts[i].contents === data.url) {
+ return pageScripts[i];
+ }
+ }
+ } else if (data.inline === true) {
+ for (; i < le; i++) {
+ if (pageScripts[i].hash === crypto.sha1Encrypt(data.contents)) {
+ return pageScripts[i];
+ }
+ }
+ }
+
+ return false;
+};
+
+AllScripts.prototype.isFound = function(url, data) {
+ var pageScripts = this.getOrInitScripts(url),
+ i = 0,
+ le = pageScripts.length;
+
+ // check that entry doesn't exist.
+ if (data.inline === false) {
+ for (; i < le; i++) {
+ if (pageScripts[i].url === data.url) {
+ return true;
+ }
+ }
+ } else if (data.inline === true) {
+ for (; i < le; i++) {
+ if (pageScripts[i].hash === crypto.sha1Encrypt(data.contents)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+};
+
+exports.allScripts = new AllScripts();
diff --git a/lib/script_entries/crypto.js b/lib/script_entries/crypto.js
new file mode 100644
index 0000000..e8844b1
--- /dev/null
+++ b/lib/script_entries/crypto.js
@@ -0,0 +1,60 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+var CryptoString = function() {
+ this.cryptoHash = Cc["@mozilla.org/security/hash;1"]
+ .createInstance(Ci.nsICryptoHash);
+ this.converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
+ createInstance(Ci.nsIScriptableUnicodeConverter);
+ this.hashAlgorithm = null;
+};
+
+CryptoString.prototype.init = function(hashAlgorithm, charset) {
+ this.converter.charset = charset;
+ this.hashAlgorithm = hashAlgorithm;
+ this.cryptoHash.init(this.cryptoHash[this.hashAlgorithm]);
+
+};
+
+CryptoString.prototype.encryptString = function(str) {
+ var result = {};
+ var data = this.converter.convertToByteArray(str, result);
+ this.cryptoHash.update(data, data.length);
+ var hash = this.cryptoHash.finish(false);
+ return [this.toHexString(hash.charCodeAt(i)) for (i in hash)].join("");
+};
+
+CryptoString.prototype.toHexString = function(charCode) {
+ return ("0" + charCode.toString(16)).slice(-2);
+};
+
+var cryptoString = new CryptoString();
+
+exports.sha1Encrypt = function(str) {
+ cryptoString.init('SHA1', 'UTF-8');
+ return cryptoString.encryptString(str);
+};
+
+exports.sha256Encrypt = function(str) {
+ cryptoString.init('SHA256', 'UTF-8');
+ return cryptoString.encryptString(str);
+};
diff --git a/lib/script_entries/dryrun_scripts.js b/lib/script_entries/dryrun_scripts.js
new file mode 100644
index 0000000..d32263b
--- /dev/null
+++ b/lib/script_entries/dryrun_scripts.js
@@ -0,0 +1,76 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var allScripts = require('script_entries/all_scripts').allScripts;
+const urlHandler = require('url_handler/url_handler');
+
+exports.dryRunScripts = {
+ scripts: {},
+
+ truncateJsData: allScripts.truncateJsData,
+
+ getScripts: allScripts.getScripts,
+
+ isFound: allScripts.isFound,
+
+ returnWhenFound: allScripts.returnWhenFound,
+
+ getOrInitScripts: allScripts.getOrInitScripts,
+
+ reverseArray: allScripts.reverseArray,
+
+ setHash: allScripts.setHash,
+
+ clearScripts: function (url) {
+ this.scripts[url] = [];
+ },
+
+ /**
+ * addAScript
+ * adds a single script to the scripts array.
+ * @param {string} url - the url of the page where it is loaded.
+ * @param {object} scriptObj - Additional data regarding this script,
+ * including: inline: boolean,
+ * contents: string,
+ * removalReason: string.
+ */
+ addAScript: function (url, scriptObj, absoluteUrl) {
+ var exists;
+
+ if (this.scripts[url] === undefined) {
+ this.clearScripts(url);
+ }
+ if (scriptObj.inline === true) {
+ this.setHash(scriptObj);
+ this.truncateJsData(scriptObj);
+ } else if (absoluteUrl !== undefined &&
+ scriptObj.inline === false) {
+ scriptObj.contents = urlHandler.resolve(absoluteUrl, scriptObj.contents);
+ }
+ exists = this.isFound(url, scriptObj);
+
+ if (!exists) {
+ this.scripts[url].push(scriptObj);
+ return true;
+ } else {
+ return false;
+ }
+ }
+};
diff --git a/lib/script_entries/free_libraries.js b/lib/script_entries/free_libraries.js
new file mode 100644
index 0000000..ee97eea
--- /dev/null
+++ b/lib/script_entries/free_libraries.js
@@ -0,0 +1,65 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// THIS MODULE IS DEPRECATED IN FAVOR OF THE NEW WHITELISTING MODULE (LibreJS 6.0)
+
+var relationChecker = require("js_checker/relation_checker").relationChecker;
+var checkTypes = require("js_checker/constant_types").checkTypes;
+var scriptsCached = require("./scripts_cache").scriptsCached;
+
+
+// find the json database path.
+var dbContents = require("sdk/self").data.load("script_libraries/script-libraries.json");
+
+const AUTHOR_REASON = "This script has been tagged as free software by LibreJS authors.";
+
+var freeLibraries = JSON.parse(dbContents); /* a database of the free libraries recognized by default */
+
+/*
+ * List of free libraries and their SHA256 hash.
+ * This is used to recognize the most common free libraries.
+ */
+
+var init = function () {
+
+ // relationChecker, which roughly checks if variables are window
+ // variables or not, is useless in this case. Use the same
+ // object for all entries.
+ var rc = relationChecker();
+ var library, hash;
+ var freeObj = { "type": 4, "reason": AUTHOR_REASON};
+ console.debug("Building init");
+ for (hash in freeLibraries) {
+ library = freeLibraries[hash];
+
+ // assign empty relationChecker object.
+ library.relationChecker = rc;
+
+ // make them free and nontrivial.
+ library.result = freeObj;
+
+ scriptsCached.addObjectEntry(hash, library);
+ }
+};
+
+//init();
+
+exports.init = init;
+exports.AUTHOR_REASON = AUTHOR_REASON;
diff --git a/lib/script_entries/removed_scripts.js b/lib/script_entries/removed_scripts.js
new file mode 100644
index 0000000..8f65c4d
--- /dev/null
+++ b/lib/script_entries/removed_scripts.js
@@ -0,0 +1,71 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var allScripts = require('script_entries/all_scripts').allScripts;
+const urlHandler = require('url_handler/url_handler');
+
+var RemovedScripts = function() {
+ this.scripts = {};
+ this.truncateJsData = allScripts.truncateJsData;
+ this.getScripts = allScripts.getScripts;
+ this.isFound = allScripts.isFound;
+ this.returnWhenFound = allScripts.returnWhenFound;
+ this.getOrInitScripts = allScripts.getOrInitScripts;
+ this.reverseArray = allScripts.reverseArray;
+ this.setHash = allScripts.setHash;
+};
+
+RemovedScripts.prototype.clearScripts = function (url) {
+ this.scripts[url] = [];
+};
+
+/**
+ * addAScript
+ * adds a single script to the scripts array.
+ * @param {string} url - the url of the page where it is loaded.
+ * @param {object} scriptObj - Additional data regarding this script,
+ * including: inline: boolean,
+ * contents: string,
+ * removalReason: string.
+ */
+RemovedScripts.prototype.addAScript = function (url, scriptObj, absoluteUrl) {
+ var exists;
+
+ if (this.scripts[url] === undefined) {
+ this.clearScripts(url);
+ }
+ if (scriptObj.inline === true) {
+ this.setHash(scriptObj);
+ this.truncateJsData(scriptObj);
+ } else if (absoluteUrl !== undefined &&
+ scriptObj.inline === false) {
+ scriptObj.contents = urlHandler.resolve(absoluteUrl, scriptObj.contents);
+ }
+ exists = this.isFound(url, scriptObj);
+
+ if (!exists) {
+ this.scripts[url].push(scriptObj);
+ return true;
+ } else {
+ return false;
+ }
+};
+
+exports.removedScripts = new RemovedScripts();
diff --git a/lib/script_entries/scripts_cache.js b/lib/script_entries/scripts_cache.js
new file mode 100644
index 0000000..ca477cc
--- /dev/null
+++ b/lib/script_entries/scripts_cache.js
@@ -0,0 +1,189 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+var relationCheckerObj = require("js_checker/relation_checker").relationChecker;
+
+// import free_libraries to populate the cache hash map.
+var free_libraries = require("script_entries/free_libraries");
+
+var crypto = require('script_entries/crypto');
+const checkTypes = require("js_checker/constant_types").checkTypes;
+
+// cachedResults contains objects with result/relationChecker for
+// scripts entries indexed by SHA1sum
+var cachedResults = {};
+
+/**
+ * ScriptsCached keeps a cache of whitelisted scripts in the browser
+ * session.
+ */
+var ScriptsCached = function() {
+};
+
+ScriptsCached.prototype.getHash = function(scriptText) {
+ require('ui/notification').createNotification(scriptText.substring(0,100));
+
+ return crypto.sha1Encrypt(scriptText);
+};
+
+/**
+ * resetCache
+ * Resets the full cache and re-initialize
+ * the free libraries list.
+ */
+ScriptsCached.prototype.resetCache = function () {
+ cachedResults = {};
+ free_libraries.init();
+};
+
+/**
+ *
+ * addEntry
+ *
+ * Adds a script entry to the cache by providing the results
+ * and the actual script text.
+ *
+ */
+ScriptsCached.prototype.addEntry = function(
+ scriptText, result, relationChecker, allowTrivial, url) {
+ console.debug("result addEntry is", JSON.stringify(result));
+ cachedResults[this.getHash(scriptText)] = {
+ 'result': result,
+ 'relationChecker': relationCheckerObj(),
+ 'allowTrivial': allowTrivial,
+ 'url': url
+ };
+};
+
+/**
+ *
+ * addEntry
+ *
+ * Adds a script entry to the cache by providing the results
+ * using the script's hash.
+ *
+ */
+ScriptsCached.prototype.addEntryByHash = function(
+ hash, result, relationChecker, allowTrivial, url) {
+ cachedResults[hash] = {
+ 'result': result,
+ 'relationChecker': relationCheckerObj(),
+ 'allowTrivial': allowTrivial,
+ 'url': url || ''
+ };
+};
+
+/**
+ * removeEntryByHash
+ *
+ * Remove an entry from the cache using hash key.
+ */
+ScriptsCached.prototype.removeEntryByHash = function(hash) {
+ delete cachedResults[hash];
+};
+
+/**
+ * addEntryIfNotCached
+ *
+ * Checks first if entry is cached before attempting to cache result.
+ */
+ScriptsCached.prototype.addEntryIfNotCached = function(
+ scriptText, result, relationChecker, allowTrivial, url) {
+ // save a bit of computing by getting hash once.
+ var hash = this.getHash(scriptText);
+ console.debug('hash is then', hash);
+ if (!this.isCached(scriptText, hash)) {
+ cachedResults[hash] = {
+ 'result': result,
+ 'relationChecker': relationCheckerObj(),
+ 'allowTrivial': allowTrivial,
+ 'url': url || ''
+ };
+ }
+ return hash;
+};
+
+/**
+ *
+ * addObjectEntry
+ *
+ * Adds a script entry by providing an object.
+ * Used to provide free library hashes from free_libraries.js
+ *
+ */
+ScriptsCached.prototype.addObjectEntry = function(hash, script) {
+ cachedResults[hash] = script;
+};
+
+ScriptsCached.prototype.isCached = function(scriptText, hash) {
+ var scriptHash;
+ console.debug("Is CACHED start?");
+ try {
+ if (typeof hash === 'string') {
+ scriptHash = hash;
+ } else {
+ scriptHash = this.getHash(scriptText);
+ }
+ if (typeof scriptHash === 'string') {
+ let cachedResult = cachedResults[scriptHash];
+ if (cachedResult) {
+ // exact copy of file has already been cached.
+ console.debug('scriptHash is', cachedResult);
+ if (cachedResult.relationChecker == "[rl]") {
+ cachedResult.relationChecker = {}; //relationCheckerObj();
+ }
+ console.debug("Is Cached ENd TRUE");
+ return cachedResult;
+ }
+ }
+ return false;
+ } catch (e) {
+ console.debug("an error", scriptHash, e, e.linenumber, e.filename);
+ }
+};
+
+/**
+ * Writes allowed scripts to the cache.
+ * nonfree/nontrivial scripts are not added to the cache.
+ */
+ScriptsCached.prototype.getCacheForWriting = function() {
+ var formattedResults = {};
+ for (let item in cachedResults) {
+ let type = cachedResults[item].result.type;
+ if (type != checkTypes.NONTRIVIAL &&
+ type != checkTypes.TRIVIAL_DEFINES_FUNCTION
+ ) {
+ formattedResults[item] = cachedResults[item];
+ }
+ }
+ return formattedResults;
+};
+
+/**
+ * Import data from database into cachedResults.
+ * Calling this function replaces the current cache if it exists.
+ */
+ScriptsCached.prototype.bulkImportCache = function(data) {
+ cachedResults = data;
+ console.debug("Imported data. Number of keys ISSS ",
+ Object.keys(cachedResults).length);
+ console.debug("It looks like ", JSON.stringify(cachedResults));
+};
+
+exports.scriptsCached = new ScriptsCached();
diff --git a/lib/settings/settings.js b/lib/settings/settings.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/settings/settings.js
diff --git a/lib/settings/settings_tab.js b/lib/settings/settings_tab.js
new file mode 100644
index 0000000..bb9a3f6
--- /dev/null
+++ b/lib/settings/settings_tab.js
@@ -0,0 +1,78 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+const tabs = require("sdk/tabs");
+const data = require("sdk/self").data;
+const storage = require("settings/storage").librejsStorage;
+const scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+
+exports.settingsManager = settingsManager;
+
+let settingsManager = {
+ settingsTab: {
+ url: data.url("settings/index.html"),
+ onReady: function (tab) {
+ console.debug("populating form");
+ var that = this;
+ let cache_data = scriptsCached.getCacheForWriting();
+ let worker = tab.attach({
+ contentScriptFile: [
+ data.url('settings/js/pagescript-listener.js'),
+ data.url('settings/js/pagescript-emitter.js')
+ ]
+ });
+ worker.port.emit("populate-form", cache_data);
+ worker.port.on("rules-form-delete", function (hash) {
+ try {
+ scriptsCached.removeEntryByHash(hash);
+ } catch (e) {
+ console.log('caught!', e, e.lineNumber, e.filename);
+ }
+ //worker.port.emit("populate-form", scriptsCached.getCacheForWriting());
+ });
+ worker.port.on("rules-form-delete-all", function () {
+ scriptsCached.resetCache();
+ });
+ },
+ onActivate: function (tab) {
+ // just reload the form.
+ console.debug("Tab is activated again");
+ var that = this;
+ let cache_data = scriptsCached.getCacheForWriting();
+ let worker = tab.attach({
+ contentScriptFile: [
+ data.url('settings/js/pagescript-listener.js'),
+ data.url('settings/js/pagescript-emitter.js')
+ ]
+ });
+ worker.port.emit("populate-form", cache_data);
+ }
+ },
+
+ init: function () {
+ settings.onLoad(function (data) {});
+ },
+
+ open: function () {
+ console.debug("settings tab data url is", this.settingsTab.url);
+ tabs.open(this.settingsTab);
+ }
+};
+
+exports.settingsManager = settingsManager;
diff --git a/lib/settings/storage.js b/lib/settings/storage.js
new file mode 100644
index 0000000..a576781
--- /dev/null
+++ b/lib/settings/storage.js
@@ -0,0 +1,175 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+/*jshint esnext: true */
+
+const { Cc, Ci, Cu, components } = require("chrome");
+
+var { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm");
+var { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm");
+var relationChecker = require("js_checker/relation_checker").relationChecker;
+var rc = relationChecker(); // a dummy object for legacy module.
+const AUTHOR_REASON = require("script_entries/free_libraries").AUTHOR_REASON;
+var relationChecker = require("js_checker/relation_checker").relationChecker;
+
+const scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+
+let librejsStorage = {
+
+ file: null,
+ filename: 'librejs-whitelist.json',
+ data: [],
+
+ onLoad: function (callback) {
+ // will read the json file.
+ this.init();
+ this.read(callback);
+ },
+
+ init: function () {
+ // get the "librejs-whitelist.json" file in the profile directory
+ this.file = FileUtils.getFile("ProfD", [this.filename]);
+ },
+
+ read: function (callback) {
+ // Content type hint is useful on mobile platforms where the filesystem
+ // would otherwise try to determine the content type.
+ var channel = NetUtil.newChannel(this.file);
+ var that = this;
+ channel.contentType = "application/json";
+ try {
+ NetUtil.asyncFetch(channel, function(inputStream, status) {
+
+ if (!components.isSuccessCode(status)) {
+ require("script_entries/free_libraries").init();
+ that.initialWrite();
+ }
+
+ var raw_data = NetUtil.readInputStreamToString(
+ inputStream, inputStream.available());
+ // expand json file back to original contents.
+ var re = new RegExp(
+ "[freelib]".replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'),
+ 'g'
+ );
+ raw_data = raw_data.replace(re, AUTHOR_REASON);
+ //console.debug("raw_data is ", raw_data);
+ // The file data is contained within inputStream.
+ // You can read it into a string with
+ // get string into json also
+ that.data = JSON.parse(raw_data);
+
+ callback(that.data);
+ });
+ } catch (e) {
+ that.initialWrite();
+ }
+ },
+
+ initialWrite: function (callback) {
+ console.debug("About to write free libraries");
+ // our file is not populated with default contents.
+ // use free_libraries.js to populate.
+ require("script_entries/free_libraries").init();
+ this.writeCacheToDB(callback);
+ },
+
+ /**
+ * writes the contents of scriptsCached to the persistent
+ * JSON file.
+ */
+ writeCacheToDB: function (callback) {
+ console.debug("writing to db");
+ data = scriptsCached.getCacheForWriting();
+ json = JSON.stringify(data);
+
+ // make json file smaller.
+ var re = new RegExp(
+ AUTHOR_REASON.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g');
+ json = json.replace(re, "[freelib]");
+
+ var rc = JSON.stringify(relationChecker());
+ re = new RegExp(rc.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g');
+ json = json.replace(re, "\"[rl]\"");
+ //console.debug("this.data is now", this.data);
+ this.write(callback, json);
+ },
+ generateCacheFromDB: function (callback) {
+ if (typeof callback === 'undefined') {
+ callback = function () {
+ // nothing to do.
+ };
+ }
+ this.read(function (data) {
+ scriptsCached.bulkImportCache(data);
+ });
+ },
+ write: function (onDataWritten, json) {
+
+ this.init();
+ var str;
+ if (typeof json === 'undefined') {
+ str = JSON.stringify(this.data);
+ } else {
+ // we are passing json already formatted.
+ str = json;
+ }
+ var ostream = FileUtils.openSafeFileOutputStream(this.file);
+ var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Ci.nsIScriptableUnicodeConverter);
+ converter.charset = "UTF-8";
+ var istream = converter.convertToInputStream(str);
+ // The last argument (the callback) is optional.
+ NetUtil.asyncCopy(istream, ostream, function(status) {
+ if (!components.isSuccessCode(status)) {
+ // Handle error!
+ return;
+ }
+ if (!onDataWritten) {
+ console.debug("onDataWritten is not defined");
+ onDataWritten = function () {
+ console.debug("onDataWritten dummy callback triggered");
+ };
+ }
+ // Data has been written to the file.
+ onDataWritten();
+ });
+ },
+
+ /**
+ * getEntry -- Returns a storage entry if it is present.
+ */
+ getEntry: function (hash) {
+ var entry = this.data[hash];
+ if (entry) {
+ if (entry.result === '[freelib]') {
+ entry.result = {
+ 'type': 4,
+ 'reason': 'This script has been tagged as free ' +
+ 'software by LibreJS authors.'
+ };
+ }
+ entry.relationChecker = rc;
+ return entry;
+ }
+ return false;
+ }
+};
+
+exports.librejsStorage = librejsStorage;
diff --git a/lib/ui.js b/lib/ui.js
new file mode 100644
index 0000000..8280a3b
--- /dev/null
+++ b/lib/ui.js
@@ -0,0 +1,186 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+let data = require("sdk/self").data;
+let panel = require('sdk/panel');
+let tabs = require("sdk/tabs");
+let {getMostRecentBrowserWindow} = require('sdk/window/utils');
+let {ToggleButton} = require('sdk/ui/button/toggle');
+
+let settings_tab = require('settings/settings_tab');
+let allowedRef = require("http_observer/allowed_referrers").allowedReferrers;
+let urlHandler = require("url_handler/url_handler");
+let removedScripts = require("script_entries/removed_scripts").removedScripts;
+let acceptedScripts = require("script_entries/accepted_scripts")
+ .acceptedScripts;
+let jsLabelsPagesVisited = require('html_script_finder/web_labels/js_web_labels')
+ .jsLabelsPagesVisited;
+let dryRunScripts = require("script_entries/dryrun_scripts").dryRunScripts;
+let types = require("js_checker/constant_types");
+
+// move to sub-module later
+const scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+
+function generateDataURI (encodedText) {
+ return "data:text/html;charset=UTF-8;base64," + encodedText;
+}
+
+/**
+ * UI
+ *
+ * A singleton that starts the user interface content scripts.
+ */
+let UI = exports.UI = {
+ init: function() {
+ var mainPanel = panel.Panel({
+ contentURL: data.url('display_panel/content/display-panel.html'),
+ width: 800,
+ height: 500,
+ contentScriptFile: [
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('display_panel/main_panel.js')
+ ],
+ onShow: this.showPanelContent,
+ onHide: function() {
+ toggleButton.state('window', { checked: false });
+ }
+ });
+
+ mainPanel.port.on('hideMainPanel', function () {
+ mainPanel.hide();
+ });
+
+ mainPanel.port.on('allowAllClicked', function (url) {
+ url = urlHandler.removeFragment(url);
+ allowedRef.addPage(url);
+ tabs.activeTab.reload();
+ });
+
+ mainPanel.port.on('disallowAllClicked', function (url) {
+ console.debug('url is', url);
+ url = urlHandler.removeFragment(url);
+ console.debug('before clear, url is in allowedRef',
+ allowedRef.urlInAllowedReferrers(url));
+ allowedRef.clearSinglePageEntry(url);
+ console.debug('after clear, url is in allowedRef',
+ allowedRef.urlInAllowedReferrers(url));
+ mainPanel.hide();
+ tabs.activeTab.reload();
+ });
+
+ mainPanel.port.on('openInTab', function (text) {
+ var str = generateDataURI(text);
+ tabs.open(str);
+ mainPanel.hide();
+ });
+
+ mainPanel.port.on('whitelistByHash', function(
+ hash, url, name, reason
+ ) {
+ console.debug("hash is", hash);
+ url = urlHandler.removeFragment(url);
+ /* var cached_result = scriptsCached.isCached(hash);
+ if (cached_results) {
+ reason = cached_result['reason'];
+ }*/
+ scriptsCached.addEntryByHash(
+ hash, types.whitelisted(reason), {}, true, url);
+ });
+
+ mainPanel.port.on('removeFromWhitelistByHash', function (hash) {
+ scriptsCached.removeEntryByHash(hash);
+ removeHashCallback(hash);
+ });
+
+ mainPanel.port.on('openSesame', function () {
+ // open the settings tab.
+ settings_tab.settingsManager.open();
+ mainPanel.hide();
+ });
+
+ var toggleButton = ToggleButton({
+ id: 'librejs-toggle-switch',
+ label: 'LibreJS',
+ icon: {
+ '16': './widget/images/librejs.png',
+ '32': './widget/images/librejs-32.png',
+ '64': './widget/images/librejs-64.png'
+ },
+ panel: mainPanel,
+ onChange: function(state) {
+ if (state.checked) {
+ mainPanel.show({
+ position: toggleButton
+ });
+ }
+ }
+ });
+
+ var menuitem = require("menuitems").Menuitem({
+ id: 'librejs_settings',
+ menuid: 'menu_ToolsPopup',
+ label: 'LibreJS Whitelist',
+ onCommand: function() {
+ settings_tab.settingsManager.open();
+ },
+ insertBefore: "menu_pageInfo"
+ });
+ },
+
+ showPanelContent: function() {
+ let that = this;
+ var message, externalEntries,
+ externalScripts, urlTabIndex, tabData;
+
+ var worker = tabs.activeTab.attach({
+ contentScriptFile: [
+ data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js'),
+ data.url('complain/pagemod_finder.js'),
+ data.url('script_detector/script_detector.js')
+ ],
+ contentScriptWhen: 'ready',
+ onMessage: function(respData) {
+ var url = urlHandler.removeFragment(tabs.activeTab.url);
+
+ if (respData.event === 'scriptsFetched') {
+ var scriptsData = {
+ 'jsLabelsPagesVisited': jsLabelsPagesVisited,
+ 'removed': removedScripts.getScripts(url),
+ 'accepted': acceptedScripts.getScripts(url),
+ 'dryRun': dryRunScripts.getScripts(url)
+ };
+ that.postMessage({
+ 'pageURL': url,
+ 'urlData': scriptsData,
+ 'isAllowed': allowedRef.urlInAllowedReferrers(url)
+ });
+ worker.port.emit('pageUrl', url);
+ } else {
+ that.postMessage(respData);
+ }
+ }
+ });
+ }
+};
+
+UI.init();
diff --git a/lib/ui/notification.js b/lib/ui/notification.js
new file mode 100644
index 0000000..35aceb9
--- /dev/null
+++ b/lib/ui/notification.js
@@ -0,0 +1,76 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// this module is used to display a notification when LibreJS
+// is running to inform the user it is indeed busy working.
+const timer = require("sdk/timers");
+const self = require("sdk/self");
+const isDisplayNotifications = require("addon_management/prefchange")
+ .isDisplayNotifications;
+
+exports.createCriticalNotification = function (text) {
+ if (text === undefined) {
+ text = "";
+ }
+ var self = require('sdk/self');
+ var notif = require("notification-box").NotificationBox({
+ 'value': 'librejs-critical-notification-js-web-labels',
+ 'label': text,
+ 'priority': 'CRITICAL_LOW',
+ 'image': self.data.url("assets/images/torchy2.png"),
+ });
+ return notif;
+};
+
+var fakeNotification = {
+ 'close': function () {
+ return;
+ }
+};
+
+exports.createNotification = function (jsValue) {
+ if (!isDisplayNotifications()) {
+ return fakeNotification;
+ }
+ if (jsValue === undefined) {
+ jsValue = "";
+ }
+ var self = require('sdk/self');
+ var notif = require("notification-box").NotificationBox({
+ 'value': 'librejs-message',
+ 'label': 'LibreJS is analyzing: ' + jsValue + " ...",
+ 'priority': 'INFO_LOW',
+ 'image': self.data.url("assets/images/torchy2.png"),
+ /*'buttons': [{'label': "Fine",
+ 'onClick': function () { }}]*/
+ });
+ timer.setTimeout(function () {
+ // ensure notifications are ALWAYS removed at some point.
+ console.debug("removing after 2 seconds");
+ try {
+ var n = notif.notificationbox
+ .getNotificationWithValue('librejs-message');
+ n.close();
+ } catch(x) {
+ // do nothing
+ }
+ }, 2000);
+ return notif;
+};
diff --git a/lib/ui/script_panel.js b/lib/ui/script_panel.js
new file mode 100644
index 0000000..85c22a4
--- /dev/null
+++ b/lib/ui/script_panel.js
@@ -0,0 +1,73 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var urlHandler = require("url_handler/url_handler");
+
+/**
+ * addScriptsToPanelList
+ *
+ * Looks for scripts that are either valid or flagged with libreJS
+ *
+ */
+exports.addScriptsToPanelList = function (url, respData) {
+
+ var panelRemovedScripts = [];
+ var panelAcceptedScripts = [];
+ var panelDryRunScripts = [];
+
+ // use url. remove fragment.
+ url = urlHandler.removeFragment(url);
+ var contents, i, reason;
+
+ for (i = 0; i < respData.value.blocked.length; i++) {
+ // if external script only.
+ pathToUrl(respData.value.blocked[i], url);
+ panelRemovedScripts.push(respData.value.blocked[i]);
+ }
+
+ for (i = 0; i < respData.value.accepted.length; i++) {
+
+ // if external script only.
+ pathToUrl(respData.value.accepted[i], url);
+ panelAcceptedScripts.push(respData.value.accepted[i]);
+ }
+ for (i = 0; i < respData.value.dryRun.length; i++) {
+ // if external script only.
+ pathToUrl(respData.value.dryRun[i], url);
+ panelDryRunScripts.push(respData.value.dryRun[i]);
+ }
+
+ return {'removed': panelRemovedScripts,
+ 'accepted': panelAcceptedScripts,
+ 'dryRun': panelDryRunScripts};
+};
+
+
+/**
+ * pathToUrl
+ *
+ * convert a relative path to a url.
+ *
+ */
+var pathToUrl = function (scriptEntry, url) {
+ if (scriptEntry.inline === false) {
+ scriptEntry.url = urlHandler.resolve(url, scriptEntry.url);
+ }
+};
diff --git a/lib/ui/ui_info.js b/lib/ui/ui_info.js
new file mode 100644
index 0000000..55707d9
--- /dev/null
+++ b/lib/ui/ui_info.js
@@ -0,0 +1,202 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// page mod executing content script at every page load.
+
+var data = require("sdk/self").data;
+var pageMod = require("sdk/page-mod");
+var urlHandler = require("url_handler/url_handler");
+var pageWorker = require("sdk/page-worker");
+var tabs = require("sdk/tabs");
+var prefs = require("addon_management/prefchange");
+
+// contain list of recently found contact links or email addresses.
+var contactList = {};
+
+// constants. Also available in lib/ui_info.js
+const CERTAIN_EMAIL_ADDRESS_FOUND = 'certainEmailAddressFound';
+const UNCERTAIN_EMAIL_ADDRESS_FOUND = 'uncertainEmailAddresFound';
+
+// Looking for contact links
+const CERTAIN_LINK_FOUND = 'certainLinkFound';
+const PROBABLE_LINK_FOUND = 'probableLinkFound';
+const UNCERTAIN_LINK_FOUND = 'uncertainLinkFound';
+const LINK_NOT_FOUND = 'contactLinkNotFound';
+
+// Looking for identi.ca and twitter accounts.
+const TWITTER_LINK_FOUND = 'twitterLinkFound';
+const IDENTICA_LINK_FOUND = 'identicaLinkFound';
+
+// phone number and address
+const PHONE_NUMBER_FOUND = 'phoneNumberFound';
+const SNAIL_ADDRESS_FOUND = 'snailAddressFound';
+
+/**
+ * main pageMod.
+ * Find blocked script in all pages being opened.
+ * Launch the scripts that search for a complaint contact.
+ *
+ */
+
+pageMod.PageMod({
+ include: ['file://*', '*', 'data:*', 'about:*'],
+ contentScriptWhen: 'end',
+
+ contentScriptFile: [
+ data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js'),
+ data.url('complain/pagemod_finder.js'),
+ data.url('script_detector/script_detector.js')
+ ],
+
+ onAttach: function onAttach(worker) {
+ if (worker.tab !== undefined && prefs.isComplaintTab()) {
+ // this is a tab.
+ if (!foundInContactList(worker.url)) {
+ // the hostname doesn't appear in the object literal.
+ // run script fetching/complaint feature if applicable.
+ tabProcess(worker);
+ } else {
+ worker.postMessage(foundInContactList(worker.url));
+ }
+ }
+ }
+});
+
+/**
+ * foundInContactList
+ *
+ * Provides link if contact link is found for given url, or else
+ * false.
+ */
+var foundInContactList = function (url) {
+ var hostname = urlHandler.getHostname(url);
+ if (contactList[hostname] !== undefined) {
+ return contactList[hostname];
+ } else {
+ return false;
+ }
+};
+
+/**
+ * tabProcess
+ * Find blocked/accepted scripts, prepare
+ * display panel and complaint panel.
+ */
+var tabProcess = function (worker) {
+ var visitedUrl = {};
+
+ // webmaster email is better than a webpage.
+ worker.emailFound = false;
+ var modUrl = '',
+ searchUrl = '';
+
+ modUrl = worker.url;
+ console.debug('pagemod triggered');
+
+ worker.port.emit('prefs', {
+ complaintEmailSubject: prefs.complaintEmailSubject(),
+ complaintEmailBody: prefs.complaintEmailBody()
+ });
+
+ // send local path to complain button graphic.
+ worker.port.emit('assetsUri',
+ {'event': 'assets-uri',
+ 'value': data.url('assets/')});
+ worker.port.emit('pageUrl',
+ {'event': 'page-url',
+ 'value': modUrl});
+
+ worker.on('message', function (respData) {
+ console.debug('worker is receiving a message', respData.event);
+ var pw;
+
+ worker.on('detach', function () {
+ console.debug('detaching worker');
+ if (pw) {
+ pw.destroy();
+ }
+ });
+ if (respData.contact !== undefined) {
+ // pass the message to the complaint display panel.
+ worker.port.emit('complaintLinkFound', respData);
+ } else if (respData.event === 'complaintSearch') {
+ if (worker.tab) {
+ console.debug('worker tab url', worker.tab.url);
+ }
+ if (!(respData.urlSearch.linkValue in visitedUrl)) {
+ visitedUrl[respData.urlSearch.linkValue] = 1;
+ respData.urlSearch.linkValue = urlHandler.addFragment(
+ respData.urlSearch.linkValue, 'librejs=true');
+ pw = searchSecondLevelPage(
+ this, respData.urlSearch.linkValue, this.url);
+ }
+ // currently not needed.
+ /*else {
+ console.debug(respData.urlSearch.linkValue, 'already visited');
+ }*/
+ }
+ });
+};
+
+var searchSecondLevelPage = function(
+ worker, urlToSearch, originalUrl) {
+ return;
+ var originalWorker = worker;
+
+ console.debug('searchSecondLevelPage');
+ console.debug(urlToSearch, 'and', originalUrl);
+
+ if (urlHandler.haveSameHostname(urlToSearch, originalUrl)) {
+ return pageWorker.Page({
+ contentURL: urlToSearch,
+ contentScriptFile: [
+ data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js'),
+ data.url('complain/worker_finder.js')
+ ],
+ contentScriptWhen: "end",
+ onMessage: function (respData) {
+ console.debug(JSON.stringify(respData));
+ console.debug(originalWorker.url);
+ originalWorker.postMessage(respData);
+
+ if (respData.event === 'destroy') {
+ try {
+ console.debug('destroying worker', this.contentURL);
+ this.destroy();
+ } catch (e) {
+ console.debug('in worker', e);
+ }
+ }
+ }
+ });
+ }
+};
+
+exports.testModule = {
+ 'contactList': contactList,
+ 'foundInContactList': foundInContactList,
+ 'tabProcess': tabProcess
+};
diff --git a/lib/url_handler/node_punycode.js b/lib/url_handler/node_punycode.js
new file mode 100644
index 0000000..163923c
--- /dev/null
+++ b/lib/url_handler/node_punycode.js
@@ -0,0 +1,510 @@
+/*! http://mths.be/punycode v1.2.0 by @mathias */
+;(function(root) {
+
+ /**
+ * The `punycode` object.
+ * @name punycode
+ * @type Object
+ */
+ var punycode,
+
+ /** Detect free variables `define`, `exports`, `module` and `require` */
+ freeDefine = typeof define == 'function' && typeof define.amd == 'object' &&
+ define.amd && define,
+ freeExports = typeof exports == 'object' && exports,
+ freeModule = typeof module == 'object' && module,
+ freeRequire = typeof require == 'function' && require,
+
+ /** Highest positive signed 32-bit float value */
+ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
+
+ /** Bootstring parameters */
+ base = 36,
+ tMin = 1,
+ tMax = 26,
+ skew = 38,
+ damp = 700,
+ initialBias = 72,
+ initialN = 128, // 0x80
+ delimiter = '-', // '\x2D'
+
+ /** Regular expressions */
+ regexPunycode = /^xn--/,
+ regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars
+ regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators
+
+ /** Error messages */
+ errors = {
+ 'overflow': 'Overflow: input needs wider integers to process',
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
+ 'invalid-input': 'Invalid input'
+ },
+
+ /** Convenience shortcuts */
+ baseMinusTMin = base - tMin,
+ floor = Math.floor,
+ stringFromCharCode = String.fromCharCode,
+
+ /** Temporary variable */
+ key;
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * A generic error utility function.
+ * @private
+ * @param {String} type The error type.
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
+ */
+ function error(type) {
+ throw RangeError(errors[type]);
+ }
+
+ /**
+ * A generic `Array#map` utility function.
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} callback The function that gets called for every array
+ * item.
+ * @returns {Array} A new array of values returned by the callback function.
+ */
+ function map(array, fn) {
+ var length = array.length;
+ while (length--) {
+ array[length] = fn(array[length]);
+ }
+ return array;
+ }
+
+ /**
+ * A simple `Array#map`-like wrapper to work with domain name strings.
+ * @private
+ * @param {String} domain The domain name.
+ * @param {Function} callback The function that gets called for every
+ * character.
+ * @returns {Array} A new string of characters returned by the callback
+ * function.
+ */
+ function mapDomain(string, fn) {
+ return map(string.split(regexSeparators), fn).join('.');
+ }
+
+ /**
+ * Creates an array containing the decimal code points of each Unicode
+ * character in the string. While JavaScript uses UCS-2 internally,
+ * this function will convert a pair of surrogate halves (each of which
+ * UCS-2 exposes as separate characters) into a single code point,
+ * matching UTF-16.
+ * @see `punycode.ucs2.encode`
+ * @see <http://mathiasbynens.be/notes/javascript-encoding>
+ * @memberOf punycode.ucs2
+ * @name decode
+ * @param {String} string The Unicode input string (UCS-2).
+ * @returns {Array} The new array of code points.
+ */
+ function ucs2decode(string) {
+ var output = [],
+ counter = 0,
+ length = string.length,
+ value,
+ extra;
+ while (counter < length) {
+ value = string.charCodeAt(counter++);
+ if ((value & 0xF800) == 0xD800 && counter < length) {
+ // high surrogate, and there is a next character
+ extra = string.charCodeAt(counter++);
+ if ((extra & 0xFC00) == 0xDC00) { // low surrogate
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+ } else {
+ output.push(value, extra);
+ }
+ } else {
+ output.push(value);
+ }
+ }
+ return output;
+ }
+
+ /**
+ * Creates a string based on an array of decimal code points.
+ * @see `punycode.ucs2.decode`
+ * @memberOf punycode.ucs2
+ * @name encode
+ * @param {Array} codePoints The array of decimal code points.
+ * @returns {String} The new Unicode string (UCS-2).
+ */
+ function ucs2encode(array) {
+ return map(array, function(value) {
+ var output = '';
+ if (value > 0xFFFF) {
+ value -= 0x10000;
+ output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
+ value = 0xDC00 | value & 0x3FF;
+ }
+ output += stringFromCharCode(value);
+ return output;
+ }).join('');
+ }
+
+ /**
+ * Converts a basic code point into a digit/integer.
+ * @see `digitToBasic()`
+ * @private
+ * @param {Number} codePoint The basic (decimal) code point.
+ * @returns {Number} The numeric value of a basic code point (for use in
+ * representing integers) in the range `0` to `base - 1`, or `base` if
+ * the code point does not represent a value.
+ */
+ function basicToDigit(codePoint) {
+ return codePoint - 48 < 10
+ ? codePoint - 22
+ : codePoint - 65 < 26
+ ? codePoint - 65
+ : codePoint - 97 < 26
+ ? codePoint - 97
+ : base;
+ }
+
+ /**
+ * Converts a digit/integer into a basic code point.
+ * @see `basicToDigit()`
+ * @private
+ * @param {Number} digit The numeric value of a basic code point.
+ * @returns {Number} The basic code point whose value (when used for
+ * representing integers) is `digit`, which needs to be in the range
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
+ * used; else, the lowercase form is used. The behavior is undefined
+ * if flag is non-zero and `digit` has no uppercase form.
+ */
+ function digitToBasic(digit, flag) {
+ // 0..25 map to ASCII a..z or A..Z
+ // 26..35 map to ASCII 0..9
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
+ }
+
+ /**
+ * Bias adaptation function as per section 3.4 of RFC 3492.
+ * http://tools.ietf.org/html/rfc3492#section-3.4
+ * @private
+ */
+ function adapt(delta, numPoints, firstTime) {
+ var k = 0;
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
+ delta += floor(delta / numPoints);
+ for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
+ delta = floor(delta / baseMinusTMin);
+ }
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
+ }
+
+ /**
+ * Converts a basic code point to lowercase if `flag` is falsy, or to
+ * uppercase if `flag` is truthy. The code point is unchanged if it's
+ * caseless. The behavior is undefined if `codePoint` is not a basic code
+ * point.
+ * @private
+ * @param {Number} codePoint The numeric value of a basic code point.
+ * @returns {Number} The resulting basic code point.
+ */
+ function encodeBasic(codePoint, flag) {
+ codePoint -= (codePoint - 97 < 26) << 5;
+ return codePoint + (!flag && codePoint - 65 < 26) << 5;
+ }
+
+ /**
+ * Converts a Punycode string of ASCII code points to a string of Unicode
+ * code points.
+ * @memberOf punycode
+ * @param {String} input The Punycode string of ASCII code points.
+ * @returns {String} The resulting string of Unicode code points.
+ */
+ function decode(input) {
+ // Don't use UCS-2
+ var output = [],
+ inputLength = input.length,
+ out,
+ i = 0,
+ n = initialN,
+ bias = initialBias,
+ basic,
+ j,
+ index,
+ oldi,
+ w,
+ k,
+ digit,
+ t,
+ length,
+ /** Cached calculation results */
+ baseMinusT;
+
+ // Handle the basic code points: let `basic` be the number of input code
+ // points before the last delimiter, or `0` if there is none, then copy
+ // the first basic code points to the output.
+
+ basic = input.lastIndexOf(delimiter);
+ if (basic < 0) {
+ basic = 0;
+ }
+
+ for (j = 0; j < basic; ++j) {
+ // if it's not a basic code point
+ if (input.charCodeAt(j) >= 0x80) {
+ error('not-basic');
+ }
+ output.push(input.charCodeAt(j));
+ }
+
+ // Main decoding loop: start just after the last delimiter if any basic code
+ // points were copied; start at the beginning otherwise.
+
+ for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
+
+ // `index` is the index of the next character to be consumed.
+ // Decode a generalized variable-length integer into `delta`,
+ // which gets added to `i`. The overflow checking is easier
+ // if we increase `i` as we go, then subtract off its starting
+ // value at the end to obtain `delta`.
+ for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
+
+ if (index >= inputLength) {
+ error('invalid-input');
+ }
+
+ digit = basicToDigit(input.charCodeAt(index++));
+
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
+ error('overflow');
+ }
+
+ i += digit * w;
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+
+ if (digit < t) {
+ break;
+ }
+
+ baseMinusT = base - t;
+ if (w > floor(maxInt / baseMinusT)) {
+ error('overflow');
+ }
+
+ w *= baseMinusT;
+
+ }
+
+ out = output.length + 1;
+ bias = adapt(i - oldi, out, oldi == 0);
+
+ // `i` was supposed to wrap around from `out` to `0`,
+ // incrementing `n` each time, so we'll fix that now:
+ if (floor(i / out) > maxInt - n) {
+ error('overflow');
+ }
+
+ n += floor(i / out);
+ i %= out;
+
+ // Insert `n` at position `i` of the output
+ output.splice(i++, 0, n);
+
+ }
+
+ return ucs2encode(output);
+ }
+
+ /**
+ * Converts a string of Unicode code points to a Punycode string of ASCII
+ * code points.
+ * @memberOf punycode
+ * @param {String} input The string of Unicode code points.
+ * @returns {String} The resulting Punycode string of ASCII code points.
+ */
+ function encode(input) {
+ var n,
+ delta,
+ handledCPCount,
+ basicLength,
+ bias,
+ j,
+ m,
+ q,
+ k,
+ t,
+ currentValue,
+ output = [],
+ /** `inputLength` will hold the number of code points in `input`. */
+ inputLength,
+ /** Cached calculation results */
+ handledCPCountPlusOne,
+ baseMinusT,
+ qMinusT;
+
+ // Convert the input in UCS-2 to Unicode
+ input = ucs2decode(input);
+
+ // Cache the length
+ inputLength = input.length;
+
+ // Initialize the state
+ n = initialN;
+ delta = 0;
+ bias = initialBias;
+
+ // Handle the basic code points
+ for (j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+ if (currentValue < 0x80) {
+ output.push(stringFromCharCode(currentValue));
+ }
+ }
+
+ handledCPCount = basicLength = output.length;
+
+ // `handledCPCount` is the number of code points that have been handled;
+ // `basicLength` is the number of basic code points.
+
+ // Finish the basic string - if it is not empty - with a delimiter
+ if (basicLength) {
+ output.push(delimiter);
+ }
+
+ // Main encoding loop:
+ while (handledCPCount < inputLength) {
+
+ // All non-basic code points < n have been handled already. Find the next
+ // larger one:
+ for (m = maxInt, j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
+ // but guard against overflow
+ handledCPCountPlusOne = handledCPCount + 1;
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
+ error('overflow');
+ }
+
+ delta += (m - n) * handledCPCountPlusOne;
+ n = m;
+
+ for (j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+
+ if (currentValue < n && ++delta > maxInt) {
+ error('overflow');
+ }
+
+ if (currentValue == n) {
+ // Represent delta as a generalized variable-length integer
+ for (q = delta, k = base; /* no condition */; k += base) {
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+ if (q < t) {
+ break;
+ }
+ qMinusT = q - t;
+ baseMinusT = base - t;
+ output.push(
+ stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
+ );
+ q = floor(qMinusT / baseMinusT);
+ }
+
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
+ delta = 0;
+ ++handledCPCount;
+ }
+ }
+
+ ++delta;
+ ++n;
+
+ }
+ return output.join('');
+ }
+
+ /**
+ * Converts a Punycode string representing a domain name to Unicode. Only the
+ * Punycoded parts of the domain name will be converted, i.e. it doesn't
+ * matter if you call it on a string that has already been converted to
+ * Unicode.
+ * @memberOf punycode
+ * @param {String} domain The Punycode domain name to convert to Unicode.
+ * @returns {String} The Unicode representation of the given Punycode
+ * string.
+ */
+ function toUnicode(domain) {
+ return mapDomain(domain, function(string) {
+ return regexPunycode.test(string)
+ ? decode(string.slice(4).toLowerCase())
+ : string;
+ });
+ }
+
+ /**
+ * Converts a Unicode string representing a domain name to Punycode. Only the
+ * non-ASCII parts of the domain name will be converted, i.e. it doesn't
+ * matter if you call it with a domain that's already in ASCII.
+ * @memberOf punycode
+ * @param {String} domain The domain name to convert, as a Unicode string.
+ * @returns {String} The Punycode representation of the given domain name.
+ */
+ function toASCII(domain) {
+ return mapDomain(domain, function(string) {
+ return regexNonASCII.test(string)
+ ? 'xn--' + encode(string)
+ : string;
+ });
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /** Define the public API */
+ punycode = {
+ /**
+ * A string representing the current Punycode.js version number.
+ * @memberOf punycode
+ * @type String
+ */
+ 'version': '1.2.0',
+ /**
+ * An object of methods to convert from JavaScript's internal character
+ * representation (UCS-2) to decimal Unicode code points, and back.
+ * @see <http://mathiasbynens.be/notes/javascript-encoding>
+ * @memberOf punycode
+ * @type Object
+ */
+ 'ucs2': {
+ 'decode': ucs2decode,
+ 'encode': ucs2encode
+ },
+ 'decode': decode,
+ 'encode': encode,
+ 'toASCII': toASCII,
+ 'toUnicode': toUnicode
+ };
+
+ /** Expose `punycode` */
+ if (freeExports) {
+ if (freeModule && freeModule.exports == freeExports) {
+ // in Node.js or Ringo 0.8+
+ freeModule.exports = punycode;
+ } else {
+ // in Narwhal or Ringo 0.7-
+ for (key in punycode) {
+ punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
+ }
+ }
+ } else if (freeDefine) {
+ // via curl.js or RequireJS
+ define('punycode', punycode);
+ } else {
+ // in a browser or Rhino
+ root.punycode = punycode;
+ }
+
+}(this));
diff --git a/lib/url_handler/node_querystring.js b/lib/url_handler/node_querystring.js
new file mode 100644
index 0000000..f8c7921
--- /dev/null
+++ b/lib/url_handler/node_querystring.js
@@ -0,0 +1,213 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// Query String Utilities
+
+var QueryString = exports;
+
+
+// If obj.hasOwnProperty has been overridden, then calling
+// obj.hasOwnProperty(prop) will break.
+// See: https://github.com/joyent/node/issues/1707
+function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+
+function charCode(c) {
+ return c.charCodeAt(0);
+}
+
+
+// a safe fast alternative to decodeURIComponent
+QueryString.unescapeBuffer = function(s, decodeSpaces) {
+ var out = new Buffer(s.length);
+ var state = 'CHAR'; // states: CHAR, HEX0, HEX1
+ var n, m, hexchar;
+
+ for (var inIndex = 0, outIndex = 0; inIndex <= s.length; inIndex++) {
+ var c = s.charCodeAt(inIndex);
+ switch (state) {
+ case 'CHAR':
+ switch (c) {
+ case charCode('%'):
+ n = 0;
+ m = 0;
+ state = 'HEX0';
+ break;
+ case charCode('+'):
+ if (decodeSpaces) c = charCode(' ');
+ // pass thru
+ default:
+ out[outIndex++] = c;
+ break;
+ }
+ break;
+
+ case 'HEX0':
+ state = 'HEX1';
+ hexchar = c;
+ if (charCode('0') <= c && c <= charCode('9')) {
+ n = c - charCode('0');
+ } else if (charCode('a') <= c && c <= charCode('f')) {
+ n = c - charCode('a') + 10;
+ } else if (charCode('A') <= c && c <= charCode('F')) {
+ n = c - charCode('A') + 10;
+ } else {
+ out[outIndex++] = charCode('%');
+ out[outIndex++] = c;
+ state = 'CHAR';
+ break;
+ }
+ break;
+
+ case 'HEX1':
+ state = 'CHAR';
+ if (charCode('0') <= c && c <= charCode('9')) {
+ m = c - charCode('0');
+ } else if (charCode('a') <= c && c <= charCode('f')) {
+ m = c - charCode('a') + 10;
+ } else if (charCode('A') <= c && c <= charCode('F')) {
+ m = c - charCode('A') + 10;
+ } else {
+ out[outIndex++] = charCode('%');
+ out[outIndex++] = hexchar;
+ out[outIndex++] = c;
+ break;
+ }
+ out[outIndex++] = 16 * n + m;
+ break;
+ }
+ }
+
+ // TODO support returning arbitrary buffers.
+
+ return out.slice(0, outIndex - 1);
+};
+
+
+QueryString.unescape = function(s, decodeSpaces) {
+ try {
+ return decodeURIComponent(s);
+ } catch (e) {
+ return QueryString.unescapeBuffer(s, decodeSpaces).toString();
+ }
+};
+
+
+QueryString.escape = function(str) {
+ return encodeURIComponent(str);
+};
+
+var stringifyPrimitive = function(v) {
+ switch (typeof v) {
+ case 'string':
+ return v;
+
+ case 'boolean':
+ return v ? 'true' : 'false';
+
+ case 'number':
+ return isFinite(v) ? v : '';
+
+ default:
+ return '';
+ }
+};
+
+
+QueryString.stringify = QueryString.encode = function(obj, sep, eq, name) {
+ sep = sep || '&';
+ eq = eq || '=';
+ if (obj === null) {
+ obj = undefined;
+ }
+
+ if (typeof obj === 'object') {
+ return Object.keys(obj).map(function(k) {
+ var ks = QueryString.escape(stringifyPrimitive(k)) + eq;
+ if (Array.isArray(obj[k])) {
+ return obj[k].map(function(v) {
+ return ks + QueryString.escape(stringifyPrimitive(v));
+ }).join(sep);
+ } else {
+ return ks + QueryString.escape(stringifyPrimitive(obj[k]));
+ }
+ }).join(sep);
+
+ }
+
+ if (!name) return '';
+ return QueryString.escape(stringifyPrimitive(name)) + eq +
+ QueryString.escape(stringifyPrimitive(obj));
+};
+
+// Parse a key=val string.
+QueryString.parse = QueryString.decode = function(qs, sep, eq, options) {
+ sep = sep || '&';
+ eq = eq || '=';
+ var obj = {};
+
+ if (typeof qs !== 'string' || qs.length === 0) {
+ return obj;
+ }
+
+ var regexp = /\+/g;
+ qs = qs.split(sep);
+
+ var maxKeys = 1000;
+ if (options && typeof options.maxKeys === 'number') {
+ maxKeys = options.maxKeys;
+ }
+
+ var len = qs.length;
+ // maxKeys <= 0 means that we should not limit keys count
+ if (maxKeys > 0 && len > maxKeys) {
+ len = maxKeys;
+ }
+
+ for (var i = 0; i < len; ++i) {
+ var x = qs[i].replace(regexp, '%20'),
+ idx = x.indexOf(eq),
+ kstr, vstr, k, v;
+
+ if (idx >= 0) {
+ kstr = x.substr(0, idx);
+ vstr = x.substr(idx + 1);
+ } else {
+ kstr = x;
+ vstr = '';
+ }
+
+ k = QueryString.unescape(kstr, true);
+ v = QueryString.unescape(vstr, true);
+
+ if (!hasOwnProperty(obj, k)) {
+ obj[k] = v;
+ } else if (Array.isArray(obj[k])) {
+ obj[k].push(v);
+ } else {
+ obj[k] = [obj[k], v];
+ }
+ }
+
+ return obj;
+};
diff --git a/lib/url_handler/node_url.js b/lib/url_handler/node_url.js
new file mode 100644
index 0000000..71d31a6
--- /dev/null
+++ b/lib/url_handler/node_url.js
@@ -0,0 +1,691 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var punycode = require('url_handler/node_punycode');
+
+exports.parse = urlParse;
+exports.resolve = urlResolve;
+exports.resolveObject = urlResolveObject;
+exports.format = urlFormat;
+
+exports.Url = Url;
+
+function Url() {
+ this.protocol = null;
+ this.slashes = null;
+ this.auth = null;
+ this.host = null;
+ this.port = null;
+ this.hostname = null;
+ this.hash = null;
+ this.search = null;
+ this.query = null;
+ this.pathname = null;
+ this.path = null;
+ this.href = null;
+}
+
+// Reference: RFC 3986, RFC 1808, RFC 2396
+
+// define these here so at least they only have to be
+// compiled once on the first module load.
+var protocolPattern = /^([a-z0-9.+-]+:)/i,
+ portPattern = /:[0-9]*$/,
+
+ // RFC 2396: characters reserved for delimiting URLs.
+ // We actually just auto-escape these.
+ delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
+
+ // RFC 2396: characters not allowed for various reasons.
+ unwise = ['{', '}', '|', '\\', '^', '~', '`'].concat(delims),
+
+ // Allowed by RFCs, but cause of XSS attacks. Always escape these.
+ autoEscape = ['\''].concat(delims),
+ // Characters that are never ever allowed in a hostname.
+ // Note that any invalid chars are also handled, but these
+ // are the ones that are *expected* to be seen, so we fast-path
+ // them.
+ nonHostChars = ['%', '/', '?', ';', '#']
+ .concat(unwise).concat(autoEscape),
+ hostEndingChars = ['/', '?', '#'],
+ hostnameMaxLen = 255,
+ hostnamePartPattern = /^[a-z0-9A-Z_-]{0,63}$/,
+ hostnamePartStart = /^([a-z0-9A-Z_-]{0,63})(.*)$/,
+ // protocols that can allow "unsafe" and "unwise" chars.
+ unsafeProtocol = {
+ 'javascript': true,
+ 'javascript:': true
+ },
+ // protocols that never have a hostname.
+ hostlessProtocol = {
+ 'javascript': true,
+ 'javascript:': true
+ },
+ // protocols that always contain a // bit.
+ slashedProtocol = {
+ 'http': true,
+ 'https': true,
+ 'ftp': true,
+ 'gopher': true,
+ 'file': true,
+ 'http:': true,
+ 'https:': true,
+ 'ftp:': true,
+ 'gopher:': true,
+ 'file:': true
+ },
+ querystring = require('url_handler/node_querystring');
+
+function urlParse(url, parseQueryString, slashesDenoteHost) {
+ if (url && typeof(url) === 'object' && url instanceof Url) return url;
+
+ var u = new Url;
+ u.parse(url, parseQueryString, slashesDenoteHost);
+ return u;
+}
+
+Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
+ if (typeof url !== 'string') {
+ throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
+ }
+
+ // Copy chrome, IE, opera backslash-handling behavior.
+ // See: https://code.google.com/p/chromium/issues/detail?id=25916
+ var hashSplit = url.split('#');
+ hashSplit[0] = hashSplit[0].replace(/\\/g, '/');
+ url = hashSplit.join('#');
+
+ var rest = url;
+
+ // trim before proceeding.
+ // This is to support parse stuff like " http://foo.com \n"
+ rest = rest.trim();
+
+ var proto = protocolPattern.exec(rest);
+ if (proto) {
+ proto = proto[0];
+ var lowerProto = proto.toLowerCase();
+ this.protocol = lowerProto;
+ rest = rest.substr(proto.length);
+ }
+
+ // figure out if it's got a host
+ // user@server is *always* interpreted as a hostname, and url
+ // resolution will treat //foo/bar as host=foo,path=bar because that's
+ // how the browser resolves relative URLs.
+ if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
+ var slashes = rest.substr(0, 2) === '//';
+ if (slashes && !(proto && hostlessProtocol[proto])) {
+ rest = rest.substr(2);
+ this.slashes = true;
+ }
+ }
+
+ if (!hostlessProtocol[proto] &&
+ (slashes || (proto && !slashedProtocol[proto]))) {
+
+ // there's a hostname.
+ // the first instance of /, ?, ;, or # ends the host.
+ //
+ // If there is an @ in the hostname, then non-host chars *are* allowed
+ // to the left of the last @ sign, unless some host-ending character
+ // comes *before* the @-sign.
+ // URLs are obnoxious.
+ //
+ // ex:
+ // http://a@b@c/ => user:a@b host:c
+ // http://a@b?@c => user:a host:c path:/?@c
+
+ // v0.12 TODO(isaacs): This is not quite how Chrome does things.
+ // Review our test case against browsers more comprehensively.
+
+ // find the first instance of any hostEndingChars
+ var hostEnd = -1;
+ for (var i = 0; i < hostEndingChars.length; i++) {
+ var hec = rest.indexOf(hostEndingChars[i]);
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
+ hostEnd = hec;
+ }
+
+ // at this point, either we have an explicit point where the
+ // auth portion cannot go past, or the last @ char is the decider.
+ var auth, atSign;
+ if (hostEnd === -1) {
+ // atSign can be anywhere.
+ atSign = rest.lastIndexOf('@');
+ } else {
+ // atSign must be in auth portion.
+ // http://a@b/c@d => host:b auth:a path:/c@d
+ atSign = rest.lastIndexOf('@', hostEnd);
+ }
+
+ // Now we have a portion which is definitely the auth.
+ // Pull that off.
+ if (atSign !== -1) {
+ auth = rest.slice(0, atSign);
+ rest = rest.slice(atSign + 1);
+ this.auth = decodeURIComponent(auth);
+ }
+
+ // the host is the remaining to the left of the first non-host char
+ hostEnd = -1;
+ for (var i = 0; i < nonHostChars.length; i++) {
+ var hec = rest.indexOf(nonHostChars[i]);
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
+ hostEnd = hec;
+ }
+ // if we still have not hit it, then the entire thing is a host.
+ if (hostEnd === -1)
+ hostEnd = rest.length;
+
+ this.host = rest.slice(0, hostEnd);
+ rest = rest.slice(hostEnd);
+
+ // pull out port.
+ this.parseHost();
+
+ // we've indicated that there is a hostname,
+ // so even if it's empty, it has to be present.
+ this.hostname = this.hostname || '';
+
+ // if hostname begins with [ and ends with ]
+ // assume that it's an IPv6 address.
+ var ipv6Hostname = this.hostname[0] === '[' &&
+ this.hostname[this.hostname.length - 1] === ']';
+
+ // validate a little.
+ if (!ipv6Hostname) {
+ var hostparts = this.hostname.split(/\./);
+ for (var i = 0, l = hostparts.length; i < l; i++) {
+ var part = hostparts[i];
+ if (!part) continue;
+ if (!part.match(hostnamePartPattern)) {
+ var newpart = '';
+ for (var j = 0, k = part.length; j < k; j++) {
+ if (part.charCodeAt(j) > 127) {
+ // we replace non-ASCII char with a temporary placeholder
+ // we need this to make sure size of hostname is not
+ // broken by replacing non-ASCII by nothing
+ newpart += 'x';
+ } else {
+ newpart += part[j];
+ }
+ }
+ // we test again with ASCII char only
+ if (!newpart.match(hostnamePartPattern)) {
+ var validParts = hostparts.slice(0, i);
+ var notHost = hostparts.slice(i + 1);
+ var bit = part.match(hostnamePartStart);
+ if (bit) {
+ validParts.push(bit[1]);
+ notHost.unshift(bit[2]);
+ }
+ if (notHost.length) {
+ rest = '/' + notHost.join('.') + rest;
+ }
+ this.hostname = validParts.join('.');
+ break;
+ }
+ }
+ }
+ }
+
+ if (this.hostname.length > hostnameMaxLen) {
+ this.hostname = '';
+ } else {
+ // hostnames are always lower case.
+ this.hostname = this.hostname.toLowerCase();
+ }
+
+ if (!ipv6Hostname) {
+ // IDNA Support: Returns a punycoded representation of "domain".
+ // It only converts parts of the domain name that
+ // have non-ASCII characters, i.e. it doesn't matter if
+ // you call it with a domain that already is ASCII-only.
+ this.hostname = punycode.toASCII(this.hostname);
+ }
+
+ var p = this.port ? ':' + this.port : '';
+ var h = this.hostname || '';
+ this.host = h + p;
+ this.href += this.host;
+
+ // strip [ and ] from the hostname
+ // the host field still retains them, though
+ if (ipv6Hostname) {
+ this.hostname = this.hostname.substr(1, this.hostname.length - 2);
+ if (rest[0] !== '/') {
+ rest = '/' + rest;
+ }
+ }
+ }
+
+ // now rest is set to the post-host stuff.
+ // chop off any delim chars.
+ if (!unsafeProtocol[lowerProto]) {
+
+ // First, make 100% sure that any "autoEscape" chars get
+ // escaped, even if encodeURIComponent doesn't think they
+ // need to be.
+ for (var i = 0, l = autoEscape.length; i < l; i++) {
+ var ae = autoEscape[i];
+ var esc = encodeURIComponent(ae);
+ if (esc === ae) {
+ esc = escape(ae);
+ }
+ rest = rest.split(ae).join(esc);
+ }
+ }
+
+
+ // chop off from the tail first.
+ var hash = rest.indexOf('#');
+ if (hash !== -1) {
+ // got a fragment string.
+ this.hash = rest.substr(hash);
+ rest = rest.slice(0, hash);
+ }
+ var qm = rest.indexOf('?');
+ if (qm !== -1) {
+ this.search = rest.substr(qm);
+ this.query = rest.substr(qm + 1);
+ if (parseQueryString) {
+ this.query = querystring.parse(this.query);
+ }
+ rest = rest.slice(0, qm);
+ } else if (parseQueryString) {
+ // no query string, but parseQueryString still requested
+ this.search = '';
+ this.query = {};
+ }
+ if (rest) this.pathname = rest;
+ if (slashedProtocol[lowerProto] &&
+ this.hostname && !this.pathname) {
+ this.pathname = '/';
+ }
+
+ //to support http.request
+ if (this.pathname || this.search) {
+ var p = this.pathname || '';
+ var s = this.search || '';
+ this.path = p + s;
+ }
+
+ // finally, reconstruct the href based on what has been validated.
+ this.href = this.format();
+ return this;
+};
+
+// format a parsed object into a url string
+function urlFormat(obj) {
+ // ensure it's an object, and not a string url.
+ // If it's an obj, this is a no-op.
+ // this way, you can call url_format() on strings
+ // to clean up potentially wonky urls.
+ if (typeof(obj) === 'string') obj = urlParse(obj);
+ if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
+ return obj.format();
+}
+
+Url.prototype.format = function() {
+ var auth = this.auth || '';
+ if (auth) {
+ auth = encodeURIComponent(auth);
+ auth = auth.replace(/%3A/i, ':');
+ auth += '@';
+ }
+
+ var protocol = this.protocol || '',
+ pathname = this.pathname || '',
+ hash = this.hash || '',
+ host = false,
+ query = '';
+
+ if (this.host) {
+ host = auth + this.host;
+ } else if (this.hostname) {
+ host = auth + (this.hostname.indexOf(':') === -1 ?
+ this.hostname :
+ '[' + this.hostname + ']');
+ if (this.port) {
+ host += ':' + this.port;
+ }
+ }
+
+ if (this.query && typeof this.query === 'object' &&
+ Object.keys(this.query).length) {
+ query = querystring.stringify(this.query);
+ }
+
+ var search = this.search || (query && ('?' + query)) || '';
+
+ if (protocol && protocol.substr(-1) !== ':') protocol += ':';
+
+ // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
+ // unless they had them to begin with.
+ if (this.slashes ||
+ (!protocol || slashedProtocol[protocol]) && host !== false) {
+ host = '//' + (host || '');
+ if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
+ } else if (!host) {
+ host = '';
+ }
+
+ if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
+ if (search && search.charAt(0) !== '?') search = '?' + search;
+
+ pathname = pathname.replace(/[?#]/g, function(match) {
+ return encodeURIComponent(match);
+ });
+ search = search.replace('#', '%23');
+
+ return protocol + host + pathname + search + hash;
+};
+
+function urlResolve(source, relative) {
+ return urlParse(source, false, true).resolve(relative);
+}
+
+Url.prototype.resolve = function(relative) {
+ return this.resolveObject(urlParse(relative, false, true)).format();
+};
+
+function urlResolveObject(source, relative) {
+ if (!source) return relative;
+ return urlParse(source, false, true).resolveObject(relative);
+}
+
+Url.prototype.resolveObject = function(relative) {
+ if (typeof relative === 'string') {
+ var rel = new Url();
+ rel.parse(relative, false, true);
+ relative = rel;
+ }
+
+ var result = new Url();
+ Object.keys(this).forEach(function(k) {
+ result[k] = this[k];
+ }, this);
+
+ // hash is always overridden, no matter what.
+ // even href="" will remove it.
+ result.hash = relative.hash;
+
+ // if the relative url is empty, then there's nothing left to do here.
+ if (relative.href === '') {
+ result.href = result.format();
+ return result;
+ }
+
+ // hrefs like //foo/bar always cut to the protocol.
+ if (relative.slashes && !relative.protocol) {
+ // take everything except the protocol from relative
+ Object.keys(relative).forEach(function(k) {
+ if (k !== 'protocol')
+ result[k] = relative[k];
+ });
+
+ //urlParse appends trailing / to urls like http://www.example.com
+ if (slashedProtocol[result.protocol] &&
+ result.hostname && !result.pathname) {
+ result.path = result.pathname = '/';
+ }
+
+ result.href = result.format();
+ return result;
+ }
+
+ if (relative.protocol && relative.protocol !== result.protocol) {
+ // if it's a known url protocol, then changing
+ // the protocol does weird things
+ // first, if it's not file:, then we MUST have a host,
+ // and if there was a path
+ // to begin with, then we MUST have a path.
+ // if it is file:, then the host is dropped,
+ // because that's known to be hostless.
+ // anything else is assumed to be absolute.
+ if (!slashedProtocol[relative.protocol]) {
+ Object.keys(relative).forEach(function(k) {
+ result[k] = relative[k];
+ });
+ result.href = result.format();
+ return result;
+ }
+
+ result.protocol = relative.protocol;
+ if (!relative.host && !hostlessProtocol[relative.protocol]) {
+ var relPath = (relative.pathname || '').split('/');
+ while (relPath.length && !(relative.host = relPath.shift()));
+ if (!relative.host) relative.host = '';
+ if (!relative.hostname) relative.hostname = '';
+ if (relPath[0] !== '') relPath.unshift('');
+ if (relPath.length < 2) relPath.unshift('');
+ result.pathname = relPath.join('/');
+ } else {
+ result.pathname = relative.pathname;
+ }
+ result.search = relative.search;
+ result.query = relative.query;
+ result.host = relative.host || '';
+ result.auth = relative.auth;
+ result.hostname = relative.hostname || relative.host;
+ result.port = relative.port;
+ // to support http.request
+ if (result.pathname || result.search) {
+ var p = result.pathname || '';
+ var s = result.search || '';
+ result.path = p + s;
+ }
+ result.slashes = result.slashes || relative.slashes;
+ result.href = result.format();
+ return result;
+ }
+
+ var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
+ isRelAbs = (
+ relative.host ||
+ relative.pathname && relative.pathname.charAt(0) === '/'
+ ),
+ mustEndAbs = (isRelAbs || isSourceAbs ||
+ (result.host && relative.pathname)),
+ removeAllDots = mustEndAbs,
+ srcPath = result.pathname && result.pathname.split('/') || [],
+ relPath = relative.pathname && relative.pathname.split('/') || [],
+ psychotic = result.protocol && !slashedProtocol[result.protocol];
+
+ // if the url is a non-slashed url, then relative
+ // links like ../.. should be able
+ // to crawl up to the hostname, as well. This is strange.
+ // result.protocol has already been set by now.
+ // Later on, put the first path part into the host field.
+ if (psychotic) {
+ result.hostname = '';
+ result.port = null;
+ if (result.host) {
+ if (srcPath[0] === '') srcPath[0] = result.host;
+ else srcPath.unshift(result.host);
+ }
+ result.host = '';
+ if (relative.protocol) {
+ relative.hostname = null;
+ relative.port = null;
+ if (relative.host) {
+ if (relPath[0] === '') relPath[0] = relative.host;
+ else relPath.unshift(relative.host);
+ }
+ relative.host = null;
+ }
+ mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
+ }
+
+ if (isRelAbs) {
+ // it's absolute.
+ result.host = (relative.host || relative.host === '') ?
+ relative.host : result.host;
+ result.hostname = (relative.hostname || relative.hostname === '') ?
+ relative.hostname : result.hostname;
+ result.search = relative.search;
+ result.query = relative.query;
+ srcPath = relPath;
+ // fall through to the dot-handling below.
+ } else if (relPath.length) {
+ // it's relative
+ // throw away the existing file, and take the new path instead.
+ if (!srcPath) srcPath = [];
+ srcPath.pop();
+ srcPath = srcPath.concat(relPath);
+ result.search = relative.search;
+ result.query = relative.query;
+ } else if (relative.search !== null && relative.search !== undefined) {
+ // just pull out the search.
+ // like href='?foo'.
+ // Put this after the other two cases because it simplifies the booleans
+ if (psychotic) {
+ result.hostname = result.host = srcPath.shift();
+ //occationaly the auth can get stuck only in host
+ //this especialy happens in cases like
+ //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
+ var authInHost = result.host && result.host.indexOf('@') > 0 ?
+ result.host.split('@') : false;
+ if (authInHost) {
+ result.auth = authInHost.shift();
+ result.host = result.hostname = authInHost.shift();
+ }
+ }
+ result.search = relative.search;
+ result.query = relative.query;
+ //to support http.request
+ if (result.pathname !== null || result.search !== null) {
+ result.path = (result.pathname ? result.pathname : '') +
+ (result.search ? result.search : '');
+ }
+ result.href = result.format();
+ return result;
+ }
+
+ if (!srcPath.length) {
+ // no path at all. easy.
+ // we've already handled the other stuff above.
+ result.pathname = null;
+ //to support http.request
+ if (result.search) {
+ result.path = '/' + result.search;
+ } else {
+ result.path = null;
+ }
+ result.href = result.format();
+ return result;
+ }
+
+ // if a url ENDs in . or .., then it must get a trailing slash.
+ // however, if it ends in anything else non-slashy,
+ // then it must NOT get a trailing slash.
+ var last = srcPath.slice(-1)[0];
+ var hasTrailingSlash = (
+ (result.host || relative.host) && (last === '.' || last === '..') ||
+ last === '');
+
+ // strip single dots, resolve double dots to parent dir
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = srcPath.length; i >= 0; i--) {
+ last = srcPath[i];
+ if (last == '.') {
+ srcPath.splice(i, 1);
+ } else if (last === '..') {
+ srcPath.splice(i, 1);
+ up++;
+ } else if (up) {
+ srcPath.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (!mustEndAbs && !removeAllDots) {
+ for (; up--; up) {
+ srcPath.unshift('..');
+ }
+ }
+
+ if (mustEndAbs && srcPath[0] !== '' &&
+ (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
+ srcPath.unshift('');
+ }
+
+ if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
+ srcPath.push('');
+ }
+
+ var isAbsolute = srcPath[0] === '' ||
+ (srcPath[0] && srcPath[0].charAt(0) === '/');
+
+ // put the host back
+ if (psychotic) {
+ result.hostname = result.host = isAbsolute ? '' :
+ srcPath.length ? srcPath.shift() : '';
+ //occationaly the auth can get stuck only in host
+ //this especialy happens in cases like
+ //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
+ var authInHost = result.host && result.host.indexOf('@') > 0 ?
+ result.host.split('@') : false;
+ if (authInHost) {
+ result.auth = authInHost.shift();
+ result.host = result.hostname = authInHost.shift();
+ }
+ }
+
+ mustEndAbs = mustEndAbs || (result.host && srcPath.length);
+
+ if (mustEndAbs && !isAbsolute) {
+ srcPath.unshift('');
+ }
+
+ if (!srcPath.length) {
+ result.pathname = null;
+ result.path = null;
+ } else {
+ result.pathname = srcPath.join('/');
+ }
+
+ //to support request.http
+ if (result.pathname !== null || result.search !== null) {
+ result.path = (result.pathname ? result.pathname : '') +
+ (result.search ? result.search : '');
+ }
+ result.auth = relative.auth || result.auth;
+ result.slashes = result.slashes || relative.slashes;
+ result.href = result.format();
+ return result;
+};
+
+Url.prototype.parseHost = function() {
+ var host = this.host;
+ var port = portPattern.exec(host);
+ if (port) {
+ port = port[0];
+ if (port !== ':') {
+ this.port = port.substr(1);
+ }
+ host = host.substr(0, host.length - port.length);
+ }
+ if (host) this.hostname = host;
+};
diff --git a/lib/url_handler/url_handler.js b/lib/url_handler/url_handler.js
new file mode 100644
index 0000000..2e5222b
--- /dev/null
+++ b/lib/url_handler/url_handler.js
@@ -0,0 +1,114 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * url_handler
+ * A module using the url tool from Node.js to perform operations on
+ * urls at various spots (tabs, caching, ...) in the add-on.
+ *
+ */
+
+// node.js url module. Makes it easier to resolve
+// urls in that datauri loaded dom
+var nodeJsUrl = require("url_handler/node_url");
+
+var urlUtils = {
+ getFragment: function (url) {
+ var parse = nodeJsUrl.parse(url);
+ if (parse.hash !== undefined) {
+ return(parse.hash);
+ }
+ },
+
+ removeFragment: function (url) {
+ var parse = nodeJsUrl.parse(url);
+ if (parse.hash !== undefined) {
+ // Amazon track package bug fix.
+ // when url has query string and fragment
+ // the add-on wouldn't remove cache entry
+ // properly.
+ delete parse.hash;
+ }
+ return nodeJsUrl.format(parse);
+ },
+
+ addFragment: function (url, query) {
+ var parse = nodeJsUrl.parse(url);
+
+ // replace hash if it exists.
+ parse.hash = '#' + query;
+
+ return nodeJsUrl.format(parse);
+ },
+
+ addQuery: function (url, query) {
+ var parse = nodeJsUrl.parse(url);
+ console.debug('my parse search', parse.search);
+ if (parse.search === undefined) {
+ parse.search = '?' + query;
+ } else {
+ parse.search = parse.search + '&' + query;
+ console.debug('parse search is now' + parse.search);
+ }
+ return nodeJsUrl.format(parse);
+ },
+
+ getHostname: function (url) {
+ return nodeJsUrl.parse(url).hostname;
+ },
+
+ /**
+ * remove www from hostname.
+ */
+ removeWWW: function (str) {
+ if (str !== undefined) {
+ return str.replace("www.", "", 'i');
+ }
+ return "";
+ },
+
+ /**
+ *
+ * haveSameHostname
+ * Compare that two urls have the same hostname.
+ *
+ */
+ haveSameHostname: function (url1, url2) {
+ try {
+ var host1 = this.removeWWW(this.getHostname(url1)).toLowerCase();
+ var host2 = this.removeWWW(this.getHostname(url2)).toLowerCase();
+ return host1 === host2;
+ } catch (x) {
+ console.debug('error with url_handler', x, x.fileName, x.lineNumber);
+ }
+ }
+};
+
+exports.parse = nodeJsUrl.parse;
+exports.resolve = nodeJsUrl.resolve;
+exports.resolveObject = nodeJsUrl.resolveObject;
+exports.format = nodeJsUrl.format;
+exports.removeFragment = urlUtils.removeFragment;
+exports.addQuery = urlUtils.addQuery;
+exports.getFragment = urlUtils.getFragment;
+exports.addFragment = urlUtils.addFragment;
+exports.getHostname = urlUtils.getHostname;
+exports.haveSameHostname = urlUtils.haveSameHostname;
+exports.removeWWW = urlUtils.removeWWW;
diff --git a/missing b/missing
new file mode 100644
index 0000000..9a55648
--- /dev/null
+++ b/missing
@@ -0,0 +1,330 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2012-01-06.18; # UTC
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try '$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, 'missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file 'aclocal.m4'
+ autoconf touch file 'configure'
+ autoheader touch file 'config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all 'Makefile.in' files
+ bison create 'y.tab.[ch]', if possible, from existing .[ch]
+ flex create 'lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create 'lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ yacc create 'y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running '$TOOL --version' or '$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: '$1' is $msg. You should only need it if
+ you modified 'acinclude.m4' or '${configure_ac}'. You might want
+ to install the Automake and Perl packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: '$1' is $msg. You should only need it if
+ you modified '${configure_ac}'. You might want to install the
+ Autoconf and GNU m4 packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: '$1' is $msg. You should only need it if
+ you modified 'acconfig.h' or '${configure_ac}'. You might want
+ to install the Autoconf and GNU m4 packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: '$1' is $msg. You should only need it if
+ you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
+ You might want to install the Automake and Perl packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: '$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get '$1' as part of Autoconf from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: '$1' $msg. You should only need it if
+ you modified a '.y' file. You may need the Bison package
+ in order for those modifications to take effect. You can get
+ Bison from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG=\${$#}
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: '$1' is $msg. You should only need it if
+ you modified a '.l' file. You may need the Flex package
+ in order for those modifications to take effect. You can get
+ Flex from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG=\${$#}
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: '$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ Help2man package in order for those modifications to take
+ effect. You can get Help2man from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: '$1' is $msg. You should only need it if
+ you modified a '.texi' or '.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy 'make' (AIX,
+ DU, IRIX). You might want to install the Texinfo package or
+ the GNU make package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: '$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the 'README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing '$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..33ce552
--- /dev/null
+++ b/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "librejs",
+ "license": "GPL-3.0+",
+ "author": "Loic J. Duros",
+ "homepage": "gnu.org/software/librejs/",
+ "version": "6.0.8.20150117",
+ "title": "GNU LibreJS",
+ "id": "jid1-KtlZuoiikVfFew@jetpack",
+ "description": "GNU LibreJS is an add-on for Mozilla-based browsers (IceCat, Firefox, Abrowser, Iceweasel)\n that prevents the execution of nonfree nontrivial JavaScript as described in \"The Javascript Trap\": http://www.gnu.org/philosophy/javascript-trap.html",
+ "main": "lib/main",
+ "icon": "data/widget/images/librejs-32.png",
+ "icon64": "data/widget/images/librejs-64.png",
+ "dependencies": [
+ "notification-box",
+ "addon-sdk",
+ "menuitems",
+ "vold-utils"
+ ],
+ "permissions": {
+ "private-browsing": true,
+ "unsafe-content-script": true
+ },
+ "preferences": [
+ {
+ "name": "whitelist",
+ "title": "Whitelist domain, separated by comma, omit protocol, e.g.: gnu.org, wildcard is *",
+ "type": "string",
+ "value": ""
+ },
+ {
+ "name": "complaint_tab",
+ "title": "Display complaint tab on sites where nonfree nontrivial JavaScript is detected",
+ "type": "bool",
+ "value": true
+ },
+ {
+ "name": "display_notifications",
+ "title": "Display notifications of the JavaScript code being analyzed by LibreJS.",
+ "type": "bool",
+ "value": false
+ },
+ {
+ "name": "complaint_email_subject",
+ "title": "Complaint email subject",
+ "description": "Initial subject line used in complaint emails",
+ "type": "string",
+ "value": "Please make your JavaScript free"
+ },
+ {
+ "name": "complaint_email_body",
+ "title": "Complaint email body",
+ "description": "Initial body text used in complaint emails",
+ "type": "string",
+ "value": "I could not use your site because it requires running JavaScript code which is not free software. Since a nonfree program disrespects the user's freedom, I decided not to run it. \\n\\nSee http://gnu.org/philosophy/javascript-trap.html for more information, and please make your JavaScript code free."
+ }
+ ],
+ "scripts": {
+ "pretest": "jshint ./lib/ ./data/ --exclude ./data/settings/third-party/",
+ "test": "cfx test -v"
+ },
+ "jscsConfig": {
+ "preset": "google",
+ "validateIndentation": 4
+ },
+ "jshintConfig": {
+ "moz": true
+ }
+}
diff --git a/packages/menuitems/README.md b/packages/menuitems/README.md
new file mode 100644
index 0000000..12a6954
--- /dev/null
+++ b/packages/menuitems/README.md
@@ -0,0 +1,3 @@
+# Menuitems Package for Jetpack Add-ons
+
+
diff --git a/packages/menuitems/docs/menuitems.md b/packages/menuitems/docs/menuitems.md
new file mode 100644
index 0000000..2017c9c
--- /dev/null
+++ b/packages/menuitems/docs/menuitems.md
@@ -0,0 +1,66 @@
+<!-- contributed by Erik Vold [erikvvold@gmail.com] -->
+
+
+The `menuitems` API is a simple way to create
+[Menuitems](https://developer.mozilla.org/en/XUL/PopupGuide/MenuItems), which
+can perform an action when clicked, and display state.
+
+## Example ##
+
+ exports.main = function(options) {
+ // create menuitem for the File menu,
+ // and insert it before the 'Quit' menuitem
+ require("menuitems").Menuitem({
+ id: "myextprefix-some-mi-id",
+ menuid: "menu_FilePopup",
+ insertbefore: "menu_FileQuitItem",
+ "label": _("label"),
+ "accesskey": _("label.ak"),
+ image: self.data.url("icon.png"),
+ className: 'pizazz',
+ disabled: false,
+ checked: false,
+ onCommand: function() {
+ // do something
+ }
+ });
+ };
+
+<api name="Menuitem">
+@class
+
+Module exports `Menuitem` constructor allowing users to create a
+[`menuitem`](https://developer.mozilla.org/en/XUL/menuitem).
+
+<api name="Menuitem">
+@constructor
+Creates a `menuitem`.
+
+@param options {Object}
+ Options for the `menuitem`, with the following parameters:
+
+@prop id {String}
+A id for the `menuitem`, this should be namespaced.
+
+@prop menuid {String}
+The id of the parent `<menu>` node.
+
+@prop label {String}
+A label for the `menuitem`.
+
+@prop image {String}
+A image url for the `menuitem`.
+
+@prop className {String}
+A default space delimited list of class names for the menuitem.
+
+@prop disabled {Boolean}
+When a menuitem is disabled it cannot be used, but is still displayed.
+
+@prop checked {Boolean}
+Displays a check beside the menuitem.
+
+@prop [onCommand] {Function}
+ A option function that is invoked when the `menuitem` is executed.
+</api>
+</api>
diff --git a/packages/menuitems/lib/menuitems.js b/packages/menuitems/lib/menuitems.js
new file mode 100644
index 0000000..075d690
--- /dev/null
+++ b/packages/menuitems/lib/menuitems.js
@@ -0,0 +1,195 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+const windowUtils = require("sdk/deprecated/window-utils");
+const { Class } = require("sdk/core/heritage");
+const { validateOptions } = require("sdk/deprecated/api-utils");
+const { on, emit, once, off } = require("sdk/event/core");
+const { isBrowser } = require("sdk/window/utils");
+const { EventTarget } = require('sdk/event/target');
+const { unload } = require("unload+");
+
+const menuitemNS = require("sdk/core/namespace").ns();
+const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+function MenuitemOptions(options) {
+ return validateOptions(options, {
+ id: { is: ['string'] },
+ menuid: { is: ['undefined', 'string'] },
+ insertbefore: { is: ['undefined', 'string', 'object'] },
+ label: { is: ["string"] },
+ disabled: { is: ["undefined", "boolean"], map: function(v) !!v},
+ accesskey: { is: ["undefined", "string"] },
+ key: { is: ["undefined", "string"] },
+ checked: { is: ['undefined', 'boolean'] },
+ className: { is: ["undefined", "string"] },
+ onCommand: { is: ['undefined', 'function'] }
+ });
+}
+
+let Menuitem = Class({
+ extends: EventTarget,
+ initialize: function(options) {
+ options = menuitemNS(this).options = MenuitemOptions(options);
+ EventTarget.prototype.initialize.call(this, options);
+
+ menuitemNS(this).destroyed = false;
+ menuitemNS(this).unloaders = [];
+ menuitemNS(this).menuitems = addMenuitems(this, options).menuitems;
+ },
+ get id() menuitemNS(this).options.id,
+ get label() menuitemNS(this).options.label,
+ set label(val) updateProperty(this, 'label', val),
+ get checked() menuitemNS(this).options.checked,
+ set checked(val) updateProperty(this, 'checked', !!val),
+ get disabled() menuitemNS(this).options.disabled,
+ set disabled(val) updateProperty(this, 'disabled', !!val),
+ get key() menuitemNS(this).options.key,
+ set key(val) updateProperty(this, 'key', val),
+ clone: function (overwrites) {
+ let opts = Object.clone(menuitemNS(this).options);
+ for (let key in overwrites) {
+ opts[key] = ovrewrites[key];
+ }
+ return Menuitem(opts);
+ },
+ get menuid() menuitemNS(this).options.menuid,
+ set menuid(val) {
+ let options = menuitemNS(this).options;
+ options.menuid = val;
+
+ forEachMI(function(menuitem, i, $) {
+ updateMenuitemParent(menuitem, options, $);
+ });
+ },
+ destroy: function() {
+ if (!menuitemNS(this).destroyed) {
+ menuitemNS(this).destroyed = true;
+ menuitemNS(this).unloaders.forEach(function(u) u());
+ menuitemNS(this).unloaders = null;
+ menuitemNS(this).menuitems = null;
+ }
+ return true;
+ }
+});
+
+function addMenuitems(self, options) {
+ let menuitems = [];
+
+ // setup window tracker
+ windowUtils.WindowTracker({
+ onTrack: function (window) {
+ if (!isBrowser(window) || menuitemNS(self).destroyed) return;
+
+ // add the new menuitem to a menu
+ var menuitem = updateMenuitemAttributes(
+ window.document.createElementNS(NS_XUL, "menuitem"), options);
+ var menuitems_i = menuitems.push(menuitem) - 1;
+
+ // add the menutiem to the ui
+ updateMenuitemParent(menuitem, options, function(id) window.document.getElementById(id));
+
+ menuitem.addEventListener("command", function() {
+ if (!self.disabled)
+ emit(self, 'command');
+ }, true);
+
+ // add unloader
+ let unloader = function unloader() {
+ menuitem.parentNode && menuitem.parentNode.removeChild(menuitem);
+ menuitems[menuitems_i] = null;
+ };
+ menuitemNS(self).unloaders.push(function() {
+ remover();
+ unloader();
+ });
+ let remover = unload(unloader, window);
+ }
+ });
+ return {menuitems: menuitems};
+}
+
+function updateMenuitemParent(menuitem, options, $) {
+ // add the menutiem to the ui
+ if (Array.isArray(options.menuid)) {
+ let ids = options.menuid;
+ for (var len = ids.length, i = 0; i < len; i++) {
+ if (tryParent($(ids[i]), menuitem, options.insertbefore))
+ return true;
+ }
+ }
+ else {
+ return tryParent($(options.menuid), menuitem, options.insertbefore);
+ }
+ return false;
+}
+
+function updateMenuitemAttributes(menuitem, options) {
+ menuitem.setAttribute("id", options.id);
+ menuitem.setAttribute("label", options.label);
+
+ if (options.accesskey)
+ menuitem.setAttribute("accesskey", options.accesskey);
+
+ if (options.key)
+ menuitem.setAttribute("key", options.key);
+
+ menuitem.setAttribute("disabled", !!options.disabled);
+
+ if (options.image) {
+ menuitem.classList.add("menuitem-iconic");
+ menuitem.style.listStyleImage = "url('" + options.image + "')";
+ }
+
+ if (options.checked)
+ menuitem.setAttribute('checked', options.checked);
+
+ if (options.className)
+ options.className.split(/\s+/).forEach(function(name) menuitem.classList.add(name));
+
+ return menuitem;
+}
+
+function updateProperty(menuitem, key, val) {
+ menuitemNS(menuitem).options[key] = val;
+
+ forEachMI(function(menuitem) {
+ menuitem.setAttribute(key, val);
+ }, menuitem);
+ return val;
+}
+
+function forEachMI(callback, menuitem) {
+ menuitemNS(menuitem).menuitems.forEach(function(mi, i) {
+ if (!mi) return;
+ callback(mi, i, function(id) mi.ownerDocument.getElementById(id));
+ });
+}
+
+function tryParent(parent, menuitem, before) {
+ if (parent) parent.insertBefore(menuitem, insertBefore(parent, before));
+ return !!parent;
+}
+
+function insertBefore(parent, insertBefore) {
+ if (typeof insertBefore == "number") {
+ switch (insertBefore) {
+ case MenuitemExport.FIRST_CHILD:
+ return parent.firstChild;
+ }
+ return null;
+ }
+ else if (typeof insertBefore == "string") {
+ return parent.querySelector("#" + insertBefore);
+ }
+ return insertBefore;
+}
+
+function MenuitemExport(options) {
+ return Menuitem(options);
+}
+MenuitemExport.FIRST_CHILD = 1;
+
+exports.Menuitem = MenuitemExport;
diff --git a/packages/menuitems/package.json b/packages/menuitems/package.json
new file mode 100644
index 0000000..95b1ede
--- /dev/null
+++ b/packages/menuitems/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "menuitems",
+ "description": "Menuitems for Jetpacks",
+ "keywords": ["menu", "menuitems", "button", "ui"],
+ "author": "Erik Vold (http://erikvold.com/) <erikvvold@gmail.com>",
+ "version": "1.1.1",
+ "license": "MPL 2.0",
+ "dependencies": ["api-utils", "vold-utils"]
+}
diff --git a/packages/menuitems/tests/test-menuitems.js b/packages/menuitems/tests/test-menuitems.js
new file mode 100644
index 0000000..191bb44
--- /dev/null
+++ b/packages/menuitems/tests/test-menuitems.js
@@ -0,0 +1,171 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+'use strict'
+
+const windowUtils = require("window-utils");
+const menuitems = require("menuitems");
+
+let window = windowUtils.activeBrowserWindow;
+let document = window.document;
+function $(id) document.getElementById(id);
+
+function createMI(options, test) {
+ test.assertEqual(!$(options.id), true);
+ var mi = new menuitems.Menuitem(options);
+ return mi;
+}
+
+exports.testMIDoesNotExist = function(test) {
+ var options = {
+ id: "test-mi-dne",
+ label: "test"
+ };
+ createMI(options, test);
+ test.assertEqual(!!$(options.id), false, 'menuitem does not exists');
+};
+
+exports.testMIDoesExist = function(test) {
+ var options = {
+ id: "test-mi-exists",
+ label: "test",
+ menuid: 'menu_FilePopup'
+ };
+ let mi = createMI(options, test);
+ let menuitem = $(options.id);
+ test.assertEqual(!!menuitem, true, 'menuitem exists');
+ test.assertEqual(menuitem.id, options.id, 'menuitem id is ok');
+ test.assertEqual(menuitem.getAttribute('label'), options.label, 'menuitem label is ok');
+ test.assertEqual(menuitem.parentNode.id, options.menuid, 'in the file menu');
+ test.assertEqual(menuitem.getAttribute('disabled'), 'false', 'menuitem not disabled');
+ test.assertEqual(menuitem.getAttribute('accesskey'), '', 'menuitem accesskey is ok');
+ test.assertEqual(menuitem.getAttribute('class'), '', 'menuitem class is ok');
+ test.assertEqual(menuitem.nextSibling, undefined, 'menuitem is last');
+ test.assertEqual(menuitem.hasAttribute("checked"), false, 'menuitem not checked');
+ mi.destroy();
+ test.assert(!$(options.id), 'menuitem is gone');
+ test.assertEqual(menuitem.parentNode, null, 'menuitem has no parent');
+};
+
+exports.testMIOnClick = function(test) {
+ test.waitUntilDone();
+
+ let options = {
+ id: "test-mi-onclick",
+ label: "test",
+ menuid: 'menu_FilePopup',
+ onCommand: function() {
+ mi.destroy();
+ test.pass('onCommand worked!');
+ test.done();
+ }
+ };
+
+ let e = document.createEvent("UIEvents");
+ e.initUIEvent("command", true, true, window, 1);
+
+ var mi = createMI(options, test);
+ let menuitem = $(options.id);
+ test.assertEqual(!!menuitem, true, 'menuitem exists');
+ menuitem.dispatchEvent(e);
+};
+
+exports.testMIDisabled = function(test) {
+ test.waitUntilDone();
+
+ let commandIsOK = false;
+ let count = 0;
+ let options = {
+ id: "test-mi-disabled",
+ label: "test",
+ disabled: true,
+ menuid: 'menu_FilePopup',
+ onCommand: function() {
+ count++;
+ if (!commandIsOK) {
+ test.fail('onCommand was called, that is not ok');
+ return;
+ }
+
+ mi.destroy();
+ test.assertEqual(count, 1, 'onCommand was called the correct number of times!');
+ test.done();
+ }
+ };
+
+ let e = document.createEvent("UIEvents");
+ e.initUIEvent("command", true, true, window, 1);
+
+ var mi = createMI(options, test);
+ let menuitem = $(options.id);
+ test.assertEqual(!!menuitem, true, 'menuitem exists');
+ test.assertEqual(menuitem.getAttribute('disabled'), 'true', 'menuitem not disabled');
+ menuitem.dispatchEvent(e);
+ mi.disabled = false;
+ test.assertEqual(menuitem.getAttribute('disabled'), 'false', 'menuitem not disabled');
+ commandIsOK = true;
+ menuitem.dispatchEvent(e);
+};
+
+exports.testMIChecked = function(test) {
+ let options = {
+ id: "test-mi-checked",
+ label: "test",
+ disabled: true,
+ menuid: 'menu_FilePopup',
+ checked: true
+ };
+
+ let mi = createMI(options, test);
+ let menuitem = $(options.id);
+ test.assertEqual(!!menuitem, true, 'menuitem exists');
+ test.assertEqual(menuitem.getAttribute("checked"), "true", 'menuitem checked');
+ mi.checked = false;
+ test.assertEqual(menuitem.getAttribute("checked"), "false", 'menuitem checked');
+ mi.destroy();
+};
+
+exports.testMIClass = function(test) {
+ let options = {
+ id: "test-mi-class",
+ label: "pizazz",
+ className: "pizazz",
+ menuid: 'menu_FilePopup',
+ };
+
+ var mi = createMI(options, test);
+ let menuitem = $(options.id);
+ test.assertEqual(!!menuitem, true, 'menuitem exists');
+ test.assertEqual(menuitem.getAttribute('class'), 'pizazz', 'menuitem not disabled');
+ mi.destroy();
+};
+
+exports.testInsertBeforeExists = function(test) {
+ let options = {
+ id: 'test-mi-insertbefore',
+ label: 'insertbefore',
+ insertbefore:'menu_FileQuitItem',
+ menuid: 'menu_FilePopup',
+ };
+
+ var mi = createMI(options, test);
+ let menuitem = $(options.id);
+ test.assertEqual(!!menuitem, true, 'menuitem exists');
+ test.assertEqual(menuitem.nextSibling, $('menu_FileQuitItem'), 'menuitem not disabled');
+ mi.destroy();
+};
+
+exports.testInsertBeforeDoesNotExist = function(test) {
+ let options = {
+ id: 'test-mi-insertbefore',
+ label: 'insertbefore',
+ insertbefore:'menu_ZZZDNE',
+ menuid: 'menu_FilePopup',
+ };
+
+ var mi = createMI(options, test);
+ let menuitem = $(options.id);
+ test.assertEqual(!!menuitem, true, 'menuitem exists');
+ test.assertEqual(menuitem.nextSibling, null, 'menuitem not disabled');
+ mi.destroy();
+};
diff --git a/packages/notificationbox/LICENSE b/packages/notificationbox/LICENSE
new file mode 100644
index 0000000..14e2f77
--- /dev/null
+++ b/packages/notificationbox/LICENSE
@@ -0,0 +1,373 @@
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
diff --git a/packages/notificationbox/README.md b/packages/notificationbox/README.md
new file mode 100644
index 0000000..df41739
--- /dev/null
+++ b/packages/notificationbox/README.md
@@ -0,0 +1,5 @@
+NotificationBox implements some of the notificationbox element functionality in Firefox and Mozilla-based browsers using the Addon SDK. For any question or feedback please email lduros--at--member.fsf.org
+
+It is released under the MPL 2.0.
+
+See [doc/main.md](https://github.com/lduros/notificationbox/blob/master/doc/main.md)for more information.
diff --git a/packages/notificationbox/data/gnu-icon.png b/packages/notificationbox/data/gnu-icon.png
new file mode 100644
index 0000000..2005027
--- /dev/null
+++ b/packages/notificationbox/data/gnu-icon.png
Binary files differ
diff --git a/packages/notificationbox/doc/images/critical-notification.png b/packages/notificationbox/doc/images/critical-notification.png
new file mode 100644
index 0000000..6e69b22
--- /dev/null
+++ b/packages/notificationbox/doc/images/critical-notification.png
Binary files differ
diff --git a/packages/notificationbox/doc/images/info-low-priority.png b/packages/notificationbox/doc/images/info-low-priority.png
new file mode 100644
index 0000000..6fff9f6
--- /dev/null
+++ b/packages/notificationbox/doc/images/info-low-priority.png
Binary files differ
diff --git a/packages/notificationbox/doc/main.md b/packages/notificationbox/doc/main.md
new file mode 100644
index 0000000..2c28c3a
--- /dev/null
+++ b/packages/notificationbox/doc/main.md
@@ -0,0 +1,46 @@
+NotificationBox implements some of the notificationbox element functionality in Firefox and Mozilla-based browsers using the Addon SDK. For any question or feedback please email lduros--at--member.fsf.org
+
+You can create a notification as follows:
+```javascript
+var self = require("self");
+var notification = require("notification-box").NotificationBox({
+ 'value': 'important-message',
+ 'label': 'This is a very important message!',
+ 'priority': 'CRITICAL_BLOCK',
+ 'image': self.data.url("gnu-icon.png"),
+ 'buttons': [{'label': "Do something about it!",
+ 'onClick': function () { console.log("You clicked the important button!"); }}]
+});
+```
+
+It implements the following options:
+
+ - value: value used to identify the notification
+ - label: label to appear on the notification
+ - image: URL of image to appear on the notification. You can also
+ load a local image from the data folder, like in the example
+ - priority: notification priority. Use one of the following:
+ - INFO_LOW
+ - INFO_MEDIUM
+ - INFO_HIGH
+ - WARNING_LOW
+ - WARNING_MEDIUM
+ - WARNING_HIGH
+ - CRITICAL_LOW
+ - CRITICAL_MEDIUM
+ - CRITICAL_HIGH
+ - CRITICAL_BLOCK
+ - buttons: array of buttons to appear on the notification.
+ You can use the following options:
+ - accessKey: the accesskey to appear on the button
+ - onClick: the callback function to trigger when button is activated.
+ - label: the text to display on the button
+
+
+Here is an overview of what the example above with the critical notification looks like:
+![The Critical notification](https://raw.github.com/lduros/notificationbox/master/doc/images/critical-notification.png)
+
+When using 'INFO_LOW' for the priority instead, you would see:
+![Info Low notification](https://raw.github.com/lduros/notificationbox/master/doc/images/info-low-priority.png)
+
+For more information on notificationbox: https://developer.mozilla.org/en-US/docs/XUL/notificationbox
diff --git a/packages/notificationbox/lib/main.js b/packages/notificationbox/lib/main.js
new file mode 100644
index 0000000..0d17404
--- /dev/null
+++ b/packages/notificationbox/lib/main.js
@@ -0,0 +1,16 @@
+/*
+ * Copyrights Loic J. Duros 2012
+ * lduros@member.fsf.org
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var self = require("sdk/self");
+var notification = require("notification-box").NotificationBox({
+ 'value': 'important-message',
+ 'label': 'You have been warned...',
+ 'priority': 'WARNING_HIGH',
+ 'image': self.data.url("gnu-icon.png"),
+ 'buttons': [{'label': "Gotcha",
+ 'onClick': function () { console.log("You clicked the important button!"); }}]
+});
diff --git a/packages/notificationbox/lib/notification-box.js b/packages/notificationbox/lib/notification-box.js
new file mode 100644
index 0000000..94b26cd
--- /dev/null
+++ b/packages/notificationbox/lib/notification-box.js
@@ -0,0 +1,129 @@
+/*
+ * Copyrights Loic J. Duros 2012
+ * lduros@member.fsf.org
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+const { Cc, Ci } = require("chrome");
+const { getMostRecentBrowserWindow } = require('sdk/window/utils');
+/* I haven't found this sort of validation functions in the SDK,
+except for the deprecated api-utils module. */
+let isString = function (str) {
+ return typeof(str) == 'string' || str instanceof String;
+};
+
+let isArray = function (obj) {
+ return Object.prototype.toString.call(obj) === '[object Array]';
+};
+
+exports.NotificationBox = function (options) {
+ options = options || {};
+ let mainWindow = getWindow();
+ let nb = mainWindow.gBrowser.getNotificationBox();
+ let notification, priority, label, image, value, buttons = [];
+
+ if (options.value && isString(options.value)) {
+ notification = nb.getNotificationWithValue(options.value);
+ value = options.value;
+ }
+ else {
+ notification = nb.getNotificationWithValue('');
+ value = '';
+ }
+
+ // Add label or create empty notification.
+ if (options.label && isString(options.label))
+ label = options.label;
+ else
+ label = "";
+
+ // Set priority of the notification (from info low, to critical
+ // block.
+ if (options.priority && options.priority in PRIORITY)
+ priority = nb[PRIORITY[options.priority]];
+ else
+ priority = nb[PRIORITY.INFO_LOW];
+
+ // Set a custom icon for the notification or use the regular info
+ // icon.
+ if (options.image && isString(options.image))
+ image = options.image;
+ else
+ image = 'chrome://browser/skin/Info.png';
+
+ // Add buttons.
+ if (isArray(options.buttons)) {
+ for (let i = 0, length = options.buttons.length; i < length; i++) {
+ buttons.push(NotificationButton(options.buttons[i]));
+ }
+ }
+ else if (typeof(options.buttons) === 'object') {
+ // If it's not an array of buttons, then it should be a single button.
+ buttons.push(NotificationButton(options.buttons));
+ }
+ else {
+ buttons = null;
+ }
+
+ // add new notification to notificationbox.
+ nb.appendNotification(label, value,
+ image,
+ priority, buttons);
+
+ return {'notificationbox': nb, 'notification': notification};
+};
+
+
+
+var NotificationButton = function (options) {
+
+ options = options || {};
+ let accessKey, onClick, label, popup;
+
+ if (options.accessKey)
+ accessKey = options.accessKey;
+ else
+ accessKey = '';
+
+ if (options.onClick)
+ onClick = options.onClick;
+ else
+ onClick = function () {};
+
+ if (options.label)
+ label = options.label;
+ else
+ label = "";
+
+ // no popup for now... maybe we can use a panel later.
+ popup = null;
+
+ return {label: label,
+ accessKey: accessKey,
+ callback: onClick,
+ popup: popup};
+
+};
+
+const PRIORITY = {
+ 'INFO_LOW': 'PRIORITY_INFO_LOW',
+ 'INFO_MEDIUM': 'PRIORITY_INFO_MEDIUM',
+ 'INFO_HIGH': 'PRIORITY_INFO_HIGH',
+ 'WARNING_LOW': 'PRIORITY_WARNING_LOW',
+ 'WARNING_MEDIUM': 'PRIORITY_WARNING_MEDIUM',
+ 'WARNING_HIGH': 'PRIORITY_WARNING_HIGH',
+ 'CRITICAL_LOW': 'PRIORITY_CRITICAL_LOW',
+ 'CRITICAL_MEDIUM': 'PRIORITY_CRITICAL_MEDIUM',
+ 'CRITICAL_HIGH': 'PRIORITY_CRITICAL_HIGH',
+ 'CRITICAL_BLOCK': 'PRIORITY_CRITICAL_BLOCK'
+};
+
+let getWindow = function () {
+ return getMostRecentBrowserWindow();
+};
+
+exports.PRIORITY = PRIORITY;
+
diff --git a/packages/notificationbox/package.json b/packages/notificationbox/package.json
new file mode 100644
index 0000000..57ce0bb
--- /dev/null
+++ b/packages/notificationbox/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "notification-box",
+ "license": "MPL 2.0",
+ "author": "",
+ "version": "0.1",
+ "fullName": "notification-box",
+ "id": "jid1-dyFGGJB0CjoDMA",
+ "description": "a basic add-on"
+}
diff --git a/packages/notificationbox/test/test-main.js b/packages/notificationbox/test/test-main.js
new file mode 100644
index 0000000..9e7031a
--- /dev/null
+++ b/packages/notificationbox/test/test-main.js
@@ -0,0 +1,12 @@
+var main = require("main");
+
+exports["test main"] = function(assert) {
+ assert.pass("Unit test running!");
+};
+
+exports["test main async"] = function(assert, done) {
+ assert.pass("async Unit test running!");
+ done();
+};
+
+require("test").run(exports);
diff --git a/packages/vold-utils/README.md b/packages/vold-utils/README.md
new file mode 100644
index 0000000..41773e3
--- /dev/null
+++ b/packages/vold-utils/README.md
@@ -0,0 +1,5 @@
+# Vold Utils for Mozilla's Add-on SDK
+
+A collection of various modules which help build other apis.
+
+
diff --git a/packages/vold-utils/docs/listen.md b/packages/vold-utils/docs/listen.md
new file mode 100644
index 0000000..d19c6c6
--- /dev/null
+++ b/packages/vold-utils/docs/listen.md
@@ -0,0 +1,23 @@
+<!-- contributed by Erik Vold [erikvvold@gmail.com] -->
+
+The `listen` module allows modules to register listeners to elements that are
+automatically removed when the module unloads.
+
+<api name="listen">
+@function
+ Add listeners to run when unloading in a unload queue. Optionally scope the
+ callback to a container, e.g., window. Provide a way to run all the callbacks.
+
+@param container {object}
+ A container for the node, which a "unload" event will be attached to, this is
+ used to cancel the unload magic that would occur, to avoid memory leaks.
+@param node {object}
+ The node to listen to.
+@param event {string}
+ The event type, for example: "load", "click", ...
+@param callback {function}
+ A function to be called when the event occurs on the node.
+@param [capture] {boolean}
+ Indicates if the event should be captured. [See the `useCapture`
+ documentation here](https://developer.mozilla.org/en/DOM/element.addEventListener).
+</api>
diff --git a/packages/vold-utils/docs/unload+.md b/packages/vold-utils/docs/unload+.md
new file mode 100644
index 0000000..78693ef
--- /dev/null
+++ b/packages/vold-utils/docs/unload+.md
@@ -0,0 +1,20 @@
+<!-- contributed by Erik Vold [erikvvold@gmail.com] -->
+
+The `unload+` module allows modules to register callbacks that are called
+when they are unloaded, and associate unload functions to containers to have the
+unloader automatically deleted when the container unloads.
+
+<api name="unload">
+@function
+ Save callbacks to run when unloading in a unload queue. Optionally scope the
+ callback to a container, e.g., window. Provide a way to run all the callbacks.
+
+@param callback {function}
+ A function to be called when the module unloads.
+@param [container] {object}
+ Optional container object; if the container "unloads" before the module
+ unloads, then the associated callback is removed from the unload queue.
+@returns {function}
+ Returns a function which will allow one to remove the callback from the unload
+ queue.
+</api>
diff --git a/packages/vold-utils/lib/array.js b/packages/vold-utils/lib/array.js
new file mode 100644
index 0000000..5ac0577
--- /dev/null
+++ b/packages/vold-utils/lib/array.js
@@ -0,0 +1,6 @@
+'use strict';
+
+function run(array) array.forEach(function(f) f());
+exports.run = run;
+
+
diff --git a/packages/vold-utils/lib/instances.js b/packages/vold-utils/lib/instances.js
new file mode 100644
index 0000000..a33ca40
--- /dev/null
+++ b/packages/vold-utils/lib/instances.js
@@ -0,0 +1,57 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MIT/X11 License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributor(s):
+ * Erik Vold <erikvvold@gmail.com> (Original Author)
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const {Cc, Ci, Cu} = require("chrome");
+
+var Instances = exports.Instances = {
+ get bis() Cc["@mozilla.org/binaryinputstream;1"]
+ .createInstance(Ci.nsIBinaryInputStream),
+ get ch() Cc["@mozilla.org/security/hash;1"]
+ .createInstance(Ci.nsICryptoHash),
+ get dp() Cc["@mozilla.org/xmlextras/domparser;1"]
+ .createInstance(Ci.nsIDOMParser),
+ get ds() Cc["@mozilla.org/xmlextras/xmlserializer;1"]
+ .createInstance(Ci.nsIDOMSerializer),
+ get fos() Cc["@mozilla.org/network/file-output-stream;1"]
+ .createInstance(Ci.nsIFileOutputStream),
+ get sfos() Cc["@mozilla.org/network/safe-file-output-stream;1"]
+ .createInstance(Ci.nsIFileOutputStream)
+ .QueryInterface(Ci.nsISafeOutputStream),
+ get fp() Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker),
+ get lf() Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile),
+ get process() Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess),
+ get se() Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError)
+ .QueryInterface(Ci.nsIScriptError2),
+ get ss() Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString),
+ get suc() Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Ci.nsIScriptableUnicodeConverter),
+ get timer() Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
+ get wbp() Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(Ci.nsIWebBrowserPersist),
+ get xhr() Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
+ .createInstance(Ci.nsIXMLHttpRequest)
+};
diff --git a/packages/vold-utils/lib/listen.js b/packages/vold-utils/lib/listen.js
new file mode 100644
index 0000000..0b947d1
--- /dev/null
+++ b/packages/vold-utils/lib/listen.js
@@ -0,0 +1,29 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+const { unload, Unload } = require("unload+");
+
+/**
+ * Helper that adds event listeners and remembers to remove on unload
+ */
+function listen(window, node, event, func, capture) {
+ // Default to use capture
+ if (capture == null)
+ capture = true;
+
+ node.addEventListener(event, func, capture);
+ function undoListen() {
+ node.removeEventListener(event, func, capture);
+ }
+
+ // Undo the listener on unload and provide a way to undo everything
+ let undoUnload = unload(undoListen, window);
+ return function() {
+ undoListen();
+ undoUnload();
+ };
+}
+exports.listen = listen;
+
diff --git a/packages/vold-utils/lib/memoize.js b/packages/vold-utils/lib/memoize.js
new file mode 100644
index 0000000..73bb4fc
--- /dev/null
+++ b/packages/vold-utils/lib/memoize.js
@@ -0,0 +1,131 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MIT/X11 License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributor(s):
+ * Nils Maier <MaierMan@web.de>
+ * Erik Vold <erikvvold@gmail.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+"use strict";
+
+/**
+ * Decorate a function with a memoization wrapper, with a limited-size cache
+ * to reduce peak memory utilization.
+ *
+ * The memoized function may have any number of arguments, but they must be
+ * be serializable. It's safest to use this only on functions that accept
+ * primitives.
+ *
+ * A memoized function is not thread-safe, but so is JS, nor re-entrant-safe!
+ *
+ * @usage var foo = Scriptish_memoize(function foo(arg1, arg2) { ... complex operation ... });
+ * @param {Function} func The function to be memoized
+ * @param {Number} limit Optional. Cache size (default: 100)
+ * @param {Number} num_args Options. Number of arguments the function expects (default: func.length)
+ * @return {Function} Memoized function
+ */
+exports.memoize = function memoize(func, limit, num_args) {
+ limit = limit || 100;
+ num_args = num_args || func.length;
+
+ var cache = Object.create(null);
+ var keylist = [];
+ var args = [];
+ var key, result;
+
+ switch (num_args) {
+ case 0:
+ throw new Error("memoize does not support functions without arguments");
+ case 1:
+ return function memoize_one_arg(a) {
+ key = a.toString();
+
+ if (key in cache)
+ return cache[key];
+
+ result = func.call(null, a);
+ cache[key] = result;
+ if (keylist.push(key) > limit)
+ delete cache[keylist.shift()];
+ return result;
+ };
+ case 2:
+ return function memoize_two_args(a, b) {
+ args[0] = a; args[1] = b;
+ key = JSON.stringify(args);
+ args.length = 0;
+
+ if (key in cache)
+ return cache[key];
+
+ var result = func.call(null, a, b);
+ cache[key] = result;
+ if (keylist.push(key) > limit)
+ delete cache[keylist.shift()];
+ return result;
+ };
+ case 3:
+ return function memoize_three_args(a, b, c) {
+ args[0] = a; args[1] = b; args[2] = c;
+ key = JSON.stringify(args);
+ args.length = 0;
+
+ if (key in cache)
+ return cache[key];
+
+ var result = func.call(null, a, b, c);
+ cache[key] = result;
+ if (keylist.push(key) > limit)
+ delete cache[keylist.shift()];
+ return result;
+ };
+
+ case 4:
+ return function memoize_four_args(a, b, c, d) {
+ args[0] = a; args[1] = b; args[2] = c; args[3] = d;
+ key = JSON.stringify(args);
+ args.length = 0;
+
+ if (key in cache)
+ return cache[key];
+
+ var result = func.call(null, a, b, c, d);
+ cache[key] = result;
+ if (keylist.push(key) > limit)
+ delete cache[keylist.shift()];
+ return result;
+ };
+
+ default:
+ return function() {
+ var key = JSON.stringify(arguments);
+ if (key in cache)
+ return cache[key];
+
+ var result = func.apply(null, arguments);
+ cache[key] = result;
+ if (keylist.push(key) > limit)
+ delete cache[keylist.shift()];
+ return result;
+ };
+ }
+}
diff --git a/packages/vold-utils/lib/net-utils.js b/packages/vold-utils/lib/net-utils.js
new file mode 100644
index 0000000..df7f300
--- /dev/null
+++ b/packages/vold-utils/lib/net-utils.js
@@ -0,0 +1,3 @@
+
+require("chrome").Cu.import("resource://gre/modules/NetUtil.jsm", this);
+exports.NetUtil = NetUtil;
diff --git a/packages/vold-utils/lib/services.js b/packages/vold-utils/lib/services.js
new file mode 100644
index 0000000..4854dfa
--- /dev/null
+++ b/packages/vold-utils/lib/services.js
@@ -0,0 +1,84 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MIT/X11 License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributor(s):
+ * Erik Vold <erikvvold@gmail.com> (Original Author)
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const {Cc, Ci, Cu} = require("chrome");
+Cu.import("resource://gre/modules/Services.jsm", this);
+
+const global = this;
+var Services = exports.Services = {};
+(function(inc, tools){
+ inc("resource://gre/modules/XPCOMUtils.jsm", global);
+ inc("resource://gre/modules/Services.jsm", tools);
+ Services.__proto__ = tools.Services;
+})(Cu.import, {});
+
+/*
+XPCOMUtils.defineLazyGetter(Services, "scriptish", function() (
+ Cc["@scriptish.erikvold.com/scriptish-service;1"]
+ .getService().wrappedJSObject));
+*/
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "as", "@mozilla.org/alerts-service;1", "nsIAlertsService");
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "ass", "@mozilla.org/appshell/appShellService;1",
+ "nsIAppShellService");
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "cb", "@mozilla.org/widget/clipboardhelper;1",
+ "nsIClipboardHelper");
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "cs", "@mozilla.org/consoleservice;1", "nsIConsoleService");
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "eps", "@mozilla.org/uriloader/external-protocol-service;1",
+ "nsIExternalProtocolService");
+
+if (Cc["@mozilla.org/privatebrowsing;1"]) {
+ XPCOMUtils.defineLazyServiceGetter(
+ Services, "pbs", "@mozilla.org/privatebrowsing;1",
+ "nsIPrivateBrowsingService");
+} else {
+ Services.pbs = {privateBrowsingEnabled: false};
+}
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "sis", "@mozilla.org/scriptableinputstream;1",
+ "nsIScriptableInputStream");
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "suhtml", "@mozilla.org/feed-unescapehtml;1",
+ "nsIScriptableUnescapeHTML");
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "tld", "@mozilla.org/network/effective-tld-service;1",
+ "nsIEffectiveTLDService");
+
+XPCOMUtils.defineLazyServiceGetter(
+ Services, "uuid", "@mozilla.org/uuid-generator;1",
+ "nsIUUIDGenerator");
diff --git a/packages/vold-utils/lib/unload+.js b/packages/vold-utils/lib/unload+.js
new file mode 100644
index 0000000..285fd46
--- /dev/null
+++ b/packages/vold-utils/lib/unload+.js
@@ -0,0 +1,80 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+const { Class } = require("sdk/core/heritage");
+const unloadNS = require("sdk/core/namespace").ns();
+
+var Unloader = exports.Unloader = Class({
+ initialize: function Unloader() {
+ let unloaders = unloadNS(this).unloaders = [];
+
+ let unloadersUnlaod = unloadNS(this).unloadersUnlaod = function() {
+ unloaders.slice().forEach(function(u) u());
+ unloaders.length = 0;
+ }
+
+ require("sdk/system/unload").when(unloadersUnlaod);
+ },
+ unload: function unload(callback, container) {
+ // Calling with no arguments runs all the unloader callbacks
+ if (callback == null) {
+ unloadNS(this).unloadersUnlaod();
+ return null;
+ }
+
+ var remover = removeUnloader.bind(null, unloader, unloadNS(this).unloaders);
+
+ // The callback is bound to the lifetime of the container if we have one
+ if (container != null) {
+ // Remove the unloader when the container unloads
+ container.addEventListener("unload", remover, false);
+
+ // Wrap the callback to additionally remove the unload listener
+ let origCallback = callback;
+ callback = function() {
+ container.removeEventListener("unload", remover, false);
+ origCallback();
+ }
+ }
+
+ // Wrap the callback in a function that ignores failures
+ function unloader() {
+ try {
+ callback();
+ }
+ catch(e) {
+ console.error(e);
+ }
+ }
+ unloadNS(this).unloaders.push(unloader);
+
+ // Provide a way to remove the unloader
+ return remover;
+ }
+});
+
+function removeUnloader(unloader, unloaders) {
+ let index = unloaders.indexOf(unloader);
+ if (index != -1)
+ unloaders.splice(index, 1);
+}
+
+/**
+ * Save callbacks to run when unloading. Optionally scope the callback to a
+ * container, e.g., window. Provide a way to run all the callbacks.
+ *
+ * @usage unload(): Run all callbacks and release them.
+ *
+ * @usage unload(callback): Add a callback to run on unload.
+ * @param [function] callback: 0-parameter function to call on unload.
+ * @return [function]: A 0-parameter function that undoes adding the callback.
+ *
+ * @usage unload(callback, container) Add a scoped callback to run on unload.
+ * @param [function] callback: 0-parameter function to call on unload.
+ * @param [node] container: Remove the callback when this container unloads.
+ * @return [function]: A 0-parameter function that undoes adding the callback.
+ */
+const gUnload = Unloader();
+exports.unload = gUnload.unload.bind(gUnload);
diff --git a/packages/vold-utils/lib/window-watcher.js b/packages/vold-utils/lib/window-watcher.js
new file mode 100644
index 0000000..ab4f449
--- /dev/null
+++ b/packages/vold-utils/lib/window-watcher.js
@@ -0,0 +1,91 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Twitter Address Bar Search.
+ *
+ * The Initial Developer of the Original Code is The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Edward Lee <edilee@mozilla.com>
+ * Erik Vold <erikvvold@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const {Cu} = require("chrome");
+Cu.import("resource://gre/modules/Services.jsm", this);
+
+var {unload} = require("unload+");
+
+/**
+ * Apply a callback to each open and new browser windows.
+ *
+ * @usage watchWindows(callback): Apply a callback to each browser window.
+ * @param [function] callback: 1-parameter function that gets a browser window.
+ */
+exports.watchWindows = function watchWindows(callback) {
+ // Wrap the callback in a function that ignores failures
+ function watcher(window) {
+ try {
+ // Now that the window has loaded, only handle browser windows
+ let {documentElement} = window.document;
+ if (documentElement.getAttribute("windowtype") == "navigator:browser")
+ callback(window);
+ }
+ catch(ex) {}
+ }
+
+ // Wait for the window to finish loading before running the callback
+ function runOnLoad(window) {
+ // Listen for one load event before checking the window type
+ window.addEventListener("load", function runOnce() {
+ window.removeEventListener("load", runOnce, false);
+ watcher(window);
+ }, false);
+ }
+
+ // Add functionality to existing windows
+ let windows = Services.wm.getEnumerator(null);
+ while (windows.hasMoreElements()) {
+ // Only run the watcher immediately if the window is completely loaded
+ let window = windows.getNext();
+ if (window.document.readyState == "complete")
+ watcher(window);
+ // Wait for the window to load before continuing
+ else
+ runOnLoad(window);
+ }
+
+ // Watch for new browser windows opening then wait for it to load
+ function windowWatcher(subject, topic) {
+ if (topic == "domwindowopened")
+ runOnLoad(subject);
+ }
+ Services.ww.registerNotification(windowWatcher);
+
+ // Make sure to stop watching for windows if we're unloading
+ unload(function() Services.ww.unregisterNotification(windowWatcher));
+};
diff --git a/packages/vold-utils/lib/xpcom-utils.js b/packages/vold-utils/lib/xpcom-utils.js
new file mode 100644
index 0000000..f453b34
--- /dev/null
+++ b/packages/vold-utils/lib/xpcom-utils.js
@@ -0,0 +1,3 @@
+
+require("chrome").Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
+exports.XPCOMUtils = XPCOMUtils;
diff --git a/packages/vold-utils/package.json b/packages/vold-utils/package.json
new file mode 100644
index 0000000..ad549b7
--- /dev/null
+++ b/packages/vold-utils/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "vold-utils",
+ "description": "Utilitys for Jetpacks",
+ "author": "Erik Vold (http://erikvold.com/) <erikvvold@gmail.com>",
+ "version": "1.1",
+ "dependencies": ["api-utils"]
+}
diff --git a/packages/vold-utils/tests/test-unload+.js b/packages/vold-utils/tests/test-unload+.js
new file mode 100644
index 0000000..92f3e0c
--- /dev/null
+++ b/packages/vold-utils/tests/test-unload+.js
@@ -0,0 +1,119 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+var timer = require("timer");
+var {Cc,Ci} = require("chrome");
+const windowUtils = require("window-utils");
+const { Loader } = require('test-harness/loader');
+
+function makeEmptyWindow() {
+ var xulNs = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var blankXul = ('<?xml version="1.0"?>' +
+ '<?xml-stylesheet href="chrome://global/skin/" ' +
+ ' type="text/css"?>' +
+ '<window xmlns="' + xulNs + '">' +
+ '</window>');
+ var url = "data:application/vnd.mozilla.xul+xml," + escape(blankXul);
+ var features = ["chrome", "width=10", "height=10"];
+
+ var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]
+ .getService(Ci.nsIWindowWatcher);
+ return ww.openWindow(null, url, null, features.join(","), null);
+}
+
+exports.testUnloading = function(test) {
+ var loader = Loader(module);
+ var {unload} = loader.require("unload+");
+ var unloadCalled = 0;
+
+ function unloader() {
+ unloadCalled++;
+ throw "error";
+ }
+ unload(unloader);
+
+ function unloader2() unloadCalled++;
+ var removeUnloader2 = unload(unloader2);
+
+ function unloader3() unloadCalled++;
+ unload(unloader3);
+
+ // remove unloader2
+ removeUnloader2();
+
+ loader.unload();
+ test.assertEqual(
+ unloadCalled, 2, "Unloader functions are called on unload.");
+};
+
+exports.testUnloadingWindow = function(test) {
+ test.waitUntilDone();
+
+ var loader = Loader(module);
+ var {unload} = loader.require("unload+");
+ var unloadCalled = 0;
+ var finished = false;
+ var myWindow;
+
+ var delegate = {
+ onTrack: function(window) {
+ if (window == myWindow) {
+ test.pass("onTrack() called with our test window");
+
+ let unloader = function unloader() {
+ unloadCalled++;
+ }
+ unload(unloader, window);
+ unload(unloader);
+
+ timer.setTimeout(function() {
+ window.close();
+
+ test.assertEqual(
+ unloadCalled, 0, "no unloaders called.");
+
+ if (window.closed) {
+ test.pass("window closed");
+ } else {
+ test.fail("window is not closed!");
+ }
+
+ timer.setTimeout(function() {
+ test.assertEqual(
+ unloadCalled, 0, "zero unloaders called.");
+
+ loader.unload();
+
+ test.assertEqual(
+ unloadCalled, 1, "one unloaders called.");
+
+ if (finished) {
+ test.pass("finished");
+ test.done();
+ } else {
+ test.fail("not finished!");
+ }
+ }, 1);
+ }, 1);
+ }
+ },
+ onUntrack: function(window) {
+ if (window == myWindow) {
+ test.pass("onUntrack() called with our test window");
+
+ if (!finished) {
+ finished = true;
+ myWindow = null;
+ wt.unload();
+ } else {
+ test.fail("finishTest() called multiple times.");
+ }
+ }
+ }
+ };
+
+ var wt = new windowUtils.WindowTracker(delegate);
+ myWindow = makeEmptyWindow();
+};
diff --git a/test.sh b/test.sh
new file mode 100644
index 0000000..a487675
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+cfx test -p ~/.mozilla/firefox/profiles/httpsEverywhere | grep -v '^console'
diff --git a/test/mock/long_string.js b/test/mock/long_string.js
new file mode 100644
index 0000000..4d224fc
--- /dev/null
+++ b/test/mock/long_string.js
@@ -0,0 +1,22 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+exports.longString = "\n\n LibreJS Information\n\n Current Version: 2.4.2 -- 12/08/2011\n \n Copyright (C) 2011 Loic J. Duros.\n Permission is granted to copy, distribute and/or modify this document\n under the terms of the GNU Free Documentation License, Version 1.3\n or any later version published by the Free Software Foundation;\n with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.\n A copy of the license is included in the section entitled \"GNU\n Free Documentation License\".\n \n\nPlain text copy\nA plain text copy of this documentation is available here.\n\nOverview\nLibreJS is an add-on for GNU IceCat (Mozilla Firefox, Abrowser, Iceweasel, …) that\nprevents the execution of nonfree nontrivial JavaScript as described\nin \"The Javascript Trap\":\nhttp://www.gnu.org/philosophy/javascript-trap.html\nIt has been tested for Firefox 7. Please see the Known issues section\nin this document before using LibreJS.\n\nDisclaimer\n\nLibreJS is not a security tool and while its goal is to detect nonfree\n nontrivial JavaScript, it does not detect whether free or trivial\n code is malicious or not. You can use NoScript (or YesScript) in\n conjunction with LibreJS to ensure security of the JavaScript being\n loaded.\nBecause LibreJS intercepts http responses to analyze and remove\n JavaScript from a page, it will not analyze and block JavaScript if\n it is loaded locally as a file within the user's filesystem, for\n instance with file:///home/someone/test.html -- a request\n http://localhost, however, would be caught and analyzed by the\n add-on.\nLibreJS is always a work in progress. If you find a bug, please\n report it to lduros@gnu.org\n\n\nChanges from version 2.4.1 to version 2.4.2\nSee changelog.\n\nChanges from version 1.x to version 2\n1) The @licstart @licend stylized comments are now obligatory rather\nthan optional. We want to make sure an entire page is explicitely free\nbefore considering it as free.\n2) In version 1, all scripts that defined a function or method were\nflagged as nontrivial. In version 2, as described in The JavaScript\nTrap, it will only consider the JavaScript program as nontrivial if\nthe scripts define a function or a method and load external scripts\nusing the html <script> tag, or if an external script defines a method\nor a function. \n3) In the version 1, scripts on page and remote were analyzed individually.\n In version 2 (current version):\n \n all scripts that are directly embedded in an html page are\n analyzed as one to see whether they are trivial or free.\n If the on-page JavaScript is nonfree and nontrivial, all\n JavaScript is removed and none of the external files are\n analyzed.\n If the on-page JavaScript is free or trivial, the external\n scripts are then fetched and analyzed to find whether they are\n free or trivial individually.\n If any script, on-page or external, is found to be nontrivial,\n all JavaScript is removed from the page (inline scripts,\n intrinsec events in html attributes, external scripts, ...)\n If any free script is found to perform an AJAX request or embed\n another script dynamically, or any construct that is flagged as\n \"suspicious\", then any trivial code becomes \"nontrivial\", and\n all JavaScript is then removed.\n When all the code is free but loads JavaScript dynamically, all\n http responses of mime type javascript are checked to see\n whether they are free/trivial at request time, and rejected if\n they are nonfree nontrivial.\n\n4) In version 1, a pure JavaScript HTML partial parser was used to\n find <script> tags and other JavaScript elements on page. In\n version 2, we are using a heavily modified third-party script to\n load the http response intercepted into a hidden iframe with a data\n uri (the hidden iframe has JavaScript off, as well as plugins off,\n following the instructions in\n https://developer.mozilla.org/En/Displaying_web_content_in_an_extension_without_security_issues). \n We are then using JavaScript DOM methods to fetch and remove\n scripts. This new method is a lot more secure and less prone to\n forgetting some of the JavaScript or not finding weird\n constructs. It also removes parts of the issue with the freezing\n UI.\n5) We are now using the url module from the Node.js project\n (http://nodejs.org/) to convert relative path into absolute urls\n when the DOM is loaded with a data uri.\n\nScreenshots\n\n\n\nThe panel that shows the blocked JavaScript:\n http://lduros.net/assets/librejs/v1/screenshots/librejs-v1-blockedscript-panel.jpg\n\nThe preferences panel:\n http://lduros.net/assets/librejs/v1/screenshots/librejs-v1-preferences.jpg\n\n\n\nLicense\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nHow to use\n\nAfter installing the add-on, you will see the LibreJS widget in the\nadd-on bar at the bottom of the browser window. After loading a page,\nleft-click on the widget to view the list of JavaScript removed from\nthe page (both on page and external). Up to 1000 characters are\ndisplayed per Javascript piece, since some files are so large it\nbecomes impractical to display them in their entirety. See screenshot\nhere: \nhttp://lduros.net/assets/librejs/v1/screenshots/librejs-v1-blockedscript-panel.jpg\nYou can also take a look at the JS removed by looking at the\npage source: CTRL + U.\n\nLibreJS intercepts http responses and rewrites them after analyzing\nJavaScript within them. While it uses mime types to a certain extent,\nit does not rely only on them and attempts to analyze any file for\njavascript content (a content sniffer of some sort is on the way for a\nfuture release).\n\nThe add-on offers a few options (and more to come). You can access\nthese options by right-clicking the widget. Please ignore the add-on\ncontext menu that will appear (this is a bug with Firefox and the\nadd-on sdk).\n\nA panel should appear in the middle of the page, with two checkboxes\navailable: \nhttp://lduros.net/assets/librejs/v1/screenshots/librejs-v1-preferences.jpg\nCurrently, LibreJS searches for license mentions in two\nways, a short and a lazy way (the latter is optional). One uses\nexcerpts from the short notices usually provided by many licenses for\ninclusion within source files, e.g. for the GPLv2: \n <THISPROGRAM> is free software; you can redistribute it\n and/or modify it under the terms of the GNU General Public\n License as published by the Free Software Foundation; either\n version 2 of the License, or (at your option) any later\n version.\nWhen it finds a match, it flags the piece of JS as free. This is\ncalled short definition. Another type of notice we call \"lazy\", here\nis a popular example: \n Dual licensed under the MIT or GPL Version 3 licenses \nWhen the \"Do not tolerate lazy license mentions\" checkbox is checked,\nthe latter type of license mention is not used.\n\nTests\nIn order to better understand how LibreJS works, you can try to visit\nthese pages with LibreJS installed and enabled and see how they are\nbeing processed:\n\n1) http://lduros.net/assets/librejs/tests/trivial-inline-trivial-external/\n This page contains trivial on-page JavaScript code, and an external\n script that contains trivial JavaScript code.\n Therefore, all JavaScript is being executed.\n\n2) http://lduros.net/assets/librejs/tests/trivial-inline-nontrivial-external/\n This page contains trivial on-page JavaScript code, but loads an\n external script that defines a function (nontrivial) and is not\n free.\n Therefore, all JavaScript is REMOVED from the page.\n\n3) http://lduros.net/assets/librejs/tests/nontrivial-inline-trivial-external/\n This page contains nontrivial code on page, and trivial code in its\n external page.\n All JavaScript is REMOVED from the page.\n\n4) http://lduros.net/assets/librejs/tests/free-inline-free-external/\n This page contains free on-page (GPL 3) JavaScript, and free\n external Javascript. Therefore all JavaScript is being executed.\n\n5) http://lduros.net/assets/librejs/tests/free-inline-nonfree-nontrivial-external/\n This page contains free on-page JavaScript, but contains nonfree\n nontrivial JavaScript in its external file (ajax request).\n All JavaScript is REMOVED from the page.\n\n6) http://lduros.net/assets/librejs/tests/intrinsec-event/\n This page contains trivial on-page code, with an intrinsec event in\n an html attribute (onload).\n All JavaScript is being executed.\n\n7) http://lduros.net/assets/librejs/tests/trivial-inline-free-external-defines-function/\n This page contains on-page trivial JavaScript (only makes a window\n alert and loads an external script using the html <script> tag with the\n src attribute. The external script is free (GPL v3), and since it\n is only nontrivial because it defines a function, the on-page\n trivial code is allowed to use it.\n All JavaScript is being executed.\n\n8) http://lduros.net/assets/librejs/tests/trivial-inline-free-external-writes-script/\n This page contains trivial on-page JavaScript code, and loads an\n external script that is free.\n HOWEVER, this free external script loads a script\n dynamically. Therefore, since trivial code might be using it, no\n trivial code is allowed.\n Since the on-page trivial code is now nontrivial,\n all Javascript is REMOVED from the page.\n\n9) http://lduros.net/assets/librejs/tests/shelltypist/demo/real-life-example-with-jquery-free.html\n This is a real-life example of a small jQuery plugin. The on-page\n JavaScript code has a free license. The jQuery external file has a\n free (but lazily defined) licensed. The shelltypist.js file has a\n free license as well. All licenses are defined between @licstart\n and @licend. If the \"Do not consider lazy license mentions as free\"\n option is not checked (default), the JavaScript is executed,\n despite the fact that the jQuery license mentions is: \n Dual licensed under the MIT or GPL Version 2 licenses.\n If you check the \"Do not consider lazy license mentions as free\"\n option, then ALL JavaScript will be removed from the page after\n reload.\n\n10) http://lduros.net/assets/librejs/tests/shelltypist/demo/same-page-without-free-license.html\n This is the same page than 9) but does not have a free license for\n the main HTML page on-page script. While the actual code there is\n trivial, since jQuery defines methods that make use of AJAX,\n trivial code is not allowed, and no JavaScript is executed.\n\nOptions\n\n\nDo not tolerate lazy license mentions (e.g.: dual-licensed under\n ...)\n When checked, this option disallows the use of very brief\n mentions of a license. (\"Released under the MIT license\", ...)\n\n\nHow LibreJS detects nontrivial JavaScript\n\nLibreJS uses Narcissus lexer/parser\n(https://github.com/mozilla/narcissus) to perform a static check for a\nfew criteria: \n\nIf the program defines a method or a function and loads external\nscripts (using the <script> element and src attribute).\nIf the program has an external script and defines a function or a\nmethod.\nIf it makes an AJAX request using XMLHttpRequest or ActiveXObject.\nIf it loads an external script (creates a script tag somewhere in the\ndom).\n\nBecause the code isn't interpreted (static analysis only) and we don't\nkeep track of scope and what variables contain, we have to discard a\nfew constructs:\n- if eval() is used.\n- if methods are invoked using the bracket suffix, such as:\nt['meth'+'od'](arg);\n- if it using document.write() with a concatenation or a function\ncall.\nFree Licenses\nCurrently LibreJS checks for the following licenses:\n\n GNU General Public License version 2\n GNU General Public License version 3\n GNU All-Permissive License\nLesser GNU Public License version 2.1\nLesser GNU Public License version 3\n Apache License, Version 2.0\n GNU Affero General Public License version 3\n Boost Software License\n BSD 2-Clause License\n BSD 3-Clause License\n Mozilla Public License Version 1.1\n Expat License\n\n\nMore licenses are on the way for the upcoming versions.\nKnown issues of LibreJS version 2\n\nLibreJS currently analyzes the JavaScript on page and in the\n Javascript file using the same thread as the Mozilla Firefox\n browser. Depending on hardware, this causes the UI to freeze for a\n second or two when a large javascript file is being analyzed. I am\n planning on using a chrome worker for Narcissus in the near future\n (version 2), so that it can run in its own thread. This way large\n complex files won't freeze the UI. 11/14/2011 UPDATE: This has been\n partly addressed with the replacement of the recursive walkTree\n function with the iterative one.\nIt does not make good use of the caching system. Instead it dooms\n the cache entry when the response is of type text/html or\n javascript.\n\n\nFixed in version 2.2:\n- FIXED: Currently there is no option to interpret javascript in the current\n page or javascript file. In order to enable all Javascript back, you\n must disable the add-on, but it does not require a Firefox\n restart. A button is planned for the future release.\n\nFIXED: Clicking on an anchor link in the page currently loaded in the tab,\n or appending a #[anything] to the location bar will prevent the\n widget panel from displaying the removed Javascript. This is due to\n the fact that it tracks JS according to the url, and so the # is\n considered a new entry. However, the JavaScript is still being\n blocked properly. (Check source for that.)\n\nGNU Free Documentation Licence\nA verbatim copy of the GNU Free Documentation license is available here\n "; \ No newline at end of file
diff --git a/test/mock/mock_dom.js b/test/mock/mock_dom.js
new file mode 100644
index 0000000..a843889
--- /dev/null
+++ b/test/mock/mock_dom.js
@@ -0,0 +1,87 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+var parser = Cc["@mozilla.org/xmlextras/domparser;1"]
+ .createInstance(Ci.nsIDOMParser);
+
+exports.emptyDocument = function () {
+ return parser.parseFromString('<!doctype html><html></html>', 'text/html');
+};
+
+exports.rejectedScriptsDocument = function () {
+
+ var htmlWithRejectedScripts = "<!doctype html>" +
+ "<html>" +
+ "<head>" +
+ "<title>Fake Page</title>" +
+ "<script>var i = 0;</script>" +
+ "<script>var xhr = new XMLHttpRequest();</script>" +
+ "</head>" +
+ "<body>" +
+ "\n" +
+ "<h1></h1>" +
+ "<p></p>" +
+ "</body>" +
+ "</html>";
+ return parser.parseFromString(htmlWithRejectedScripts, "text/html");
+};
+
+exports.acceptedScriptsDocument = function () {
+
+ var htmlWithAcceptedScripts = "<!doctype html>" +
+ "<html>" +
+ "<head>" +
+ "<title>Fake Page</title>" +
+ "<script>var i = 0;" +
+ "var length = document.length;</script>" +
+ "<script>for (; i < length; i++) {" +
+ "console.log(i);" +
+ "} </script>" +
+ "</head>" +
+ "\n" +
+ "<body>" +
+ "<h1></h1>" +
+ "<p></p>" +
+ "</body>" +
+ "</html>";
+
+ return parser.parseFromString(htmlWithAcceptedScripts, "text/html");
+
+};
+
+exports.domWithOnAttrib = function () {
+
+ var html = "<!doctype html>" +
+ "<html>" +
+ "<head>" +
+ "<title>Fake Page</title>" +
+ "</head>" +
+ "\n" +
+ "<body onLoad=\"blah();\">" +
+ "<h1></h1>" +
+ "<p></p>" +
+ "</body>" +
+ "</html>";
+
+ return parser.parseFromString(html, "text/html");
+
+};
diff --git a/test/mock/mock_licenses.js b/test/mock/mock_licenses.js
new file mode 100644
index 0000000..c70f1b7
--- /dev/null
+++ b/test/mock/mock_licenses.js
@@ -0,0 +1,26 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+exports.mockLicenses = {
+ gplv2: {
+ 'name': 'GPLv2',
+ 'substrings': [{text: "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.", type: licenses.types.SHORT}]
+ }
+};
diff --git a/test/mock/mock_nodes.js b/test/mock/mock_nodes.js
new file mode 100644
index 0000000..26eae70
--- /dev/null
+++ b/test/mock/mock_nodes.js
@@ -0,0 +1,814 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const types = require("js_checker/constant_types").token;
+
+
+exports.mockNodes = {
+ "alert('this is completely trivial');": {type:types.SCRIPT, lineno:1, children:[{type:types.SEMICOLON, value:"alert", lineno:1, start:0, end:34, children:[], blockComments:[], expression:{type:types.CALL, value:"(", lineno:1, start:0, end:34, children:[{type:types.IDENTIFIER, value:"alert", lineno:1, start:0, end:5, children:[], generatingSource:true}, {type:types.LIST, value:"(", lineno:1, start:5, end:34, children:[{type:types.STRING, value:"this is completely trivial", lineno:1, start:6, end:34, children:[], generatingSource:true}], generatingSource:true}], generatingSource:true}, generatingSource:true}], funDecls:[], varDecls:[], modDefns:{table:null, size:0}, modAssns:{table:null, size:0}, modDecls:{table:null, size:0}, modLoads:{table:null, size:0}, impDecls:[], expDecls:[], exports:{table:null, size:0}, hasEmptyReturn:false, hasReturnWithValue:false, hasYield:false, generatingSource:true},
+ "var myObj = { 'myMethod': function (arg) { alert(arg); } }":
+ {type:types.SCRIPT, lineno:1, children:[{type:types.VAR, value:"var", lineno:1, start:0, end:9, children:[{type:types.IDENTIFIER, value:"myObj", lineno:1, start:4, end:9, children:[], name:"myObj", readOnly:false, initializer:{type:types.OBJECT_INIT, value:"{", lineno:1, start:12, end:56, children:[{type:types.PROPERTY_INIT, value:":", lineno:1, start:14, end:56, children:[{type:types.IDENTIFIER, value:"myMethod", lineno:1, start:14, end:24, children:[], generatingSource:true}, {type:types.FUNCTION, value:"function", lineno:1, start:26, end:56, children:[], params:["arg"], paramComments:[null], blockComments:null, body:{type:types.SCRIPT, value:"{", lineno:1, start:41, end:52, children:[{type:types.SEMICOLON, value:"alert", lineno:1, start:43, end:52, children:[], blockComments:[], expression:{type:types.CALL, value:"(", lineno:1, start:43, end:52, children:[{type:types.IDENTIFIER, value:"alert", lineno:1, start:43, end:48, children:[], generatingSource:true}, {type:types.LIST, value:"(", lineno:1, start:48, end:52, children:[{type:types.IDENTIFIER, value:"arg", lineno:1, start:49, end:52, children:[], generatingSource:true}], generatingSource:true}], generatingSource:true}, generatingSource:true}], funDecls:[], varDecls:[], modDefns:{table:null, size:0}, modAssns:{table:null, size:0}, modDecls:{table:null, size:0}, modLoads:{table:null, size:0}, impDecls:[], expDecls:[], exports:{table:null, size:0}, hasEmptyReturn:false, hasReturnWithValue:false, hasYield:false, generatingSource:true}, functionForm:1, generatingSource:true}], blockComments:[], generatingSource:true}], generatingSource:true}, blockComment:null, generatingSource:true}], destructurings:[], blockComments:[], generatingSource:true}], funDecls:[], varDecls:[{type:types.IDENTIFIER, value:"myObj", lineno:1, start:4, end:9, children:[], name:"myObj", readOnly:false, initializer:{type:types.OBJECT_INIT, value:"{", lineno:1, start:12, end:56, children:[{type:types.PROPERTY_INIT, value:":", lineno:1, start:14, end:56, children:[{type:types.IDENTIFIER, value:"myMethod", lineno:1, start:14, end:24, children:[], generatingSource:true}, {type:types.FUNCTION, value:"function", lineno:1, start:26, end:56, children:[], params:["arg"], paramComments:[null], blockComments:null, body:{type:types.SCRIPT, value:"{", lineno:1, start:41, end:52, children:[{type:types.SEMICOLON, value:"alert", lineno:1, start:43, end:52, children:[], blockComments:[], expression:{type:types.CALL, value:"(", lineno:1, start:43, end:52, children:[{type:types.IDENTIFIER, value:"alert", lineno:1, start:43, end:48, children:[], generatingSource:true}, {type:types.LIST, value:"(", lineno:1, start:48, end:52, children:[{type:types.IDENTIFIER, value:"arg", lineno:1, start:49, end:52, children:[], generatingSource:true}], generatingSource:true}], generatingSource:true}, generatingSource:true}], funDecls:[], varDecls:[], modDefns:{table:null, size:0}, modAssns:{table:null, size:0}, modDecls:{table:null, size:0}, modLoads:{table:null, size:0}, impDecls:[], expDecls:[], exports:{table:null, size:0}, hasEmptyReturn:false, hasReturnWithValue:false, hasYield:false, generatingSource:true}, functionForm:1, generatingSource:true}], blockComments:[], generatingSource:true}], generatingSource:true}, blockComment:null, generatingSource:true}], modDefns:{table:null, size:0}, modAssns:{table:null, size:0}, modDecls:{table:null, size:0}, modLoads:{table:null, size:0}, impDecls:[], expDecls:[], exports:{table:null, size:0}, hasEmptyReturn:false, hasReturnWithValue:false, hasYield:false, generatingSource:true},
+ "function test (myArgument) { doSomething(); }":
+ {type:types.SCRIPT, lineno:1, children:[{type:types.FUNCTION,
+ value:"function", lineno:1, start:0, end:45, children:[],
+ params:["myArgument"], paramComments:[null], blockComments:[],
+ name:"test", body:{type:types.SCRIPT, value:"{", lineno:1, start:27,
+ end:41, children:[{type:types.SEMICOLON, value:"doSomething", lineno:1,
+ start:29, end:41, children:[], blockComments:[],
+ expression:{type:types.CALL, value:"(", lineno:1, start:29, end:41,
+ children:[{type:types.IDENTIFIER, value:"doSomething", lineno:1,
+ start:29, end:40, children:[], generatingSource:true}, {type:types.LIST,
+ value:"(", lineno:1, start:40, end:41, children:[],
+ generatingSource:true}], generatingSource:true},
+ generatingSource:true}], funDecls:[], varDecls:[],
+ modDefns:{table:null, size:0}, modAssns:{table:null, size:0},
+ modDecls:{table:null, size:0}, modLoads:{table:null, size:0},
+ impDecls:[], expDecls:[], exports:{table:null, size:0},
+ hasEmptyReturn:false, hasReturnWithValue:false, hasYield:false,
+ generatingSource:true}, functionForm:0, generatingSource:true}],
+ funDecls:[{type:types.FUNCTION, value:"function", lineno:1, start:0,
+ end:45, children:[], params:["myArgument"], paramComments:[null],
+ blockComments:[], name:"test", body:{type:types.SCRIPT, value:"{",
+ lineno:1, start:27, end:41, children:[{type:types.SEMICOLON,
+ value:"doSomething", lineno:1, start:29, end:41, children:[],
+ blockComments:[], expression:{type:types.CALL, value:"(", lineno:1,
+ start:29, end:41, children:[{type:types.IDENTIFIER, value:"doSomething",
+ lineno:1, start:29, end:40, children:[], generatingSource:true},
+ {type:types.LIST, value:"(", lineno:1, start:40, end:41, children:[],
+ generatingSource:true}], generatingSource:true},
+ generatingSource:true}], funDecls:[], varDecls:[],
+ modDefns:{table:null, size:0}, modAssns:{table:null, size:0},
+ modDecls:{table:null, size:0}, modLoads:{table:null, size:0},
+ impDecls:[], expDecls:[], exports:{table:null, size:0},
+ hasEmptyReturn:false, hasReturnWithValue:false, hasYield:false,
+ generatingSource:true}, functionForm:0, generatingSource:true}],
+ varDecls:[], modDefns:{table:null, size:0}, modAssns:{table:null,
+ size:0}, modDecls:{table:null, size:0}, modLoads:{table:null,
+ size:0}, impDecls:[], expDecls:[], exports:{table:null, size:0},
+ hasEmptyReturn:false, hasReturnWithValue:false, hasYield:false,
+ generatingSource:true},
+
+ "var def = 'blah';var i = 0;\n\n def = 'something else';": {type:types.SCRIPT,
+ lineno:1, children:[{type:types.VAR, value:"var", lineno:1, start:0,
+ end:7, children:[{type:types.IDENTIFIER, value:"def", lineno:1, start:4,
+ end:7, children:[], name:"def", readOnly:false,
+ initializer:{type:types.STRING, value:"blah", lineno:1, start:10,
+ end:16, children:[], generatingSource:true}, blockComment:null,
+ generatingSource:true}], destructurings:[], blockComments:[],
+ generatingSource:true}, {type:types.VAR, value:"var", lineno:1,
+ start:17, end:22, children:[{type:types.IDENTIFIER, value:"i", lineno:1,
+ start:21, end:22, children:[], name:"i", readOnly:false,
+ initializer:{type:types.NUMBER, value:0, lineno:1, start:25, end:26,
+ children:[], generatingSource:true}, blockComment:null,
+ generatingSource:true}], destructurings:[], blockComments:[],
+ generatingSource:true}, {type:types.SEMICOLON, value:"def", lineno:3,
+ start:30, end:52, children:[], blockComments:[],
+ expression:{type:types.ASSIGN, value:";", lineno:1, start:26, end:52,
+ children:[{type:types.IDENTIFIER, value:"def", lineno:3, start:30,
+ end:33, children:[], generatingSource:true}, {type:types.STRING,
+ value:"something else", lineno:3, start:36, end:52, children:[],
+ generatingSource:true}], blockComment:null,
+ generatingSource:true}, generatingSource:true}], funDecls:[],
+ varDecls:[{type:types.IDENTIFIER, value:"def", lineno:1, start:4, end:7,
+ children:[], name:"def", readOnly:false, initializer:{type:types.STRING,
+ value:"blah", lineno:1, start:10, end:16, children:[],
+ generatingSource:true}, blockComment:null, generatingSource:true},
+ {type:types.IDENTIFIER, value:"i", lineno:1, start:21, end:22,
+ children:[], name:"i", readOnly:false, initializer:{type:types.NUMBER,
+ value:0, lineno:1, start:25, end:26, children:[],
+ generatingSource:true}, blockComment:null,
+ generatingSource:true}], modDefns:{table:null, size:0},
+ modAssns:{table:null, size:0}, modDecls:{table:null, size:0},
+ modLoads:{table:null, size:0}, impDecls:[], expDecls:[],
+ exports:{table:null, size:0}, hasEmptyReturn:false,
+ hasReturnWithValue:false, hasYield:false, generatingSource:true},
+
+'function example(param1) {}': {
+ type: 78,
+ body: {
+ type: 0,
+ end: 27,
+ hasEmptyReturn: false,
+ hasReturnWithValue: false,
+ isGenerator: false,
+ lineno: 1,
+ start: 26,
+ value: "{",
+ },
+ end: 29,
+ functionForm: 0,
+ lineno: 1,
+ name: "example",
+ params: "param1",
+ start: 0,
+ value: "function"
+},
+'eval': {
+ type: 60,
+ end: 31,
+ lineno: 1,
+ start: 27,
+ value: 'eval'
+},
+'evaluate': {
+ type: 60,
+ end: 31,
+ lineno: 1,
+ start: 27,
+ value: 'evaluate'
+},
+"window['eval']('var i;');": {
+ "type": 46,
+ "value": "(",
+ "lineno": 1,
+ "start": 8,
+ "end": 31,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 48,
+ "value": "[",
+ "lineno": 1,
+ "start": 8,
+ "end": 21,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "window",
+ "lineno": 1,
+ "start": 8,
+ "end": 14,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 62,
+ "value": "eval",
+ "lineno": 1,
+ "start": 15,
+ "end": 21,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 55,
+ "value": "(",
+ "lineno": 1,
+ "start": 22,
+ "end": 31,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 62,
+ "value": "var i;",
+ "lineno": 1,
+ "start": 23,
+ "end": 31,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ }
+ ]
+},
+"array[num] = 'some text';": {
+ "type": 4,
+ "value": ";",
+ "lineno": 1,
+ "start": 11,
+ "end": 37,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 48,
+ "value": "[",
+ "lineno": 2,
+ "start": 13,
+ "end": 22,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "array",
+ "lineno": 2,
+ "start": 13,
+ "end": 18,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "num",
+ "lineno": 2,
+ "start": 19,
+ "end": 22,
+ "tokenizer": "",
+ "children": []
+ }
+ ],
+ "assignOp": null
+ },
+ {
+ "type": 62,
+ "value": "some text",
+ "lineno": 2,
+ "start": 26,
+ "end": 37,
+ "tokenizer": "",
+ "children": []
+ }
+ ],
+ "blockComment": null,
+ "assignOp": null
+},
+'XMLHttpRequest': {
+ "type": 60,
+ "value": "XMLHttpRequest",
+ "lineno": 3,
+ "start": 16,
+ "end": 30,
+ "tokenizer": "",
+ "children": []
+},
+'ActiveXObject': {
+ "type": 60,
+ "value": "ActiveXObject",
+ "lineno": 3,
+ "start": 16,
+ "end": 30,
+ "tokenizer": "",
+ "children": []
+},
+"oReq.open('GET', 'http://localhost/test.xml', true;)": {
+ "type": 46,
+ "value": "(",
+ "lineno": 3,
+ "start": 2,
+ "end": 52,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 3,
+ "start": 2,
+ "end": 11,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "oReq",
+ "lineno": 3,
+ "start": 2,
+ "end": 6,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "open",
+ "lineno": 3,
+ "start": 7,
+ "end": 11,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 55,
+ "value": "(",
+ "lineno": 3,
+ "start": 11,
+ "end": 52,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 62,
+ "value": "GET",
+ "lineno": 3,
+ "start": 12,
+ "end": 17,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 62,
+ "value": "http://localhost/test.xml",
+ "lineno": 3,
+ "start": 19,
+ "end": 46,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 91,
+ "value": "true",
+ "lineno": 3,
+ "start": 48,
+ "end": 52,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ }
+ ]
+},
+"oReq.open('a random string');": {
+ "type": 46,
+ "value": "(",
+ "lineno": 3,
+ "start": 2,
+ "end": 52,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 3,
+ "start": 2,
+ "end": 11,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "oReq",
+ "lineno": 3,
+ "start": 2,
+ "end": 6,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "open",
+ "lineno": 3,
+ "start": 7,
+ "end": 11,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 55,
+ "value": "(",
+ "lineno": 3,
+ "start": 11,
+ "end": 52,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 62,
+ "value": "a random string",
+ "lineno": 3,
+ "start": 12,
+ "end": 17,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ }
+ ]
+},
+"document.createElement('script');": {
+ "type": 46,
+ "value": "(",
+ "lineno": 1,
+ "start": 0,
+ "end": 31,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 1,
+ "start": 0,
+ "end": 22,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "document",
+ "lineno": 1,
+ "start": 0,
+ "end": 8,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "createElement",
+ "lineno": 1,
+ "start": 9,
+ "end": 22,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 55,
+ "value": "(",
+ "lineno": 1,
+ "start": 22,
+ "end": 31,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 62,
+ "value": "script",
+ "lineno": 1,
+ "start": 23,
+ "end": 31,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ }
+ ]
+},
+'document.write("script src="evil-js.js"type="text/javascript></script>")': {
+ "type": 46,
+ "value": "(",
+ "lineno": 2,
+ "start": 1,
+ "end": 36,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 2,
+ "start": 1,
+ "end": 15,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "document",
+ "lineno": 2,
+ "start": 1,
+ "end": 9,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "write",
+ "lineno": 2,
+ "start": 10,
+ "end": 15,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 55,
+ "value": "(",
+ "lineno": 2,
+ "start": 15,
+ "end": 36,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 62,
+ "value": "\n\n<script src=\"evil-js.js\"type=\"text/javascript></script>\n\n",
+ "lineno": 2,
+ "start": 16,
+ "end": 36,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ }
+ ]
+},
+"document.write('a ' + ' text');": {
+ "type": 46,
+ "value": "(",
+ "lineno": 2,
+ "start": 1,
+ "end": 36,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 2,
+ "start": 1,
+ "end": 15,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "document",
+ "lineno": 2,
+ "start": 1,
+ "end": 9,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "write",
+ "lineno": 2,
+ "start": 10,
+ "end": 15,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 55,
+ "value": "(",
+ "lineno": 2,
+ "start": 15,
+ "end": 36,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 24,
+ "value": "+",
+ "lineno": 2,
+ "start": 16,
+ "end": 29,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 62,
+ "value": "scri",
+ "lineno": 2,
+ "start": 16,
+ "end": 22,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 62,
+ "value": "pt",
+ "lineno": 2,
+ "start": 25,
+ "end": 29,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ }
+ ]
+ }
+ ]
+},
+"document.write('<h1>some text</h1>')": {
+ "lineno": 1,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 2,
+ "value": "document",
+ "lineno": 2,
+ "start": 1,
+ "end": 36,
+ "tokenizer": "",
+ "children": [],
+ "blockComments": [],
+ "expression": {
+ "type": 46,
+ "value": "(",
+ "lineno": 2,
+ "start": 1,
+ "end": 36,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 2,
+ "start": 1,
+ "end": 15,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "document",
+ "lineno": 2,
+ "start": 1,
+ "end": 9,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "write",
+ "lineno": 2,
+ "start": 10,
+ "end": 15,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 55,
+ "value": "(",
+ "lineno": 2,
+ "start": 15,
+ "end": 36,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 62,
+ "value": "\n\n<h1>some text</h1>\n\n",
+ "lineno": 2,
+ "start": 16,
+ "end": 36,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ],
+},
+'element.innerHTML = "<script src=\'externalscript.js\'></script>";': {
+ "lineno": 1,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 1,
+ "start": 0,
+ "end": 17,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "element",
+ "lineno": 1,
+ "start": 0,
+ "end": 7,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "innerHTML",
+ "lineno": 1,
+ "start": 8,
+ "end": 17,
+ "tokenizer": "",
+ "children": []
+ }
+ ],
+ "assignOp": null
+ },
+ {
+ "type": 62,
+ "value": '<script src=\'externalscript.js\'></script>',
+ "lineno": 1,
+ "start": 20,
+ "end": 63,
+ "tokenizer": "",
+ "children": []
+ }
+ ],
+ "type": 4,
+ "assignOp": null
+},
+'element.innerHTML = "<h1>A headline!</h1>";': {
+ "lineno": 1,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 1,
+ "start": 0,
+ "end": 17,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "element",
+ "lineno": 1,
+ "start": 0,
+ "end": 7,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "innerHTML",
+ "lineno": 1,
+ "start": 8,
+ "end": 17,
+ "tokenizer": "",
+ "children": []
+ }
+ ],
+ "assignOp": null
+ },
+ {
+ "type": 62,
+ "value": '<h1>A Headline!</h1>',
+ "lineno": 1,
+ "start": 20,
+ "end": 63,
+ "tokenizer": "",
+ "children": []
+ }
+ ],
+ "type": 4,
+ "assignOp": null
+},
+'element.innerHTML = "script src" + "=\'eviljs.js\'";': {
+ "lineno": 1,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 1,
+ "start": 0,
+ "end": 17,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 60,
+ "value": "element",
+ "lineno": 1,
+ "start": 0,
+ "end": 7,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "innerHTML",
+ "lineno": 1,
+ "start": 8,
+ "end": 17,
+ "tokenizer": "",
+ "children": []
+ }
+ ],
+ "assignOp": null
+ },
+ {
+ "type": 24,
+ "value": "+",
+ "lineno": 1,
+ "start": 20,
+ "end": 49,
+ "tokenizer": "",
+ "children": [
+ {
+ "type": 62,
+ "value": "script src",
+ "lineno": 1,
+ "start": 20,
+ "end": 32,
+ "tokenizer": "",
+ "children": []
+ },
+ {
+ "type": 62,
+ "value": "='eviljs.js'",
+ "lineno": 1,
+ "start": 35,
+ "end": 49,
+ "tokenizer": "",
+ "children": []
+ }
+ ]
+ }
+ ],
+ "type": 4,
+ "assignOp": null
+}
+};
diff --git a/test/mock/mock_nodes_with_comments.js b/test/mock/mock_nodes_with_comments.js
new file mode 100644
index 0000000..bf5deec
--- /dev/null
+++ b/test/mock/mock_nodes_with_comments.js
@@ -0,0 +1,187 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+exports.mockNodesWithComments = {
+gplv3Node: {
+ "lineno": 1,
+ "children": [
+ {
+ "type": 2,
+ "value": "myObj",
+ "lineno": 18,
+ "start": 716,
+ "end": 768,
+ "children": [],
+ "blockComments": [
+ "*@licstart The following is the entire license notice for the JavaScript code in this page.* A Fake JS Library\u000a * Copyright (C) 2011 Patrick Star\u000a * \u000a * This program is free software: you can redistribute it and/or modify\u000a * it under the terms of the GNU General Public License as published by\u000a * the Free Software Foundation, either version 3 of the License, or\u000a * (at your option) any later version.\u000a * \u000a * This program is distributed in the hope that it will be useful,\u000a * but WITHOUT ANY WARRANTY; without even the implied warranty of\u000a * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\u000a * GNU General Public License for more details.\u000a * \u000a * You should have received a copy of the GNU General Public License\u000a * along with this program. If not, see .\u000a @licend The above is the entire license notice for the JavaScript code in this page."
+ ],
+ "expression": {
+ "type": 46,
+ "value": "(",
+ "lineno": 18,
+ "start": 716,
+ "end": 768,
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 18,
+ "start": 716,
+ "end": 735,
+ "children": [
+ {
+ "type": 35,
+ "value": ".",
+ "lineno": 18,
+ "start": 716,
+ "end": 730,
+ "children": [
+ {
+ "type": 60,
+ "value": "myObj",
+ "lineno": 18,
+ "start": 716,
+ "end": 721,
+ "children": []
+ },
+ {
+ "type": 60,
+ "value": "myMethod",
+ "lineno": 18,
+ "start": 722,
+ "end": 730,
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 60,
+ "value": "init",
+ "lineno": 18,
+ "start": 731,
+ "end": 735,
+ "children": []
+ }
+ ]
+ },
+ {
+ "type": 55,
+ "value": "(",
+ "lineno": 18,
+ "start": 735,
+ "end": 768,
+ "children": [
+ {
+ "type": 62,
+ "value": "http://www.example.com/file.js",
+ "lineno": 18,
+ "start": 736,
+ "end": 768,
+ "children": []
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "type": 94,
+ "value": "var",
+ "lineno": 21,
+ "start": 798,
+ "end": 803,
+ "children": [
+ {
+ "type": 60,
+ "value": "i",
+ "lineno": 21,
+ "start": 802,
+ "end": 803,
+ "children": [],
+ "name": "i",
+ "readOnly": false,
+ "initializer": {
+ "type": 61,
+ "value": 0,
+ "lineno": 21,
+ "start": 806,
+ "end": 807,
+ "children": []
+ },
+ "blockComment": null
+ }
+ ],
+ "destructurings": [],
+ "blockComments": [
+ " a single line comment.",
+ " another single line comment."
+ ]
+ }
+ ],
+ "type": 42,
+ "funDecls": [],
+ "varDecls": [
+ {
+ "type": 60,
+ "value": "i",
+ "lineno": 21,
+ "start": 802,
+ "end": 803,
+ "children": [],
+ "name": "i",
+ "readOnly": false,
+ "initializer": {
+ "type": 61,
+ "value": 0,
+ "lineno": 21,
+ "start": 806,
+ "end": 807,
+ "children": []
+ },
+ "blockComment": null
+ }
+ ],
+ "modDefns": {
+ "table": {},
+ "size": 0
+ },
+ "modAssns": {
+ "table": {},
+ "size": 0
+ },
+ "modDecls": {
+ "table": {},
+ "size": 0
+ },
+ "modLoads": {
+ "table": {},
+ "size": 0
+ },
+ "impDecls": [],
+ "expDecls": [],
+ "exports": {
+ "table": {},
+ "size": 0
+ },
+ "hasEmptyReturn": false,
+ "hasReturnWithValue": false,
+ "isGenerator": false
+}
+}; \ No newline at end of file
diff --git a/test/mock/realHtml.html b/test/mock/realHtml.html
new file mode 100644
index 0000000..54ec6e8
--- /dev/null
+++ b/test/mock/realHtml.html
@@ -0,0 +1,226 @@
+<!DOCTYPE HTML>
+<html lang="en">
+ <head>
+<!-- /**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+-->
+ <meta charset=utf-8>
+ <title> Lightspark on GNU/Linux Trisquel | lduros.net </title>
+
+
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+
+ <!-- 1140px Grid styles for IE -->
+ <!--[if lte IE 9]><link rel="stylesheet" href="css/ie.css" type="text/cs
+ s" media="screen" /><![endif]-->
+
+ <!-- The 1140px Grid - http://cssgrid.net/ -->
+ <link rel="stylesheet" href="/assets/css/1140.css" type="text/css" media="screen" />
+
+ <!-- Your styles -->
+ <link rel="stylesheet" href="/assets/css/styles.css" type="text/css" media="screen" />
+ <link href="/assets/js/prettify/prettify.css" type="text/css" rel="stylesheet" />
+
+
+
+
+ <!--css3-mediaqueries-js - http://code.google.com/p/css3-mediaqueries-js/ - Enables media queries in some unsupported browsers-->
+ <script type="text/javascript" src="js/css3-mediaqueries.js"></script>
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <script src="/assets/js/jquery1.5.1.min.js"></script>
+ <script src="/assets/js/jqueryui.js"></script>
+
+ <script src="/assets/js/prettify/prettify.js"></script>
+
+
+ <script type="text/javascript">
+/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */
+(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete
+t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var N=/Until$/,O=/^(?:parents|prevUntil|prevAll)/,P=/,/,Q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,S=f.expr.match.POS,T={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(V(this,a,!1),"not",a)},filter:function(a){return this.pushStack(V(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=S.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|object|embed|option|style)/i,bb=/checked\s*(?:[^=]|=\s*.checked.)/i,bc=/\/(java|ecma)script/i,bd=/^\s*<!(?:\[CDATA\[|\-\-)/,be={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bb.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!ba.test(a[0])&&(f.support.checkClone||!bb.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean
+(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bk(k[i]);else bk(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bc.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/([A-Z]|^ms)/g,bp=/^-?\d+(?:px)?$/i,bq=/^-?\d/,br=/^([\-+])=([\-+.\de]+)/,bs={position:"absolute",visibility:"hidden",display:"block"},bt=["Left","Right"],bu=["Top","Bottom"],bv,bw,bx;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bv(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=br.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bv)return bv(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return by(a,b,d);f.swap(a,bs,function(){e=by(a,b,d)});return e}},set:function(a,b){if(!bp.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cr(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cq("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cq("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cr(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cq("show",1),slideUp:cq("hide",1),slideToggle:cq("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return d.step(a)}var d=this,e=f.fx;this.startTime=cn||co(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&f.timers.push(g)&&!cl&&(cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||co(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cs=/^t(?:able|d|h)$/i,ct=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cu(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cs.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
+ </script>
+<link rel="alternate" type="application/atom+xml" title="lduros.net Atom Feed" href="/posts/feed">
+ </head>
+
+<body class="content-piece" onload="prettyPrint()">
+
+
+<!-- Start header -->
+ <header id="site-header" class="container">
+ <div class="site-title container">
+ <div class="row">
+ <hgroup class="sixcol">
+ <a href="/" class="logo"><img src="/assets/images/template/logo.png" alt="lduros.net" title="lduros.net"/></a>
+ <h1>loïc duros</h1>
+
+ <h2><span>Web Developer</span></h2>
+ </hgroup>
+ </div>
+ </div>
+ <nav>
+ <div class="container">
+ <div class="row">
+ <ul class="twelvecol">
+
+ <li class="first"><a href="/" class="">Main</a></li>
+ <li><a href="/contact/" class="">Contact</a></li>
+ <li><a class="feed-button" title="Atom Feed" href="/posts/feed/">Feed</a></li>
+ </ul>
+ </div>
+ </div>
+ </nav>
+ </header>
+
+<!-- End header -->
+
+
+<div class="container body article">
+
+
+
+<div class="row">
+<article class="eightcol" id="content">
+<div>
+<h1>Lightspark on GNU/Linux Trisquel</h1>
+<time datetime="2011-05-29">
+May 29, 2011
+</time>
+<p>DISCLAIMER: At this time, Lightspark still does not work on the majority of Flash-based apps and animations.</p>
+
+<p>A while ago I have decided to depart from Ubuntu for a bit and try out <a href="http://trisquel.info/">Trisquel</a>, which is based on Ubuntu but 100% free. So far it has been fun, the community is a lot more ethically-oriented and smaller than Ubuntu, while still retaining the advantage of using all the knowledge-base available with Ubuntu. </p>
+<p>I haven't totally given up non-free software though; for instance I had to build the drivers for my <a href="http://www.broadcom.com/support/802.11/linux_sta.php">wireless</a>, which has a special proprietary license. (Unlike Ubuntu, there is no package for it or for anything that isn't 100% free.)
+Getting as close as possible to using as much free as possible is an interesting exercise.
+Another issue I have is that I've been using Flash and Actionscript 3.0 as a developer and was looking for an alternative. Gnash is available but it doesn't run ActionScript 3.0 apps and animations. That's when I stumbled upon <a href="http://sourceforge.net/apps/trac/lightspark">Lightspark</a>, a much needed modern alternative to Flash Player in C++. However, Lightspark isn't not currently available as a package in Trisquel and building it from the source is rather time consuming since it has a lot of dependencies. I've raised the question on the Trisquel mailing list (there might be a reason to this), but I thought I'd share the small issues I had building it.</p>
+<p>The readme text lists a lot of dependencies beyond build-essential and the like:
+llvm-2.7, sdl, opengl, curl, zlib, libavcodec, ftgl, libglew, fontconfig, pcre, pulseaudio-lib, xulrunner-dev, cmake, nasm, and a recent version of libxml++
+I used aptitude search .... to find the most appropriate ones. I didn't have libjpeg-dev installed and cmake would have an issue with that. I also had to install libboost-all-dev.</p>
+<p>Finally, once everything seemed to be ok, I still had a problem with libxml. Here is what I'd get:</p>
+<pre><code class="prettyprint">-- checking for module 'libxml++-2.6&gt;=2.33.1'
+-- package 'libxml++-2.6&gt;=2.33.1' not found
+CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
+ A required package was not found
+Call Stack (most recent call first):
+/usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
+ CMakeLists.txt:156 (pkg_check_modules)
+
+</code></pre>
+<p>Nothing too hard to figure out here, the line 156 has an issue:</p>
+<pre><code class="prettyprint">pkg_check_modules(XMLPP REQUIRED libxml++-2.6&gt;=2.33.1)
+</code></pre>
+<p>Replacing line 156 will allow cmake to configure it properly:</p>
+<pre><code class="prettyprint">pkg_check_modules(XMLPP REQUIRED libxml++-2.6)
+</code></pre>
+<p>After that, although sudo make install was supposed to install the plugin system-wide, I still didn't see it in my plugins. To see it appear in my plugin window and in about:plugins, I copied the following file to ~/.mozilla/plugins:</p>
+<pre><code class="prettyprint">lightspark/objs/x86_64/Release/lib/liliblightsparkplugin.so
+</code></pre>
+<p>I can see it now, and it's listed as:</p>
+<pre><code class="prettyprint">Shockwave Flash
+
+File: liblightsparkplugin.so
+Version:
+Shockwave Flash 10.2 r480
+
+</code></pre>
+</div>
+</article>
+</div>
+<!--<aside id="right" class="c3">
+
+
+</aside>-->
+
+
+</div>
+
+
+ <!-- Start Footer -->
+ <footer class="container">
+ <div class="row">
+ <section class="fivecol mtwocol about">
+
+ <h1>About Me</h1>
+ <ul>
+ <li>From <a href="http://en.wikipedia.org/wiki/Lower_Normandy">Normandy, France</a>.</li>
+ <li>Living in the Philadelphia Area.</li>
+ <li>Currently employed at the <a href="http://www.upenn.edu">University of Pennsylvania</a>.</li>
+
+ <li>Working mostly on back-end and front-end web development.</li>
+ <li>Using free open-source software and technologies.</li>
+ </ul>
+
+<!-- <figure class="pic">
+ <img src="/assets/images/loic2.jpg" width="300" alt="Loic Duros"/>
+ </figure>
+-->
+ </section>
+
+
+ <section class="fourcol about">
+
+ <h1>Favorites</h1>
+
+ <ul class="no-margin">
+ <li><ul>
+ Fiction:
+ <li><a href="http://en.wikipedia.org/wiki/Man%27s_Fate">Man's Fate</a>, André Malraux</li>
+ </ul>
+ </li>
+
+ <li>
+ <ul>
+
+ Nonfiction:
+ <li><a href="http://www.edwardgoldsmith.org/page209.html">The Way: An Ecological World-View</a>, Edward Goldsmith</li>
+ <li>Simple &amp; Direct, Jacques Barzun</li>
+ </ul>
+ </li>
+
+ <li>
+ <ul>
+
+ Music:
+ <li><a href="http://en.wikipedia.org/wiki/Paradise_Lost_%28band%29">Paradise Lost</a></li>
+ <li><a href="http://en.wikipedia.org/wiki/Anathema_%28band%29">Anathema</a></li>
+ <li><a href="http://en.wikipedia.org/wiki/Metallica">Metallica</a></li>
+ <li><a href="http://en.wikipedia.org/wiki/Machine_Head_%28band%29">Machine Head</a></li>
+
+ </ul>
+ <li>
+
+ <ul>
+ OS:
+ <li><a href="http://www.debian.org/">Debian</a></li>
+ <li><a href="http://trisquel.info/">Trisquel GNU/Linux</a>
+ </ul>
+ </li>
+ </li>
+
+ </ul>
+ </section>
+
+ </div>
+</footer>
+ <!-- End Footer -->
+
+ </body>
+</html>
diff --git a/test/test-accepted_scripts.js b/test/test-accepted_scripts.js
new file mode 100644
index 0000000..d2df2af
--- /dev/null
+++ b/test/test-accepted_scripts.js
@@ -0,0 +1,64 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var acceptedScripts = require('script_entries/accepted_scripts')
+ .acceptedScripts;
+
+exports.testAddAScript = function (assert) {
+ var str = "http://www.lduros.net/assets/blah.js";
+ var script = {inline: false, contents: str};
+ assert.strictEqual(script.contents, str);
+ assert.strictEqual(
+ acceptedScripts.addAScript('http://www.example.org/', script), true);
+ var fetchedScript = acceptedScripts.getScripts('http://www.example.org/');
+ assert.ok(fetchedScript);
+ assert.strictEqual(fetchedScript[0].contents, str);
+};
+
+exports.testAddAScriptTwice = function (assert) {
+ var str = "http://www.lduros.net/assets/blah.js";
+ var script = {inline:false, contents: str};
+ assert.strictEqual(
+ acceptedScripts.addAScript('http://www.example.org/', script), false);
+};
+
+exports.testIsFound = function (assert) {
+ var url = 'http://lduros.net/';
+ var str = "http://www.lduros.net/assets/blah.js";
+ var script = {inline:false, contents: str};
+ acceptedScripts.addAScript('http://lduros.net/', script);
+ assert.strictEqual(acceptedScripts.isFound(url, script), true);
+};
+
+exports.testIsFoundHash = function (assert) {
+ var str = "var i = 0;";
+ var hash = '1621f3b5cfc1c3753f347349677f53e82285a2f1';
+
+ // Unline in test-all_scripts.js, we are not adding hash here.
+ // The hash property should be added during addAScript execution.
+ var obj = {'inline': true, 'contents': str};
+ acceptedScripts.addAScript('http://example.com/', obj);
+ assert.strictEqual(
+ acceptedScripts.scripts['http://example.com/'][acceptedScripts.scripts['http://example.com/'].length -1].hash, hash);
+ assert.strictEqual(
+ acceptedScripts.isFound('http://example.com/', obj), true);
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-all_scripts.js b/test/test-all_scripts.js
new file mode 100644
index 0000000..4a05b19
--- /dev/null
+++ b/test/test-all_scripts.js
@@ -0,0 +1,39 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var allScripts = require('script_entries/all_scripts').allScripts;
+
+exports.truncateDataTest = function(test) {
+ var str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ultricies molestie tellus, eu ullamcorper dui luctus sit amet. Morbi sed urna eu justo malesuada bibendum nec non est. Sed sagittis sodales ullamcorper. Mauris dolor arcu, dignissim ac sollicitudin ac, tempus at orci. Curabitur pretium risus id urna congue cursus. Nulla ullamcorper faucibus nibh, eget ultrices ante vestibulum id. Vestibulum elementum ullamcorper mi, id ultrices lacus faucibus et. Nullam lectus augue, suscipit a elementum at, malesuada eget nulla. Aenean tempus ultrices elit ut vulputate. Ut congue magna ultricies felis rutrum eget ultricies nibh vehicula. In id pellentesque risus. Pellentesque aliquam quam eros, quis placerat eros. Cras molestie, turpis et consectetur sollicitudin, magna enim mattis lectus, et adipiscing erat urna in risus. Vestibulum sed arcu vitae mauris ornare ultricies a sit amet leo. Praesent pharetra, urna in varius fermentum, neque nibh tempor justo, id ullamcorper magna amet.…";
+ var t = {contents: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ultricies molestie tellus, eu ullamcorper dui luctus sit amet. Morbi sed urna eu justo malesuada bibendum nec non est. Sed sagittis sodales ullamcorper. Mauris dolor arcu, dignissim ac sollicitudin ac, tempus at orci. Curabitur pretium risus id urna congue cursus. Nulla ullamcorper faucibus nibh, eget ultrices ante vestibulum id. Vestibulum elementum ullamcorper mi, id ultrices lacus faucibus et. Nullam lectus augue, suscipit a elementum at, malesuada eget nulla. Aenean tempus ultrices elit ut vulputate. Ut congue magna ultricies felis rutrum eget ultricies nibh vehicula. In id pellentesque risus. Pellentesque aliquam quam eros, quis placerat eros. Cras molestie, turpis et consectetur sollicitudin, magna enim mattis lectus, et adipiscing erat urna in risus. Vestibulum sed arcu vitae mauris ornare ultricies a sit amet leo. Praesent pharetra, urna in varius fermentum, neque nibh tempor justo, id ullamcorper magna amet. Something after 1000 character here should be removed."};
+
+ test.assertEqual(str.length, 1001);
+ allScripts.truncateJsData(t);
+ test.assertEqual(str, t.contents);
+
+};
+
+exports.isFoundTest = function (test) {
+ var str = "var i = 0;";
+ var hash = '1621f3b5cfc1c3753f347349677f53e82285a2f1';
+ var obj = {'inline': true, 'contents': str, 'hash': hash};
+ allScripts.scripts['http://example.com/'] = [obj];
+ test.assertEqual(allScripts.isFound('http://example.com/', obj), true);
+};
diff --git a/test/test-allowed_referrers.js b/test/test-allowed_referrers.js
new file mode 100644
index 0000000..c66b907
--- /dev/null
+++ b/test/test-allowed_referrers.js
@@ -0,0 +1,54 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const allowedRef = require('http_observer/allowed_referrers').allowedReferrers;
+
+var addUrls = function () {
+ allowedRef.addPage('http://www.example.org');
+ allowedRef.addPage('http://www.fsf.org');
+ allowedRef.addPage('http://www.debian.org');
+ allowedRef.addPage('http://lduros.net');
+};
+
+exports.testAddPage = function (test) {
+ allowedRef.clearAllEntries();
+ addUrls();
+ test.assertEqual(allowedRef.allowed['http://www.example.org'], 1);
+};
+
+exports.testCheckUrlInArray = function (test) {
+ allowedRef.clearAllEntries();
+ addUrls();
+ test.assertEqual(true, allowedRef.urlInAllowedReferrers('http://lduros.net'));
+};
+
+exports.testCheckUrlNotInArray = function (test) {
+ allowedRef.clearAllEntries();
+ addUrls();
+ test.assertEqual(undefined, allowedRef.urlInAllowedReferrers('http://lemonde.fr'));
+};
+
+exports.testClearSinglePageEntry = function (test) {
+ allowedRef.clearAllEntries();
+ addUrls();
+ test.assertEqual(true, allowedRef.urlInAllowedReferrers('http://www.fsf.org'));
+ allowedRef.clearSinglePageEntry('http://www.fsf.org');
+ test.assertEqual(undefined, allowedRef.urlInAllowedReferrers('http://www.fsf.org'));
+};
diff --git a/test/test-bug-frozen.js b/test/test-bug-frozen.js
new file mode 100644
index 0000000..dd47d98
--- /dev/null
+++ b/test/test-bug-frozen.js
@@ -0,0 +1,44 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var main = require('main');
+var tabs = require('sdk/tabs');
+
+/*exports.testBug = function (assert, done) {
+ var tab = tabs.open('http://www.yahoo.com');
+ //var tab2 = tabs.open('about:home');
+ //tab.activate();
+ tabs.on('ready', function (tab) {
+ if (tab.url == 'http://www.yahoo.com') {
+ tab.url = 'http://messenger.yahoo.com/';
+ } else {
+ tabs.activeTab.attach({contentScript:
+ "window.history.back();"
+ });
+ require("sdk/timers").setTimeout(function () {
+ assert.ok(true);
+ done();
+ }, 2000);
+ //tab.close();
+ }
+ });
+};*/
+
+//require('sdk/test').run(exports);
diff --git a/test/test-contact_finder.js b/test/test-contact_finder.js
new file mode 100644
index 0000000..4308145
--- /dev/null
+++ b/test/test-contact_finder.js
@@ -0,0 +1,214 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var pageMod = require("sdk/page-mod");
+var tabs = require("sdk/tabs");
+var data = require("sdk/self").data;
+
+exports.testDetectEmailAddressFound = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "data:*",
+ contentScriptWhen: 'end',
+
+ contentScriptFile: [data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js')],
+
+ contentScript: "contactFinder.init(true); contactFinder.searchForContactLink('http://example.org/'); console.log('link', document.getElementsByTagName('a')[0].href)",
+
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ console.log('event is', message.event);
+ if (message.event === 'certainEmailAddressFound') {
+ test.assertEqual(true, true);
+ mod.destroy();
+ test.done();
+
+ }
+ });
+ }
+
+ });
+
+ tabs.open("data:text/html;charset=utf-8,<!doctype html>%0D%0A<html>%0D%0A<head><script type='librejs/blocked'>var num %3D 5%3B<%2Fscript><%2Fhead>%0D%0A%0D%0A<body><h1 id='test'>Test<%2Fh1><a href=\"mailto:webmaster@example.org\">Contact</a><%2Fbody><%2Fhtml>");
+
+};
+
+exports.testDetectEmailAddressFoundTwoLinks = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "data:*",
+ contentScriptWhen: 'end',
+
+ contentScriptFile: [data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js')],
+
+
+ contentScript: "contactFinder.init(true); contactFinder.searchForContactLink('http://example.org/'); console.log('link', document.getElementsByTagName('a')[0].href)",
+
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ console.log('event is', message.event);
+ if (message.event === 'certainEmailAddressFound') {
+ test.assert(true);
+ test.done();
+ mod.destroy();
+ }
+ });
+ }
+
+ });
+
+ tabs.open("data:text/html;charset=utf-8,<!doctype html>%0D%0A<html>%0D%0A<head><script type='librejs/blocked'>var num %3D 5%3B<%2Fscript><%2Fhead>%0D%0A%0D%0A<body><h1 id='test'>Test<%2Fh1><a href=\"blah\">Random Link</a><a href=\"mailto:webmaster@example.org\">Contact</a><a href=\"blah\">Random Link</a><%2Fbody><%2Fhtml>");
+
+};
+
+
+exports.testDetectEmailAddressNotDomain = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "data:*",
+ contentScriptWhen: 'end',
+
+ contentScriptFile: [data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js')],
+
+ contentScript: "contactFinder.init(true); contactFinder.searchForContactLink('http://example.org/'); console.log('link', document.getElementsByTagName('a')[0].href)",
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ console.log('event is', message.event);
+ if (message.event === 'uncertainEmailAddressFound') {
+ test.assert(true);
+ test.done();
+ mod.destroy();
+ }
+ });
+ }
+ });
+
+ tabs.open("data:text/html;charset=utf-8,<!doctype html>%0D%0A<html>%0D%0A<head><script type='librejs/blocked'>var num %3D 5%3B<%2Fscript><%2Fhead>%0D%0A%0D%0A<body><h1 id='test'>Test<%2Fh1><a href=\"mailto:webmaster@notsamedomain.org\">Contact</a><%2Fbody><%2Fhtml>");
+
+};
+
+exports.testCertainLink = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "data:*",
+ contentScriptWhen: 'end',
+
+ contentScriptFile: [data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js')],
+
+ contentScript: "contactFinder.init(true); contactFinder.searchForContactLink('http://example.org/'); console.log('link', document.getElementsByTagName('a')[0].href)",
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ console.log('event is', message.event);
+ if (message.event === 'certainLinkFound') {
+ test.assert(true);
+ test.done();
+ mod.destroy();
+ }
+ });
+ }
+ });
+
+ tabs.open("data:text/html;charset=utf-8,<!doctype html>%0D%0A<html>%0D%0A<head><script type='librejs/blocked'>var num %3D 5%3B<%2Fscript><%2Fhead>%0D%0A%0D%0A<body><h1 id='test'>Test<%2Fh1><a href=\"somelink.html\">some link</a><a href=\"http://example.org/contact.html\">Contact Us</a><%2Fbody><%2Fhtml>");
+
+};
+/*
+exports.testCertainReal = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "*",
+ contentScriptWhen: 'end',
+
+ contentScriptFile: [data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js')],
+
+ contentScript: "contactFinder.init(true); contactFinder.searchForContactLink('http://lduros.net'); console.log('link', document.getElementsByTagName('a')[0].href)",
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ console.log('event is', message.event);
+ if (message.event === 'certainLinkFound') {
+ test.assert(true);
+ test.done();
+ mod.destroy();
+ }
+ });
+ }
+ });
+
+ tabs.open("http://lduros.net/");
+
+};
+*/
+
+exports.testCertainFeedbackAsPageWorker = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "*",
+ contentScriptWhen: 'end',
+
+ contentScriptFile: [data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js')],
+
+ contentScript: "contactFinder.init(true); contactFinder.searchForContactLink('http://lduros.net/assets/librejs/tests/contact-tests/'); console.log('link', document.getElementsByTagName('a')[0].href)",
+
+ onAttach: function (worker) {
+
+ worker.on('message', function (message) {
+
+ console.log('event is', message.event);
+ console.log("We've got a certainLinkFound!");
+ if (message.event === 'certainLinkFound') {
+
+ test.assert(true);
+ test.done();
+ mod.destroy();
+ }
+
+ });
+ }
+ });
+
+ tabs.open("http://lduros.net/assets/librejs/tests/contact-tests/");
+
+};
+
+
+
diff --git a/test/test-contact_finder2.js b/test/test-contact_finder2.js
new file mode 100644
index 0000000..907e2f0
--- /dev/null
+++ b/test/test-contact_finder2.js
@@ -0,0 +1,88 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var pageMod = require("sdk/page-mod");
+var tabs = require("sdk/tabs");
+var data = require("sdk/self").data;
+
+exports.testCertainLinkComplaintSearch = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "data:*",
+ contentScriptWhen: 'end',
+ contentScriptFile: [
+ data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js')],
+ contentScript: "contactFinder.init(); contactFinder.searchForContactLink('http://example.org/'); console.log('link', document.getElementsByTagName('a')[0].href)",
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ console.log('event is', message.event);
+ if (message.event === 'complaintSearch') {
+ test.assert(true);
+ test.done();
+ mod.destroy();
+ }
+ });
+ }
+ });
+
+ tabs.open("data:text/html;charset=utf-8,<!doctype html>%0D%0A<html>%0D%0A<head><script type='librejs/blocked'>var num %3D 5%3B<%2Fscript><%2Fhead>%0D%0A%0D%0A<body><h1 id='test'>Test<%2Fh1><a href=\"somelink.html\">some link</a><a href=\"http://example.org/contact.html\">Feedback</a><%2Fbody><%2Fhtml>");
+
+};
+
+exports.testComplaintSearch = function (test) {
+
+ // async
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "data:*",
+ contentScriptWhen: 'end',
+ contentScriptFile: [
+ data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js')],
+ contentScript: "contactFinder.init(); contactFinder.searchForContactLink('http://example.org/'); console.log('link', document.getElementsByTagName('a')[0].href)",
+
+ onAttach: function (worker) {
+
+ worker.on('message', function (message) {
+
+ console.log('event is', message.event);
+
+ if (message.event === 'complaintSearch') {
+ test.assertEqual(message.urlSearch.type, 'certainLinkFound');
+ test.assertEqual(message.urlSearch.linkValue, 'http://example.org/contact.html');
+ test.done();
+ mod.destroy();
+ }
+ });
+
+ }
+
+ });
+
+ tabs.open("data:text/html;charset=utf-8,<!doctype html>%0D%0A<html>%0D%0A<head><script type='librejs/blocked'>var num %3D 5%3B<%2Fscript><%2Fhead>%0D%0A%0D%0A<body><h1 id='test'>Test<%2Fh1><a href=\"somelink.html\">some link</a><a href=\"http://example.org/contact.html\">Feedback</a><%2Fbody><%2Fhtml>");
+
+};
diff --git a/test/test-cors-bug.js b/test/test-cors-bug.js
new file mode 100644
index 0000000..2c32e3f
--- /dev/null
+++ b/test/test-cors-bug.js
@@ -0,0 +1,60 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * FIXME: This test relies on the cors-test2.html file (visible in bzr
+ * history), which in turn relies on an external PHP script that isn't around
+ * anymore. Because of this, I'm commenting out this test for now.
+ */
+
+/*
+var pageMod = require("sdk/page-mod");
+var tabs = require("sdk/tabs");
+var data = require("sdk/self").data;
+
+exports.testCORS = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: /.*cors-test2.html/,
+ contentScriptWhen: 'end',
+
+ contentScript: "window.setTimeout(function () { " +
+ "var content = document.getElementById(\"cross\").innerHTML;" +
+ "if (/snippet/.test(content)) {" +
+ "self.postMessage(\"Done!\");} " +
+ "}, 5000); ",
+
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ console.log("CORS bug test page fully loaded");
+
+ if (message === 'Done!') {
+ test.assertEqual(true, true);
+ test.done();
+ mod.destroy();
+ }
+ });
+ }
+ });
+
+ tabs.open(data.url("test/cors-test2.html"));
+};
+*/
diff --git a/test/test-crypto-a.js b/test/test-crypto-a.js
new file mode 100644
index 0000000..65e96ed
--- /dev/null
+++ b/test/test-crypto-a.js
@@ -0,0 +1,43 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+var crypto = require("script_entries/crypto");
+var longString = require("./mock/long_string.js").longString;
+var Request = require("sdk/request").Request;
+var cRequest = require("html_script_finder/dom_handler/request");
+
+exports.testSha1EncryptTest = function(assert) {
+ var str = "This is my test string";
+ assert.equal(crypto.sha1Encrypt(str), 'e925bfd93e14174c2b2c83f68b3d3243df3005ef');
+};
+
+exports.testSha1EncryptjQueryTest = function(assert, done) {
+ var request = Request({
+ 'url': 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'
+ });
+ request.on('complete', function(response) {
+ assert.equal(response.status, 200);
+ assert.equal(crypto.sha1Encrypt(response.text),
+ 'd6c1f41972de07b09bfa63d2e50f9ab41ec372bd');
+ done();
+ });
+ request.get();
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-crypto-b.js b/test/test-crypto-b.js
new file mode 100644
index 0000000..295e4c8
--- /dev/null
+++ b/test/test-crypto-b.js
@@ -0,0 +1,357 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+/* list generated one time using tools/jslibfetcher.py */
+
+var list = [
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.1.1/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.3.0/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.3.1/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.4.3/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.5.1/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dojo/dojo.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.1.1/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.3.0/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.3.1/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.4.3/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.5.1/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.xd.js.uncompressed.js",
+ "https://ajax.googleapis.com/ajax/libs/ext-core/3.0.0/ext-core.js",
+ "https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js",
+ "https://ajax.googleapis.com/ajax/libs/ext-core/3.0.0/ext-core-debug.js",
+ "https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core-debug.js",
+ "http://code.jquery.com/jquery-1.0.pack.js",
+ "http://code.jquery.com/jquery-1.0.1.pack.js",
+ "http://code.jquery.com/jquery-1.0.1.js",
+ "http://code.jquery.com/jquery-1.0.2.pack.js",
+ "http://code.jquery.com/jquery-1.0.2.js",
+ "http://code.jquery.com/jquery-1.0.3.pack.js",
+ "http://code.jquery.com/jquery-1.0.3.js",
+ "http://code.jquery.com/jquery-1.0.4.pack.js",
+ "http://code.jquery.com/jquery-1.0.4.js",
+ "http://code.jquery.com/jquery-1.1.pack.js",
+ "http://code.jquery.com/jquery-1.1.js",
+ "http://code.jquery.com/jquery-1.1.1.pack.js",
+ "http://code.jquery.com/jquery-1.1.1.js",
+ "http://code.jquery.com/jquery-1.1.2.pack.js",
+ "http://code.jquery.com/jquery-1.1.2.js",
+ "http://code.jquery.com/jquery-1.1.3.pack.js",
+ "http://code.jquery.com/jquery-1.4.min.js",
+ "http://code.jquery.com/jquery-1.4.js",
+ "http://code.jquery.com/jquery-1.4.1.min.js",
+ "http://code.jquery.com/jquery-1.4.1.js",
+ "http://code.jquery.com/jquery-1.4.2.min.js",
+ "http://code.jquery.com/jquery-1.4.2.js",
+ "http://code.jquery.com/jquery-1.4.3.min.js",
+ "http://code.jquery.com/jquery-1.4.4.js",
+ "http://code.jquery.com/jquery-1.5.min.js",
+ "http://code.jquery.com/jquery-1.5.js",
+ "http://code.jquery.com/jquery-1.5.1.min.js",
+ "http://code.jquery.com/jquery-1.5.1.js",
+ "http://code.jquery.com/jquery-1.5.2.min.js",
+ "http://code.jquery.com/jquery-1.5.2.js",
+ "http://code.jquery.com/jquery-1.6.min.js",
+ "http://code.jquery.com/jquery-1.6.js",
+ "http://code.jquery.com/jquery-1.6.1.min.js",
+ "http://code.jquery.com/jquery-1.6.1.js",
+ "http://code.jquery.com/jquery-1.6.2.min.js",
+ "http://code.jquery.com/jquery-1.6.2.js",
+ "http://code.jquery.com/jquery-1.6.3.min.js",
+ "http://code.jquery.com/jquery-1.6.3.js",
+ "http://code.jquery.com/jquery-1.6.4.min.js",
+ "http://code.jquery.com/jquery-1.6.4.js",
+ "http://code.jquery.com/jquery-1.7.min.js",
+ "http://code.jquery.com/jquery-1.7.js",
+ "http://code.jquery.com/jquery-1.7.1.min.js",
+ "http://code.jquery.com/jquery-1.7.1.js",
+ "http://code.jquery.com/jquery-1.7.2.min.js",
+ "http://code.jquery.com/jquery-1.7.2.js",
+ "http://code.jquery.com/jquery-1.8.0.min.js",
+ "http://code.jquery.com/jquery-1.8.0.js",
+ "http://code.jquery.com/jquery-1.8.1.min.js",
+ "http://code.jquery.com/jquery-1.8.1.js",
+ "http://code.jquery.com/jquery-1.8.2.min.js",
+ "http://code.jquery.com/jquery-1.8.2.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.1.3.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.1.3.1.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.1.3.1.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.1.4.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.1.4.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.1.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.1.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.1.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.2.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.2.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.2.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.3.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.3.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.4.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.4.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.4.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.5.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.5.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.5.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.2.6.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.3.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.3.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.3.1.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js",
+ "http://jqueryjs.googlecode.com/files/jquery-1.3.2.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.6.0/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.6.0/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.1.1/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.1.2/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.5/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.0/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.2/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.3/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.4/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.1.1/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.1.2/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.2.5/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.0/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.2/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.3/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.4/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools.js",
+ "https://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js",
+ "https://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js",
+ "https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js",
+ "https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js",
+ "https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js",
+ "https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/scriptaculous.js",
+ "https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js",
+ "https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js",
+ "https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js",
+ "https://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js",
+ "https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
+ "https://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject_src.js",
+ "https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js",
+ "https://raw.github.com/documentcloud/underscore/1.3.3/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.3.2/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.3.1/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.3.0/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.4/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.3/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.2/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.1/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.0/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.7/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.6/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.5/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.4/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.3/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.2/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.1/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.0/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.4/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.3/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.2/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.1/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.0/underscore.js",
+ "https://raw.github.com/documentcloud/underscore/1.3.3/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.3.2/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.3.1/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.3.0/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.4/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.3/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.2/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.1/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.2.0/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.7/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.6/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.5/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.4/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.3/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.2/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.1/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.1.0/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.4/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.3/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.2/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.1/underscore-min.js",
+ "https://raw.github.com/documentcloud/underscore/1.0.0/underscore-min.js",
+ "http://yui.yahooapis.com/2.6.0/build/yuiloader/yuiloader-min.js",
+ "http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader-min.js",
+ "http://yui.yahooapis.com/2.8.0r4/build/yuiloader/yuiloader-min.js",
+ "http://yui.yahooapis.com/2.8.1/build/yuiloader/yuiloader-min.js",
+ "http://yui.yahooapis.com/2.8.2/build/yuiloader/yuiloader-min.js",
+ "http://yui.yahooapis.com/2.9.0/build/yuiloader/yuiloader-min.js",
+ "http://yui.yahooapis.com/2.6.0/build/yuiloader/yuiloader.js",
+ "http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader.js",
+ "http://yui.yahooapis.com/2.8.0r4/build/yuiloader/yuiloader.js",
+ "http://yui.yahooapis.com/2.8.1/build/yuiloader/yuiloader.js",
+ "http://yui.yahooapis.com/2.8.2/build/yuiloader/yuiloader.js",
+ "http://yui.yahooapis.com/2.9.0/build/yuiloader/yuiloader.js",
+ "http://yui.yahooapis.com/3.3.0/build/yui-base/yui-base-min.js",
+ "http://yui.yahooapis.com/3.4.0/build/yui-base/yui-base-min.js",
+ "http://yui.yahooapis.com/3.4.1/build/yui-base/yui-base-min.js",
+ "http://yui.yahooapis.com/3.5.0/build/yui-base/yui-base-min.js",
+ "http://yui.yahooapis.com/3.5.1/build/yui-base/yui-base-min.js",
+ "http://yui.yahooapis.com/3.6.0/build/yui-base/yui-base-min.js",
+ "http://yui.yahooapis.com/3.3.0/build/yui-base/yui-base.js",
+ "http://yui.yahooapis.com/3.4.0/build/yui-base/yui-base.js",
+ "http://yui.yahooapis.com/3.4.1/build/yui-base/yui-base.js",
+ "http://yui.yahooapis.com/3.5.0/build/yui-base/yui-base.js",
+ "http://yui.yahooapis.com/3.5.1/build/yui-base/yui-base.js",
+ "http://yui.yahooapis.com/3.6.0/build/yui-base/yui-base.js"
+];
+
+list = ["http://code.jquery.com/jquery-1.8.2.min.js"];
+const scriptsCached = require("script_entries/scripts_cache").scriptsCached;
+
+
+var counter = 0;
+var totalScripts = 0;
+
+var popAndEncryptRemoteScript = function (test) {
+ try {
+ var currentUrl = list.pop();
+ var script = {url: currentUrl};
+ require('html_script_finder/dom_handler/request').request(script,
+ function (script, data) {
+ //console.log('"',scriptsCached.getHash(data), '":
+ //{"filename": "', currentUrl, '", "result": 6}');
+ counter++;
+ popAndEncryptRemoteScript(test);
+
+
+ }).request();
+
+ } catch (e) {
+ test.assertEqual(counter, totalScripts);
+ test.done();
+ return;
+ }
+
+};
+
+exports.sha1EncryptListTest = function (test) {
+ totalScripts = list.length;
+ test.waitUntilDone(100000);
+ popAndEncryptRemoteScript(test);
+};
diff --git a/test/test-domHandler.js b/test/test-domHandler.js
new file mode 100644
index 0000000..093df8b
--- /dev/null
+++ b/test/test-domHandler.js
@@ -0,0 +1,71 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// these tests require Firefox 11 or later
+// using following command to run after placing nightly is /usr/local/:
+// cfx --binary=/usr/local/bin/firefox-nightly test -f domHandler
+
+var domHandler = require("html_script_finder/dom_handler");
+var mockDom = require("./mock/mock_dom");
+
+//var loader = test.makeSandboxedLoader();
+// access private objects from module.
+//var privateScope = loader.findSandboxForModule("html_script_finder/dom_handler").globalScope;
+
+exports.testAcceptedScriptAttribute = function (assert, done) {
+ var document = mockDom.acceptedScriptsDocument();
+ domHandler.domHandler(
+ document,
+ 'http://example.org/test.html',
+ null,
+ null,
+ function (dom) {
+ assert.equal(
+ document.getElementsByTagName('script')[0]
+ .getAttribute('data-librejs'),
+ 'accepted');
+ assert.equal(
+ document.getElementsByTagName('script')[1]
+ .getAttribute('data-librejs'),
+ 'accepted');
+ done();
+ }
+ );
+};
+
+exports.testDomWithOnAttrib = function (assert, done) {
+ var document = mockDom.domWithOnAttrib();
+
+ domHandler.domHandler (
+ document,
+ 'http://example.org/test.html',
+ null,
+ null,
+ function (dom) {
+ assert.equal(
+ document.getElementsByTagName('body')[0]
+ .getAttribute('data-librejs'),
+ 'accepted');
+ done();
+ }
+ );
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-domParser.js b/test/test-domParser.js
new file mode 100644
index 0000000..3f487c9
--- /dev/null
+++ b/test/test-domParser.js
@@ -0,0 +1,36 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+ var htmlText = "<!doctype html><html><head></head><body><script>document.write('<div id=\'jsparsed\'>JS-only content</div>');</script><div id=\'regularDiv\'></div></body></html>";
+
+
+exports.testDOMParserNotParsingJS = function (test) {
+
+ var domParser = Cc["@mozilla.org/xmlextras/domparser;1"].
+ createInstance(Ci.nsIDOMParser);
+ var dom = domParser.parseFromString(htmlText, "text/html");
+
+ test.assert(!dom.getElementById("jsparsed"));
+ test.assert(dom.getElementById("regularDiv"));
+
+};
diff --git a/test/test-free_libraries.js b/test/test-free_libraries.js
new file mode 100644
index 0000000..296ff5f
--- /dev/null
+++ b/test/test-free_libraries.js
@@ -0,0 +1,56 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+/*
+
+forget this test for now.
+
+var main = require("main");
+
+var pageMod = require("sdk/page-mod");
+var tabs = require("sdk/tabs");
+var data = require("sdk/self").data;
+
+exports.testFreeLibraryjQuery172 = function (test) {
+ test.waitUntilDone();
+
+
+
+ var mod = pageMod.PageMod({
+
+ include: "data:*",
+
+ contentScriptWhen: 'end',
+
+ contentScript: 'self.postMessage(document.getElementsByTagName("script")[0].getAttribute("data-librejs"));',
+
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ console.log('message is', message);
+ test.assertEqual(message, 'accepted');
+ //test.done();
+ //mod.destroy();
+ });
+ }
+ });
+
+ tabs.open("http://lduros.net/assets/librejs/tests/free-libraries/");
+
+};
+*/
diff --git a/test/test-html_parser.js b/test/test-html_parser.js
new file mode 100644
index 0000000..2a8e909
--- /dev/null
+++ b/test/test-html_parser.js
@@ -0,0 +1,43 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var htmlParser = require("html_script_finder/html_parser");
+
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+
+var htmlPageString = "<!doctype html><html><body class=\"home\">\n\n\n<!-- Start header -->\n <header id=\"site-header\" class=\"container\">\n <div class=\"site-title container\">\n <div class=\"row\">\n <hgroup class=\"sixcol\">\n <a href=\"/\" class=\"logo\"><img src=\"/assets/images/template/logo.png\" alt=\"lduros.net\" title=\"lduros.net\"/></a>\n <h1>loïc duros</h1>\n <h2><span>Web Developer</span></h2>\n </hgroup>\n </div>\n </div>\n <nav>\n <div class=\"container\">\n <div class=\"row\">\n <ul class=\"twelvecol\">\n <li class=\"first\"><a href=\"/\" class=\"current\">Main</a></li>\n <li><a href=\"/contact/\" class=\"\">Contact</a></li> \n <li><a class=\"feed-button\" title=\"Atom Feed\" href=\"/posts/feed/\">Feed</a></li>\n </ul> \n </div>\n </div>\n </nav>\n </header></html>";
+
+var readResult = function (result) {
+ var count = result.length;
+ var str = {};
+ var binaryInputStream = Cc["@mozilla.org/binaryinputstream;1"].
+ createInstance(Ci.nsIBinaryInputStream);
+
+ var converterInputStream = Cc["@mozilla.org/intl/converter-input-stream;1"]
+ .createInstance(Ci.nsIConverterInputStream);
+ converterInputStream.init(result.newInputStream(0), "UTF-8", count, "2");
+ for (var item in converterInputStream) {
+ console.log(item);
+ }
+ converterInputStream.readString(count, str);
+ return str.value;
+};
+
diff --git a/test/test-js_checker.js b/test/test-js_checker.js
new file mode 100644
index 0000000..ad052c0
--- /dev/null
+++ b/test/test-js_checker.js
@@ -0,0 +1,119 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const jsChecker = require("js_checker/js_checker");
+const constants = require("js_checker/constant_types");
+var checkTypes = constants.checkTypes;
+
+var init = function() {
+ var checker = jsChecker.jsChecker();
+ return checker;
+};
+
+exports.testTrivial = function(assert, done) {
+ var checker = init();
+ var jsString = "alert('internal script');";
+
+ checker.searchJs(jsString,
+ function() {
+ // FIXME, should actually be TRIVIAL
+ assert.equal(checkTypes.TRIVIAL_DEFINES_FUNCTION,
+ checker.parseTree.freeTrivialCheck.type);
+ done();
+ });
+};
+
+exports.testTrivialWithFuncDef = function(assert, done) {
+ var jsString = "function blah (arg) { return arg; };";
+
+ var checker = init();
+
+ checker.searchJs(jsString,
+ function() {
+ assert.equal(checkTypes.TRIVIAL_DEFINES_FUNCTION,
+ checker.parseTree.freeTrivialCheck.type);
+ done();
+ });
+};
+
+exports.testTrivialWithFunc = function(assert, done) {
+ var checker = init();
+
+ var jsString = "var blah = function(arg) { return arg; };";
+
+ checker.searchJs(jsString,
+ function() {
+ assert.equal(checkTypes.TRIVIAL_DEFINES_FUNCTION,
+ checker.parseTree.freeTrivialCheck.type);
+ done();
+ });
+};
+
+exports.testANontrivial = function(assert, done) {
+ var checker = init();
+
+ var jsString = "document.createElement('script');";
+ checker.searchJs(jsString,
+ function() {
+ assert.equal(checkTypes.NONTRIVIAL,
+ checker.parseTree.freeTrivialCheck.type);
+ done();
+ });
+};
+
+exports.testLambdaError1 = function(assert, done) {
+ var checker = init();
+
+ var jsString = "document.write('<scr' + 'ipt type=\"text/javascript\" src=\"' + regs_url + 'fdsfds.dew/' + regs_sitepage + '/1' + regs_rns + '@' + regs_listpos + regs_query + '\"></scr' + 'ipt>');";
+
+ checker.searchJs(jsString,
+ function() {
+ assert.equal(checkTypes.NONTRIVIAL,
+ checker.parseTree.freeTrivialCheck.type);
+ done();
+ });
+};
+
+exports.testLambdaError = function(assert, done) {
+ var jsString = "_version = 11;\nif (navigator.userAgent.indexOf('Mozilla/3') != -1)\nregs_version = 10;\n\n if (regs_version >= 11) {\ndocument.write('<scr' + 'ipt type=\"text/javascript\" src=\"' + regs_url + 'fdsfds.dew/' + regs_sitepage + '/1' + regs_rns + '@' + regs_listpos + regs_query + '\"></scr' + 'ipt>');\n}";
+
+ var checker = init();
+ checker.searchJs(jsString,
+ function() {
+ assert.equal(checkTypes.NONTRIVIAL,
+ checker.parseTree.freeTrivialCheck.type);
+ done();
+ });
+};
+
+exports.testContinueKeyword = function(assert, done) {
+ var jsString = "for (var i = 0; i < len; i++) {\n if (test) { continue; } }";
+ var checker = init();
+
+ checker.searchJs(jsString,
+ function() {
+ // FIXME, should actually be TRIVIAL
+ assert.equal(checkTypes.TRIVIAL_DEFINES_FUNCTION,
+ checker.parseTree.freeTrivialCheck.type);
+ done();
+ });
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-js_load_observer_1.js b/test/test-js_load_observer_1.js
new file mode 100644
index 0000000..d22f3e8
--- /dev/null
+++ b/test/test-js_load_observer_1.js
@@ -0,0 +1,75 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var jsLoadObserver = require("js_load_observer/js_load_observer");
+var tabs = require("sdk/tabs");
+
+// use the two buckets.
+var removedScripts = require("script_entries/removed_scripts").removedScripts;
+var acceptedScripts = require("script_entries/accepted_scripts").acceptedScripts;
+var mockDom = require("./mock/mock_dom");
+
+exports.testCheckInlineScriptAccepted = function (test) {
+ var dom = mockDom.emptyDocument();
+ var script = dom.createElement('script');
+ var e = {
+ target: script,
+ preventDefault: function () {
+ console.log('default prevented');
+ }
+ };
+
+ e.target.ownerDocument = { URL: 'http://example.org/' };
+ e.target.textContent = "var num = 10;";
+ acceptedScripts.addAScript(e.target.ownerDocument.URL, {
+ inline: true,
+ contents: e.target.textContent
+ });
+ jsLoadObserver.scriptAnalyzer.analyzeScriptBeforeExec(e);
+
+ test.assertEqual(
+ jsLoadObserver.scriptAnalyzer.checkInlineScript(e.target),
+ true,
+ "not found in accepted scripts");
+};
+
+exports.testCheckInlineScriptNotAcceptedThenAccepted = function (test) {
+ var dom = mockDom.emptyDocument();
+ var script = dom.createElement('script');
+ var e = { target: script };
+ e.target.ownerDocument = { URL: 'http://example.org/' };
+ e.target.textContent = "var num = 12;";
+
+ test.assertEqual(
+ jsLoadObserver.scriptAnalyzer.checkInlineScript(e.target),
+ false,
+ "found in accepted scripts");
+
+ acceptedScripts.addAScript(e.target.ownerDocument.URL,
+ {
+ inline: true,
+ contents: e.target.textContent
+ });
+
+ test.assertEqual(
+ jsLoadObserver.scriptAnalyzer.checkInlineScript(e.target),
+ true,
+ "not found in accepted scripts");
+};
diff --git a/test/test-js_load_observer_3.js b/test/test-js_load_observer_3.js
new file mode 100644
index 0000000..478725b
--- /dev/null
+++ b/test/test-js_load_observer_3.js
@@ -0,0 +1,146 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var tabs = require("sdk/tabs");
+var pageMod = require("sdk/page-mod");
+
+// use the two buckets.
+var removedScripts = require("script_entries/removed_scripts").removedScripts;
+var acceptedScripts = require("script_entries/accepted_scripts").acceptedScripts;
+
+var jsLoadObserver = require("js_load_observer/js_load_observer");
+
+var reset = function(url) {
+ acceptedScripts.clearScripts(url);
+};
+
+exports.testJsLoadObserverHttpObserverBypassed = function(assert, done) {
+ var url = 'http://lduros.net/assets/librejs/tests/load_observer/load_test.html';
+ var mod;
+
+ reset(url);
+
+ mod = pageMod.PageMod({
+ include: '*',
+ contentScriptWhen: 'ready',
+ contentScript: 'self.postMessage(num);',
+ onError: function(e) {
+ assert.equal(e.toString(),
+ 'ReferenceError: num is not defined',
+ 'throws ReferenceError');
+ done();
+ mod.destroy();
+ }
+ });
+
+ tabs.open(url);
+};
+
+exports.testJsLoadObserverHttpObserverBypassed2 = function(assert, done) {
+ var url = 'lduros.net/assets/librejs/tests/load_observer/wrong_mimetype/';
+ var mod;
+
+ reset(url);
+
+ mod = pageMod.PageMod({
+ include: '*',
+ contentScriptWhen: 'ready',
+ contentScript: 'self.postMessage(unsafeWindow.jsString);',
+ onAttach: function(worker) {
+ worker.on('message', function(value) {
+ assert.equal(value, null, 'JS isn\'t executed');
+ done();
+ mod.destroy();
+ });
+ }
+ });
+
+ tabs.open(url);
+};
+
+exports.testJsLoadObserverAccepted = function(assert, done) {
+ var url = 'http://lduros.net/assets/librejs/tests/load_observer/load_test.html';
+ var mod;
+
+ reset(url);
+ acceptedScripts.addAScript(url, {
+ 'inline': true,
+ 'contents': 'var num = 5;'
+ });
+
+ assert.equal(
+ acceptedScripts.scripts[url][
+ acceptedScripts.scripts[url].length - 1].hash,
+ '49ca8516cacaa673a4793aaf53f9ae8c7ed2d170',
+ 'script hash matches');
+
+ mod = pageMod.PageMod({
+ include: '*',
+ contentScriptWhen: 'ready',
+ contentScript: 'self.postMessage(unsafeWindow.num);',
+ onAttach: function(worker) {
+ worker.on('message', function(value) {
+ assert.equal(value, 5, 'javascript value is executed');
+ done();
+ mod.destroy();
+ });
+ }
+ });
+
+ tabs.open(url);
+};
+
+exports.testJsLoadObserverAcceptedExternalWrongMimeType = function(
+ assert, done
+) {
+ var url = 'lduros.net/assets/librejs/tests/load_observer/wrong_mimetype/';
+ var mod;
+
+ reset(url);
+ acceptedScripts.addAScript(url, {
+ 'inline': true,
+ 'contents': "var jsString = \"JavaScript is loaded on this page.\";" +
+ "\nalert('this is JavaScript with an HTML content-type " +
+ "response header!!');"
+ });
+
+ assert.equal(
+ acceptedScripts.scripts[url][
+ acceptedScripts.scripts[url].length - 1].hash,
+ '56e9636015385c0883d606ffc360eb510c1ac3a7',
+ 'script hash matches');
+
+ mod = pageMod.PageMod({
+ include: '*',
+ contentScriptWhen: 'ready',
+ contentScript: 'self.postMessage(unsafeWindow.jsString);',
+ onAttach: function(worker) {
+ worker.on('message', function(value) {
+ assert.equal(value, null, 'JS isn\'t executed');
+ done();
+ mod.destroy();
+ });
+ }
+ });
+
+ tabs.open(url);
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-license_definitions.js b/test/test-license_definitions.js
new file mode 100644
index 0000000..07dd948
--- /dev/null
+++ b/test/test-license_definitions.js
@@ -0,0 +1,46 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const licenses = require('js_checker/license_definitions');
+
+
+exports.testGetLicenseName = function (test) {
+ for (var license in licenses.licenses) {
+ test.assert(licenses.licenses[license].licenseName);
+ }
+ test.done();
+};
+
+exports.testGetLicenseFragments = function (test) {
+ for (var license in licenses.licenses) {
+ test.assert(licenses.licenses[license].licenseFragments);
+ }
+};
+
+exports.testGetLicenseLicenseFragmentsElems = function (test) {
+ var currentLicense;
+ for (var license in licenses.licenses) {
+ currentLicense = licenses.licenses[license].licenseFragments;
+ for (var item in currentLicense) {
+ test.assert(currentLicense[item].text);
+ test.assert(currentLicense[item].type);
+ }
+ }
+};
diff --git a/test/test-narcissus_worker.js b/test/test-narcissus_worker.js
new file mode 100644
index 0000000..b114b32
--- /dev/null
+++ b/test/test-narcissus_worker.js
@@ -0,0 +1,73 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/*exports.testAstType = function (test) {
+ // ensuring an object is returned when calling searchJs
+ var res = init('var myValue = 0;');
+ test.assertEqual('object', typeof res.parseTree);
+ test.done();
+};*/
+//
+/*
+exports.testAstValueNode = function (test) {
+ // making sure we have a correct (as expected) tree
+ var res = init('var myValue = 34423;');
+ test.assertEqual('myValue', res.parseTree.children[0].children[0].value);
+ test.done();
+};
+
+exports.testAstFunctionNode = function (test) {
+ var res = init('function example (param1) { };');
+ test.assertEqual(78, res.parseTree.children[0].type);
+ test.done();
+};
+
+exports.testAstInvokesEval = function (test) {
+ // ensuring "eval" is caught.
+ var res = init('var string = "var i = 0;"; eval(string);');
+ test.assertEqual('eval', res.parseTree.children[1].value);
+ test.done();
+};
+
+exports.testBlockcomment = function (test) {
+ var jsString = "/* A comment\n* for this new\n* file\n*\/\nvar myJS = 'a string';";
+ var res = init(jsString);
+ test.assertEqual(" A comment\n* for this new\n* file\n", res.parseTree.children[0].blockComments);
+};
+
+exports.testSingleLineComment = function (test) {
+ var jsString = "// this is not free software\nvar myJS = 'a string';";
+ var res = init(jsString);
+ test.assertEqual(" this is not free software", res.parseTree.children[0].blockComments);
+};
+
+
+exports.testMultipleLineComment = function (test) {
+ var i = 0, jsString, expectedResult, ast;
+
+ jsString = "// Below I'm assigning 'a string' to variable myJS\n// this is rather complicated\nvar myJS = 'a string';";
+ expectedResult = [" Below I'm assigning 'a string' to variable myJS", " this is rather complicated"];
+ var res = init(jsString);
+ for (; i < expectedResult.length; i++) {
+ test.assertEqual(expectedResult[i], res.parseTree.children[0].blockComments[i]);
+ }
+};
+*/
diff --git a/test/test-nonfree_checker.js b/test/test-nonfree_checker.js
new file mode 100644
index 0000000..7179a56
--- /dev/null
+++ b/test/test-nonfree_checker.js
@@ -0,0 +1,101 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const check = require("js_checker/free_checker");
+const licenses = require("js_checker/license_definitions");
+const mockNodes = require("./mock/mock_nodes_with_comments");
+
+var mockLicense = function () {
+ return {
+ 'name': 'A Fake License',
+ 'licenseFragments': [{text: "<VERSION>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur id libero ut justo laoreet congue sed a tortor. Sed iaculis, lacus sit amet cursus facilisis, ligula ligula rutrum leo, et laoreet urna sapien id risus. Curabitur suscipit felis vitae nisl laoreet tempor. Nulla facilisi. Praesent sem magna, sodales sed blandit ut, hendrerit sit amet ante. Quisque sed erat eget ante vehicula fermentum sit amet ac nibh. Ut euismod, lorem non dignissim auctor, orci nulla facilisis nibh, congue aliquam ante libero non metus. Nam vitae lorem tortor. Nunc vehicula justo a odio ornare sollicitudin. Quisque egestas ultrices pretium. Sed tortor quam, dictum sed cursus suscipit, rhoncus id lacus.\nIn eu feugiat ipsum. Integer fringilla dapibus nunc iaculis imperdiet. Duis eros felis, eleifend ac lobortis convallis, hendrerit in ligula. Curabitur volutpat, turpis sed pretium vestibulum, ipsum sem sollicitudin turpis, a sollicitudin enim erat eget dolor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque tristique imperdiet libero et iaculis. Aliquam facilisis mauris at neque tincidunt suscipit facilisis felis eleifend. Aliquam condimentum enim at nisi placerat ultrices. Nullam id sapien lectus. Vivamus id felis lorem, at hendrerit est.\n\nCurabitur augue urna, eleifend ac rutrum venenatis, lobortis sagittis purus. Etiam quam odio, sodales elementum volutpat eu, condimentum eu nunc. In hac habitasse platea dictumst. Cras eu arcu a arcu scelerisque iaculis in vel nunc. Integer vitae varius leo. Vestibulum ultricies, magna nec sodales gravida, leo eros tincidunt mi, ac ornare nibh magna vel turpis. Sed ornare viverra lectus, et varius orci vehicula ac.\n\n", type: licenses.types.SHORT}, {text: "A very short license mention", type: licenses.types.SHORT}]
+ };
+};
+
+exports.testStripLicenseToRegexp_1 = function (test) {
+ test.assert(check.freeCheck.stripLicenseToRegexp(mockLicense()));
+ test.done();
+};
+exports.testStripLicenseToRegexp_2 = function (test) {
+ var resultText = /.*?LoremipsumdolorsitametconsecteturadipiscingelitCurabituridliberoutjustolaoreetconguesedatortorSediaculislacussitametcursusfacilisisligulaligularutrumleoetlaoreeturnasapienidrisusCurabitursuscipitfelisvitaenisllaoreettemporNullafacilisiPraesentsemmagnasodalessedblandituthendreritsitametanteQuisquesederategetantevehiculafermentumsitametacnibhUteuismodloremnondignissimauctororcinullafacilisisnibhconguealiquamanteliberononmetusNamvitaeloremtortorNuncvehiculajustoaodioornaresollicitudinQuisqueegestasultricespretiumSedtortorquamdictumsedcursussuscipitrhoncusidlacusIneufeugiatipsumIntegerfringilladapibusnunciaculisimperdietDuiserosfeliseleifendaclobortisconvallishendreritinligulaCurabiturvolutpatturpissedpretiumvestibulumipsumsemsollicitudinturpisasollicitudinenimerategetdolorLoremipsumdolorsitametconsecteturadipiscingelitPellentesquetristiqueimperdietliberoetiaculisAliquamfacilisismaurisatnequetinciduntsuscipitfacilisisfeliseleifendAliquamcondimentumenimatnisiplaceratultricesNullamidsapienlectusVivamusidfelisloremathendreritestCurabituraugueurnaeleifendacrutrumvenenatislobortissagittispurusEtiamquamodiosodaleselementumvolutpateucondimentumeununcInhachabitasseplateadictumstCraseuarcuaarcuscelerisqueiaculisinvelnuncIntegervitaevariusleoVestibulumultriciesmagnanecsodalesgravidaleoerostinciduntmiacornarenibhmagnavelturpisSedornareviverralectusetvariusorcivehiculaac/i;
+ var t = check.freeCheck.stripLicenseToRegexp(mockLicense());
+ test.assertEqual(resultText.toString(), t.licenseFragments[0].regex.toString());
+ test.done();
+};
+
+exports.testStripLicenseToRegexpForMultipleStrings = function (test) {
+ var resultText = /Averyshortlicensemention/i;
+ var item;
+ t = check.freeCheck.stripLicenseToRegexp(mockLicense());
+ for (item in t.licenseFragments) {
+ test.assert(t.licenseFragments[item].text);
+ test.assert(t.licenseFragments[item].type);
+ test.assert(t.licenseFragments[item].regex);
+ }
+ test.assertEqual(resultText.toString(), t.licenseFragments[1].regex.toString());
+ test.done();
+};
+
+exports.testGetComment = function (test) {
+ var n = mockNodes.mockNodesWithComments.gplv3Node;
+ var comment = "*@licstart The following is the entire license notice for the JavaScript code in this page.* A Fake JS Library\n * Copyright (C) 2011 Patrick Star\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n @licend The above is the entire license notice for the JavaScript code in this page.";
+
+ test.assertEqual(comment, check.freeCheck.getComment(n.children[0]));
+};
+
+exports.testGetSingleLineComment = function (test) {
+ var n = mockNodes.mockNodesWithComments.gplv3Node.children[1];
+ var comment = " a single line comment. another single line comment.";
+
+ test.assertEqual(comment, check.freeCheck.getComment(n));
+};
+
+exports.testCheckNodeFreeLicense = function (test) {
+ var n = mockNodes.mockNodesWithComments.gplv3Node.children[0];
+ n.counter = 2;
+ n.parent = {type: 42};
+ test.assertEqual('GNU General Public License (GPL) version 3',
+ check.freeCheck.checkNodeFreeLicense(n).licenseName);
+};
+
+exports.testCheckNodeFreeLicense2 = function (test) {
+ var n = { blockComments: "/*\n * Piwik - Web Analytics\n *\n * JavaScript tracking client\n *\n * @link http://piwik.org\n * @source http://dev.piwik.org/trac/browser/trunk/js/piwik.js\n * @license http://www.opensource.org/licenses/bsd-license.php Simplified BSD\n *\n *\n*@licstart The following is the entire license notice for the JavaScript code in this page.\n\nCopyright (c) 1999, Loic Duros\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n Neither the name of the Blah nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.@licend The above is the entire license notice for the JavaScript code in this page. */", counter: 2, parent: {type: 42} };
+
+ test.assertEqual(
+ 'BSD 3-Clause License',
+ check.freeCheck.checkNodeFreeLicense(n).licenseName);
+
+
+};
+
+exports.testCheckNodeFreeLicenseNotFree = function (test) {
+ var n = mockNodes.mockNodesWithComments.gplv3Node.children[1];
+ test.assertNotEqual(true, check.freeCheck.checkNodeFreeLicense(n));
+};
+
+/*
+exports.testLicenseToRegexp = function (test) {
+ var loader = test.makeSandboxedLoader();
+ var module = loader.require('js_checker/free_checker');
+ var privateScope = loader.findSandboxForModule('js_checker/free_checker'.toString()).globalScope;
+ // ensure the regex values are truthy.
+ test.assert(privateScope.licenses.licenses.gplv2.licenseFragments[0].regex);
+}
+*/
diff --git a/test/test-nontrivial_checker.js b/test/test-nontrivial_checker.js
new file mode 100644
index 0000000..1e5f2d5
--- /dev/null
+++ b/test/test-nontrivial_checker.js
@@ -0,0 +1,180 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const nonTrivialCheckModule = require("js_checker/nontrivial_checker");
+const check = nonTrivialCheckModule.nonTrivialChecker(false, false);
+const mn = require("./mock/mock_nodes");
+var testRunner;
+
+const constants = require("js_checker/constant_types");
+var checkTypes = constants.checkTypes;
+
+var testCheckNontrivial = function (assert, n) {
+ assert.equal(checkTypes.NONTRIVIAL, check.checkNontrivial(n).type);
+};
+
+
+exports.testInvokesEvalIdentifier = function (assert) {
+ // a node that could be found during
+ // jsChecker walkTree execution.
+ // n corresponds to "eval".
+ var n = mn.mockNodes.eval;
+ // making sure we have a correct (as expected) tree
+ assert.equal(true, check.invokesEval(n));
+ //testCheckNontrivial(test, n1);
+};
+
+exports.testInvokesEvalIdentifier_2 = function(assert) {
+ // a node that could be found during
+ // jsChecker walkTree execution.
+ // n corresponds to "evaluate"
+ var n = mn.mockNodes.evaluate;
+ // making sure we have a correct (as expected) tree
+ assert.notEqual(true, check.invokesEval(n));
+};
+
+exports.testInvokesMethodBracketSuffix = function(assert) {
+ // n corresponds to window['eval']('var i;');
+ var n = mn.mockNodes["window['eval']('var i;');"];
+ assert.equal(true, check.invokesMethodBracketSuffix(n));
+ testCheckNontrivial(assert, n);
+};
+
+exports.testInvokesMethodBracketSuffixArray = function(assert) {
+ // n1 corresponds to array[num] = 'some text';
+ var n = mn.mockNodes["array[num] = 'some text';"];
+ assert.notEqual(true, check.invokesMethodBracketSuffix(n));
+};
+
+exports.testCreatesXhrObject = function(assert) {
+ // n1 corresponds to identifier "XMLHttpRequest"
+ var n = mn.mockNodes.XMLHttpRequest;
+ assert.equal(true, check.createsXhrObject(n));
+ testCheckNontrivial(assert, n);
+};
+
+exports.testCreatesXhrObject_MS = function (assert) {
+ // n1 corresponds to identifier "ActiveXObject"
+ var n = mn.mockNodes.ActiveXObject;
+ assert.equal(true, check.createsXhrObject(n));
+};
+
+exports.testInvokesXhrOpen = function (assert) {
+ // n1 corresponds to:
+ // "oReq.open("GET", "http://localhost/test.xml", true);"
+ var n = mn.mockNodes["oReq.open('GET', 'http://localhost/test.xml', true;)"];
+ assert.equal(true, check.invokesXhrOpen(n));
+ testCheckNontrivial(assert, n);
+};
+
+exports.testInvokesMethodOpenNotXhr = function (assert) {
+ // n1 corresponds to:
+ // "oReq.open("a random string");"
+ var n = mn.mockNodes["oReq.open('a random string');"];
+ assert.notEqual('global', check.invokesXhrOpen(n));
+};
+
+exports.testCreatesScriptElement = function (assert) {
+ // n1 corresponds to:
+ // "document.createElement('script');"
+ var n = mn.mockNodes["document.createElement('script');"];
+ assert.equal(true, check.createsScriptElement(n));
+ testCheckNontrivial(assert, n);
+};
+
+exports.testScriptWrittenAsHtmlString = function(assert) {
+ // string written corresponds to:
+ //<script src=\"evil-js.js\"type=\"text/javascript\></script>
+ // and written with document.write();
+ var n = mn.mockNodes[
+ 'document.write("script src=\"evil-js.js\"type=\"text/javascript></script>")'];
+ assert.equal(true, check.writesScriptAsHtmlString(n));
+ testCheckNontrivial(assert, n);
+};
+
+exports.testScriptWrittenAsStringConcat = function(assert) {
+ // string written corresponds to:
+ // document.write('a ' + ' text');
+ // since we are not currently analyzing such construct
+ // we are flagging it as nontrivial.
+ var n = mn.mockNodes["document.write('a ' + ' text');"];
+ assert.equal(true, check.writesScriptAsHtmlString(n));
+ testCheckNontrivial(assert, n);
+};
+
+exports.testWriteNonscriptHtmlString = function(assert) {
+// corresponds to: document.write('<h1>some text</h1>');
+ var n = mn.mockNodes["document.write('<h1>some text</h1>')"];
+ assert.equal(false, check.writesScriptAsHtmlString(n));
+};
+
+/*exports.testSetsInnerHTMLProperty = function (test) {
+ var n = mn.mockNodes['element.innerHTML = "<script src=\'externalscript.js\'></script>";'];
+ test.assertEqual(true, check.setsInnerHTMLProperty(n));
+ testCheckNontrivial(test, n);
+ test.done();
+};*/
+
+/*exports.testSetsInnerHTMLPropertyNonscript = function (test) {
+ var n = mn.mockNodes['element.innerHTML = "<h1>A headline!</h1>";'];
+ test.assertNotEqual(true, check.setsInnerHTMLProperty(n));
+ test.done();
+};*/
+
+/*
+exports.testSetsInnerHTMLPropertyConcat = function (test) {
+ var n = mn.mockNodes['element.innerHTML = "script src" + "=\'eviljs.js\'";'];
+ test.assertEqual(true, check.setsInnerHTMLProperty(n));
+ testCheckNontrivial(test, n);
+ test.done();
+};
+*/
+/*exports.testCheckNonTrivialWithFuncDefAndIsLoadedExternally = function (test) {
+ var subcheck = nonTrivialCheckModule.nonTrivialChecker(true, false);
+ // a node that could be found during
+ // jsChecker walkTree execution.
+ // n corresponds to "function example(param1) {}"
+ var n = mn.mockNodes['function example(param1) {}'];
+ // making sure we have a correct (as expected) tree
+ test.assertEqual('local', subcheck.checkNontrivial(n));
+ test.done();
+};
+
+exports.testCheckNonTrivialWithFuncDefAndHtmlLoadsExternalScripts = function (test) {
+ var subcheck = nonTrivialCheckModule.nonTrivialChecker(false, true);
+ // a node that could be found during
+ // jsChecker walkTree execution.
+ // n corresponds to "function example(param1) {}"
+ var n = mn.mockNodes['function example(param1) {}'];
+ // making sure we have a correct (as expected) tree
+ test.assertEqual('local', subcheck.checkNontrivial(n));
+ test.done();
+};
+
+exports.testCheckNonTrivialWithFuncDefAndHtmlLoadsExternalScriptsAndIsLoadedExternally = function (test) {
+ // that's not really possible, but avoiding silent bugs.
+ var subcheck = nonTrivialCheckModule.nonTrivialChecker(true, true);
+ var n = mn.mockNodes['function example(param1) {}'];
+ // making sure we have a correct (as expected) tree
+ test.assertEqual('local', subcheck.checkNontrivial(n));
+ test.done();
+};*/
+
+require('sdk/test').run(exports);
diff --git a/test/test-privacy_checker.js b/test/test-privacy_checker.js
new file mode 100644
index 0000000..4be09d5
--- /dev/null
+++ b/test/test-privacy_checker.js
@@ -0,0 +1,55 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const privacyCheck = require("js_checker/privacy_checker").privacyCheck;
+
+exports.testPrivacyCheckerGoogleAnalyticsRegex = function(assert) {
+ // original analytics code this was designed for
+ var scriptText =
+ "var _gaq = _gaq || [];\n" +
+ "_gaq.push(['_setAccount', 'UA-5555555-1']);\n" +
+ "_gaq.push(['_trackPageview']);\n" +
+ "\n" +
+ "(function() {\n" +
+ "var ga = document.createElement('script'); ga.type = " +
+ "'text/javascript'; ga.async = true;\n" +
+ "ga.src = ('https:' == document.location.protocol ? 'https://ssl'" +
+ " : 'http://www') + '.google-analytics.com/ga.js';\n" +
+ "var s = document.getElementsByTagName('script')[0]; " +
+ "s.parentNode.insertBefore(ga, s);\n" +
+ "})();";
+ var check = privacyCheck.checkScriptPrivacyThreat(scriptText);
+ assert.equal(check, true, 'regex recognizes old GA code');
+
+ // newer analytics code
+ scriptText =
+ "var _gaq = _gaq || [];\n" +
+ "_gaq.push(['_setAccount', 'UA-5555555-2']);\n" +
+ "\n" +
+ "(function() {\n" +
+ " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n" +
+ " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n" +
+ " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n" +
+ "})();";
+ check = privacyCheck.checkScriptPrivacyThreat(scriptText);
+ assert.equal(check, true, 'regex recognizes new GA code');
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-relation_checker.js b/test/test-relation_checker.js
new file mode 100644
index 0000000..25bf1c5
--- /dev/null
+++ b/test/test-relation_checker.js
@@ -0,0 +1,68 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var relationChecker = require('js_checker/relation_checker').relationChecker('b');
+const mn = require("./mock/mock_nodes");
+
+// the fake node.
+var nVar = mn.mockNodes["var def = 'blah';var i = 0;\n\n def = 'something else';"];
+nVar.global = true;
+
+var nFunc = mn.mockNodes["function test (myArgument) { doSomething(); }"];
+nFunc.global = true;
+
+exports.testIsWindowProperty = function (test) {
+ test.assertEqual(relationChecker.isWindowProperty('alert'), true);
+ test.assertEqual(relationChecker.isWindowProperty('alerts'), false);
+ test.assertEqual(relationChecker.isWindowProperty('RegExp'), true);
+ test.assertEqual(relationChecker.isWindowProperty('console'), true);
+};
+
+exports.testCheckNodeForVars = function (test) {
+ relationChecker.storeNodeVars(nVar);
+ test.assertEqual('def' in relationChecker.variableDeclarations,
+ true);
+ test.assertEqual('i' in relationChecker.variableDeclarations,
+ true);
+};
+
+
+exports.testCheckNodeForFunctions = function (test) {
+ relationChecker.storeNodeFunctions(nFunc);
+ test.assertEqual('test' in relationChecker.functionDeclarations,
+ true);
+};
+
+exports.testCheckMethodNotAdded = function (test) {
+ relationChecker.storeNodeFunctions(nFunc);
+ relationChecker.storeNodeFunctions(mn.mockNodes["var myObj = { 'myMethod': function (arg) { alert(arg); } }"]);
+ test.assertEqual('myMethod' in relationChecker.functionDeclarations, false);
+};
+
+
+
+
+exports.testStoreNodeGlobalDeclarations = function (test) {
+ var check = require('js_checker/relation_checker').relationChecker('b');
+ check.storeNodeGlobalDeclarations(nVar);
+ test.assertEqual('def' in check.variableDeclarations, true);
+ check.storeNodeGlobalDeclarations(nFunc);
+ test.assertEqual('test' in check.functionDeclarations, true);
+};
diff --git a/test/test-removed_scripts.js b/test/test-removed_scripts.js
new file mode 100644
index 0000000..d79d15c
--- /dev/null
+++ b/test/test-removed_scripts.js
@@ -0,0 +1,67 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var removedScripts = require('script_entries/removed_scripts').removedScripts;
+
+exports.truncateDataTest = function(test) {
+ var str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ultricies molestie tellus, eu ullamcorper dui luctus sit amet. Morbi sed urna eu justo malesuada bibendum nec non est. Sed sagittis sodales ullamcorper. Mauris dolor arcu, dignissim ac sollicitudin ac, tempus at orci. Curabitur pretium risus id urna congue cursus. Nulla ullamcorper faucibus nibh, eget ultrices ante vestibulum id. Vestibulum elementum ullamcorper mi, id ultrices lacus faucibus et. Nullam lectus augue, suscipit a elementum at, malesuada eget nulla. Aenean tempus ultrices elit ut vulputate. Ut congue magna ultricies felis rutrum eget ultricies nibh vehicula. In id pellentesque risus. Pellentesque aliquam quam eros, quis placerat eros. Cras molestie, turpis et consectetur sollicitudin, magna enim mattis lectus, et adipiscing erat urna in risus. Vestibulum sed arcu vitae mauris ornare ultricies a sit amet leo. Praesent pharetra, urna in varius fermentum, neque nibh tempor justo, id ullamcorper magna amet.…";
+ var t = {contents: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ultricies molestie tellus, eu ullamcorper dui luctus sit amet. Morbi sed urna eu justo malesuada bibendum nec non est. Sed sagittis sodales ullamcorper. Mauris dolor arcu, dignissim ac sollicitudin ac, tempus at orci. Curabitur pretium risus id urna congue cursus. Nulla ullamcorper faucibus nibh, eget ultrices ante vestibulum id. Vestibulum elementum ullamcorper mi, id ultrices lacus faucibus et. Nullam lectus augue, suscipit a elementum at, malesuada eget nulla. Aenean tempus ultrices elit ut vulputate. Ut congue magna ultricies felis rutrum eget ultricies nibh vehicula. In id pellentesque risus. Pellentesque aliquam quam eros, quis placerat eros. Cras molestie, turpis et consectetur sollicitudin, magna enim mattis lectus, et adipiscing erat urna in risus. Vestibulum sed arcu vitae mauris ornare ultricies a sit amet leo. Praesent pharetra, urna in varius fermentum, neque nibh tempor justo, id ullamcorper magna amet. Something after 1000 character here should be removed."};
+
+ test.assertEqual(str.length, 1001);
+ removedScripts.truncateJsData(t);
+ test.assertEqual(str, t.contents);
+
+};
+
+exports.addAScriptInline = function(test) {
+ var jsString = 'var b = document.createElement("script");';
+ var script = {inline:true, contents: jsString, removalReason: 'creates a script element.'};
+ test.assertEqual(script.contents, jsString);
+ removedScripts.addAScript('http://www.example.org/', script);
+ var fetchedScript = removedScripts.getScripts('http://www.example.org/');
+ test.assert(fetchedScript);
+ test.assertEqual(fetchedScript[0].contents, jsString);
+};
+
+exports.testAddAScriptTwice = function (test) {
+ var jsString = 'var b = document.createElement("script");';
+ var script = {inline:true, contents: jsString, removalReason: 'creates a script element.'};
+ test.assertEqual(removedScripts.addAScript('http://www.example.org/', script), false);
+};
+
+exports.testIsFound = function (test) {
+ var url = 'http://lduros.net/';
+ var str = "http://www.lduros.net/assets/blah.js";
+ var script = {inline:false, contents: str};
+ removedScripts.addAScript('http://lduros.net/', script);
+ test.assertEqual(removedScripts.isFound(url, script), true);
+};
+
+exports.testIsFoundHash = function (test) {
+ var str = "var i = 0;";
+ var hash = '1621f3b5cfc1c3753f347349677f53e82285a2f1';
+
+ // Unline in test-all_scripts.js, we are not adding hash here.
+ // The hash property should be added during addAScript execution.
+ var obj = {'inline': true, 'contents': str};
+ removedScripts.addAScript('http://example.com/', obj);
+ test.assertEqual(removedScripts.scripts['http://example.com/'][removedScripts.scripts['http://example.com/'].length -1].hash, hash);
+ test.assertEqual(removedScripts.isFound('http://example.com/', obj), true);
+};
diff --git a/test/test-request.js b/test/test-request.js
new file mode 100644
index 0000000..a2f9f17
--- /dev/null
+++ b/test/test-request.js
@@ -0,0 +1,102 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var xhr2 = require("html_script_finder/dom_handler/request");
+var Request = require("sdk/request").Request;
+
+exports.testHttpsEverywhere = function (test) {
+
+ test.waitUntilDone();
+
+ var script = {url: 'https://static.fsf.org/nosvn/appeal2011/widget.js'};
+
+ var callback = function (script, text) {
+ //console.log('response received', text);
+ test.assert(true);
+ test.done();
+ };
+
+ var req = xhr2.request(script, callback);
+
+ req.request();
+
+};
+
+exports.testXhr = function (test) {
+
+ // async.
+ test.waitUntilDone();
+
+ var script = {url: 'http://lduros.net/assets/js/prettify/prettify.js'};
+
+ var callback = function (script, text) {
+
+ //console.log('response received', text);
+ test.assert(true);
+ test.done();
+ };
+
+ var req = xhr2.request(script, callback);
+
+ req.request();
+
+};
+
+exports.testXhr2 = function (test) {
+
+ // async.
+ test.waitUntilDone();
+
+ var script = {url: 'http://www.fsf.org/graphics/widget/global/widget.js'};
+
+ var callback = function (script, text) {
+
+ //console.log('response received', text);
+ test.assert(true);
+ test.done();
+ };
+
+ var req = xhr2.request(script, callback);
+
+ req.request();
+
+};
+
+exports.testCompareXhr2WithSDKRequest = function (test) {
+
+ test.waitUntilDone();
+
+ var url = 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js';
+
+ Request({
+ 'url': url,
+ 'onComplete': function (response) {
+ console.log('first response received');
+ var script = {'url': url};
+ var callback = function(script, text) {
+ test.assertEqual(response.text, text);
+ test.done();
+ };
+
+ var req = xhr2.request(script, callback);
+ req.request();
+ }
+ }).get();
+};
diff --git a/test/test-script_detector.js b/test/test-script_detector.js
new file mode 100644
index 0000000..c6f3955
--- /dev/null
+++ b/test/test-script_detector.js
@@ -0,0 +1,49 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var pageMod = require("sdk/page-mod");
+var tabs = require("sdk/tabs");
+var data = require("sdk/self").data;
+
+exports.testScriptsFetched = function (test) {
+ test.waitUntilDone();
+
+ var mod = pageMod.PageMod({
+ include: "data:*",
+ contentScriptWhen: 'end',
+ contentScriptFile: [data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js'),
+ data.url('complain/pagemod_finder.js'),
+ data.url('script_detector/script_detector.js')],
+ contentScript: "scriptDetector.init();",
+ onAttach: function (worker) {
+ worker.on('message', function (message) {
+ if (message.event === 'scriptsFetched') {
+ test.assertEqual(message.value.blocked[0].contents, "var num = 5;");
+ test.assertEqual(message.value.blocked[0].inline, true);
+ test.done();
+ }
+ });
+ }
+ });
+
+ tabs.open("data:text/html;charset=utf-8,<!doctype html>%0D%0A<html>%0D%0A<head><script type='librejs/blocked'>var num %3D 5%3B<%2Fscript><%2Fhead>%0D%0A%0D%0A<body><h1 id='test'>Test<%2Fh1><a href='contact.html'>contact</a><%2Fbody><%2Fhtml>");
+
+};
diff --git a/test/test-script_object.js b/test/test-script_object.js
new file mode 100644
index 0000000..29579b5
--- /dev/null
+++ b/test/test-script_object.js
@@ -0,0 +1,50 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var scriptObject = require("html_script_finder/dom_handler/script_object");
+
+exports.testCreateNewScript = function(assert) {
+ var script1, script2;
+
+ script1 = scriptObject.Script({'type': 'inline',
+ 'status': 'test',
+ 'text': 'test',
+ 'element': {}});
+
+ assert.equal('object', typeof script1);
+ assert.equal('inline', script1.type);
+
+ script2 = scriptObject.Script({'type': 'external',
+ 'status': 'test',
+ 'element': {}});
+ assert.equal(script2.text, null);
+};
+
+exports.testRemoveNarcissusBugLine = function(assert) {
+ var script = scriptObject.Script({'type': 'external',
+ 'status': 'test',
+ 'element': {}});
+ var scriptText = "var i = 0;\n\nthis.narcissusBugFixLibreJS";
+ var scriptText2 = "var i = 0;";
+ assert.equal(script.removeNarcissusBugLine(scriptText), 'var i = 0;');
+ assert.equal(script.removeNarcissusBugLine(scriptText2), 'var i = 0;');
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-script_properties.js b/test/test-script_properties.js
new file mode 100644
index 0000000..c7928c0
--- /dev/null
+++ b/test/test-script_properties.js
@@ -0,0 +1,29 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+var scriptProperties = require("html_script_finder/dom_handler/script_properties");
+const scriptTypes = scriptProperties.scriptTypes;
+const statusTypes = scriptProperties.statusTypes;
+
+exports.testScriptTypes = function (assert) {
+ assert.equal(scriptTypes.INLINE, 0);
+ assert.equal(scriptTypes.EXTERNAL, 1);
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-stream_loader.js b/test/test-stream_loader.js
new file mode 100644
index 0000000..b2a51b2
--- /dev/null
+++ b/test/test-stream_loader.js
@@ -0,0 +1,35 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var streamLoader = require("http_observer/stream_loader.js");
+var {Cc, Ci, Cu, Cm, Cr} = require("chrome");
+
+exports.testListener = function (assert) {
+ var mozStreamLoader = Cc["@mozilla.org/network/unichar-stream-loader;1"].
+ createInstance(Ci.nsIUnicharStreamLoader);
+ mozStreamLoader.init(streamLoader.streamLoader().listener);
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ var chan = ios.newChannel("http://example.com", null, null);
+ chan.asyncOpen(mozStreamLoader, null);
+ assert.ok(true);
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-ui_info.js b/test/test-ui_info.js
new file mode 100644
index 0000000..4cf3ecd
--- /dev/null
+++ b/test/test-ui_info.js
@@ -0,0 +1,42 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var uiInfo = require("ui/ui_info").testModule;
+
+
+exports.testFoundInContactList = function (test) {
+
+ uiInfo.contactList['www.lduros.net'] = 'http://lduros.net/contact';
+
+ test.assertEqual(uiInfo.foundInContactList('http://www.lduros.net/somepage.html'),
+ 'http://lduros.net/contact');
+
+
+};
+
+exports.testNotFoundInContactList = function (test) {
+
+ delete uiInfo.contactList['www.lduros.net'];
+
+ test.assertEqual(uiInfo.foundInContactList('http://www.lduros.net/somepage.html'),
+ false);
+
+
+};
diff --git a/test/test-url_handler.js b/test/test-url_handler.js
new file mode 100644
index 0000000..b0e388d
--- /dev/null
+++ b/test/test-url_handler.js
@@ -0,0 +1,78 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+const urlHandler = require('url_handler/url_handler');
+
+exports.testRemoveFragment1 = function (test) {
+ var url = 'http://example.org/blah.html#section';
+ var result = urlHandler.removeFragment(url);
+ test.assertEqual(result, 'http://example.org/blah.html');
+};
+
+exports.testRemoveFragmentWithQueryString = function (test) {
+ // test for the Amazon Track Package related bug.
+ var url = 'http://example.org/blah.html?q=something#section';
+ var result = urlHandler.removeFragment(url);
+ test.assertEqual(result, 'http://example.org/blah.html?q=something');
+};
+
+exports.testQueryString = function (test) {
+ // test for the Amazon Track Package related bug.
+ var url = 'http://example.org/blah.html';
+ var t = urlHandler.parse(url);
+ t.search = 'librejs=contact';
+ console.log(JSON.stringify(t));
+ test.assertEqual(t.search, 'librejs=contact');
+ test.assertEqual(urlHandler.format(t), 'http://example.org/blah.html?librejs=contact');
+};
+
+exports.testAddQuery = function (test) {
+ // test for the Amazon Track Package related bug.
+ var url = 'http://example.org/blah.html?t=1';
+ var t = urlHandler.addQuery(url, 'librejs=contact');
+ test.assertEqual(t, 'http://example.org/blah.html?t=1&librejs=contact');
+};
+
+exports.testAddQueryWithFragment = function (test) {
+ // test for the Amazon Track Package related bug.
+ var url = 'http://example.org/blah.html?t=1#topic1';
+ var t = urlHandler.addQuery(url, 'librejs=contact');
+ test.assertEqual(t, 'http://example.org/blah.html?t=1&librejs=contact#topic1');
+};
+
+exports.testGetHostname = function (test) {
+ var url = 'http://example.org/some-site.html';
+ test.assertEqual(urlHandler.getHostname(url), 'example.org');
+};
+
+exports.testGetHostnameWithWWW = function (test) {
+ var url = 'http://www.example.org/some-site.html';
+ test.assertEqual(urlHandler.getHostname(url), 'www.example.org');
+};
+
+exports.testGetHostnameWithWWW2 = function (test) {
+ var url = 'http://www.lduros.net/somepage.html';
+ test.assertEqual(urlHandler.getHostname(url), 'www.lduros.net');
+};
+
+exports.testDONOTHaveSameHostname = function (test) {
+ var url1 = 'http://marcotempest.com/screen/PublicContactStartV3/language/en#librejs=true';
+ var url2 = 'http://www.google.com/search?hl=en&output=search&sclient=psy-ab&q=marco+tempest&btnG=';
+ test.assertEqual(urlHandler.haveSameHostname(url1, url2), false);
+};
diff --git a/test/test-web-label-finder.js b/test/test-web-label-finder.js
new file mode 100644
index 0000000..ea0588a
--- /dev/null
+++ b/test/test-web-label-finder.js
@@ -0,0 +1,195 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const {Cc,Ci} = require('chrome');
+var parser = Cc["@mozilla.org/xmlextras/domparser;1"]
+ .createInstance(Ci.nsIDOMParser);
+
+var WebLabelFinder = require('html_script_finder/web_labels/js_web_labels')
+ .WebLabelFinder;
+
+exports.testSearchForJsLinkEmpty = function (assert) {
+ var finder = new WebLabelFinder();
+ var doc = parser.parseFromString('<html></html>', 'text/html');
+ finder.init(doc, 'http://www.rootstrikers.org', function() {});
+ assert.strictEqual(finder.searchForJsLink(), false);
+};
+
+exports.testSearchForJsLinkJsLicense = function (assert) {
+ var finder = new WebLabelFinder();
+ var doc = parser.parseFromString(
+ '<html><body>' +
+ '<a href="lic.html" rel="jslicense">JavaScript License Info</a>' +
+ '</body></html>', 'text/html');
+ finder.init(doc, 'http://www.rootstrikers.org', function() {});
+
+ assert.strictEqual(
+ finder.searchForJsLink(),
+ 'http://www.rootstrikers.org/lic.html#librejs=true'
+ );
+};
+
+exports.testSearchForJsLinkDataJsLicense = function (assert) {
+ var finder = new WebLabelFinder();
+ var doc = parser.parseFromString(
+ '<html><body>' +
+ '<a href="lic.html" data-jslicense="1">JavaScript License</a>' +
+ '</body></html>', 'text/html');
+ finder.init(doc, 'http://www.rootstrikers.org', function() {});
+
+ assert.strictEqual(
+ finder.searchForJsLink(),
+ 'http://www.rootstrikers.org/lic.html#librejs=true'
+ );
+};
+
+exports.testIsLicenseFreeEmpty = function(assert) {
+ var finder = new WebLabelFinder();
+ // listCheck is initialized by WebLabelFinder.matchListWithDefs...
+ // I'm initializing it here to prevent errors when testing.
+ finder.listCheck = {};
+
+ var lic = {
+ licenses: []
+ };
+ var licArray = [];
+ var jslicenseURL = null;
+ var callback = function() { };
+ assert.strictEqual(
+ finder.isLicenseFree(lic, licArray, jslicenseURL, callback),
+ false,
+ 'A script with no license info is considered nonfree'
+ );
+};
+
+exports.testIsLicenseFree1 = function(assert) {
+ var finder = new WebLabelFinder();
+ finder.listCheck = {};
+
+ var lic = {
+ 'fileName': 'filepicker.js',
+ 'fileUrl': 'http://www.rootstrikers.org/vendor/filepicker.js',
+ 'fileHash': null,
+ 'licenses': [{
+ 'licenseName': 'Expat',
+ 'licenseUrl': 'http://www.jclark.com/xml/copying.txt'
+ }],
+ 'sources':[{
+ 'sourceName': 'filepicker.js',
+ 'sourceUrl': 'http://www.rootstrikers.org/vendor/filepicker.js'
+ }]
+ };
+ var licArray = [];
+ var jslicenseURL = null;
+ var callback = function() { };
+ assert.strictEqual(
+ finder.isLicenseFree(lic, licArray, jslicenseURL, callback),
+ true,
+ 'A script with one free license is considered free'
+ );
+};
+
+exports.testIsLicenseFree3 = function(assert) {
+ var finder = new WebLabelFinder();
+ finder.listCheck = {};
+
+ var lic = {
+ 'fileName': 'all.min.js',
+ 'fileUrl': 'http://example.com/all.min.js',
+ 'fileHash': null,
+ 'licenses': [
+ {
+ 'licenseName': 'GNU-GPL-3.0',
+ 'licenseUrl': 'http://www.gnu.org/licenses/gpl-3.0.html'
+ },
+ {
+ 'licenseName': 'Expat',
+ 'licenseUrl': 'http://www.jclark.com/xml/copying.txt'
+ },
+ {
+ 'licenseName': 'MPL-2.0',
+ 'licenseUrl': 'http://www.mozilla.org/MPL/2.0'
+ }
+ ],
+ 'sources':[
+ {
+ 'sourceName': 'gpl3.js',
+ 'sourceUrl': 'http://www.example.com/gpl3.js'
+ },
+ {
+ 'sourceName': 'expat.js',
+ 'sourceUrl': 'http://www.example.com/expat.js'
+ },
+ {
+ 'sourceName': 'mpl.js',
+ 'sourceUrl': 'http://www.example.com/mpl.js'
+ }
+ ]
+ };
+ var licArray = [];
+ var jslicenseURL = null;
+ var callback = function() { };
+ assert.strictEqual(
+ finder.isLicenseFree(lic, licArray, jslicenseURL, callback),
+ true,
+ 'A script with three free licenses is considered free'
+ );
+};
+
+exports.testIsLicenseNotFree = function(assert) {
+ var finder = new WebLabelFinder();
+ finder.listCheck = {};
+
+ var lic = {
+ 'fileName': 'filepicker.js',
+ 'fileUrl': 'http://www.rootstrikers.org/vendor/filepicker.js',
+ 'fileHash': null,
+ 'licenses': [
+ {
+ 'licenseName': 'Expat',
+ 'licenseUrl': 'http://www.jclark.com/xml/copying.txt'
+ },
+ {
+ 'licenseName': 'Some-Unrecognized-License',
+ 'licenseUrl': 'http://www.example.com/nolicense.txt'
+ }
+ ],
+ 'sources':[
+ {
+ 'sourceName': 'filepicker.js',
+ 'sourceUrl': 'http://www.rootstrikers.org/vendor/filepicker.js'
+ },
+ {
+ 'sourceName': 'nonfree.js',
+ 'sourceUrl': 'http://www.example.com/nonfree.js'
+ }
+ ]
+ };
+ var licArray = [];
+ var jslicenseURL = null;
+ var callback = function() { };
+ assert.strictEqual(
+ finder.isLicenseFree(lic, licArray, jslicenseURL, callback),
+ false,
+ 'A script with one free license and one nonfree is considered nonfree'
+ );
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-web-labels.js b/test/test-web-labels.js
new file mode 100644
index 0000000..b55d6bb
--- /dev/null
+++ b/test/test-web-labels.js
@@ -0,0 +1,42 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var mockLicenseList = [{
+ 'fileName': 'jquery.min.js',
+ 'fileUrl': 'http://www.rootstrikers.org/bower_components/jquery/dist/jquery.min.js',
+ 'fileHash': null,
+ 'licenseName': 'Expat',
+ 'licenseUrl': 'http://www.jclark.com/xml/copying.txt',
+ 'free': true
+}];
+
+var dom_handler = require('html_script_finder/dom_handler');
+
+exports.testScriptHasJsWebLabel = function (assert) {
+ var dm = new dom_handler.DomHandler();
+ dm.licenseList = mockLicenseList;
+ dm.pageURL = 'http://rootstrikers.org/';
+ var script = {
+ 'src': 'http://www.rootstrikers.org/bower_components/jquery/dist/jquery.min.js'
+ };
+ assert.ok(dm.scriptHasJsWebLabel(script));
+};
+
+require('sdk/test').run(exports);
diff --git a/test/test-windowProperty.js b/test/test-windowProperty.js
new file mode 100644
index 0000000..6b8a29b
--- /dev/null
+++ b/test/test-windowProperty.js
@@ -0,0 +1,34 @@
+/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+var relationChecker = require('js_checker/relation_checker');
+const mn = require("./mock/mock_nodes");
+
+exports.testCheckIdentifierIsWindowProperty = function (assert) {
+ var tree = mn.mockNodes["alert('this is completely trivial');"];
+
+ var n = tree.children[0].expression.children[0];
+ n.parent = tree.children[0].expression;
+ var rel = relationChecker.relationChecker(n);
+ rel.checkIdentifierIsWindowProperty(n);
+ assert.equal(rel.nonWindowProperties.alert, null);
+};
+
+require('sdk/test').run(exports);
diff --git a/test/webpages/test-labels/index.html b/test/webpages/test-labels/index.html
new file mode 100644
index 0000000..a570089
--- /dev/null
+++ b/test/webpages/test-labels/index.html
@@ -0,0 +1,36 @@
+<!doctype html>
+
+<html>
+
+ <head>
+<!--/**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+-->
+ <title>A Page containing free JS</title>
+ <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
+ </head>
+
+ <body>
+ <h1>A page containing free js (jquery)</h1>
+
+ <a href="js-licenses.html" rel="jslicense">JavaScript License Information</a>
+ </body>
+
+</html>
diff --git a/test/webpages/test-labels/js-licenses.html b/test/webpages/test-labels/js-licenses.html
new file mode 100644
index 0000000..2d035dd
--- /dev/null
+++ b/test/webpages/test-labels/js-licenses.html
@@ -0,0 +1,45 @@
+<!doctype html>
+
+<html>
+
+ <head>
+
+<!-- /**
+ * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+ * *
+ * Copyright (C) 2011, 2012, 2014 Loic J. Duros
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+-->
+ <title>JavaScript License Information</title>
+ </head>
+
+ <body>
+ <h1>License information for external JavaScript files present on this site.</h1>
+ <table id="jslicense-labels1">
+
+ <tr>
+ <td><a href="https://code.jquery.com/jquery-2.1.1.min.js">jquery-2.1.1.min.js</a></td>
+
+ <td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
+
+ <td><a href="https://code.jquery.com/jquery-2.1.1.js">jquery-2.1.1.js</a></td>
+ </tr>
+
+ </table>
+ </body>
+
+</html>
diff --git a/tools/library-fetch-tools/LICENSE b/tools/library-fetch-tools/LICENSE
new file mode 100644
index 0000000..42e94cd
--- /dev/null
+++ b/tools/library-fetch-tools/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2010, Mozilla Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+Neither the name of the Mozilla Corporation nor the names of its
+contributors may be used to endorse or promote products derived from this
+software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/tools/library-fetch-tools/build_whitelist.py b/tools/library-fetch-tools/build_whitelist.py
new file mode 100644
index 0000000..af404d5
--- /dev/null
+++ b/tools/library-fetch-tools/build_whitelist.py
@@ -0,0 +1,42 @@
+#Copyright (c) 2010, Mozilla Corporation
+#All rights reserved.
+
+#Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+#Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+#Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following# disclaimer in the documentation and/or other materials provided with the distribution.
+
+#Neither the name of the Mozilla Corporation nor the names of its
+#contributors may be used to endorse or promote products derived from this
+#software without specific prior written permission.
+
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+#IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+#THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+#PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+#CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import sys
+import os
+import os.path as pth
+import hashlib
+
+output = open("whitelist_hashes.txt", mode="w")
+
+for root, dirs, files in os.walk(sys.argv[1]):
+ for filename in files:
+ path = pth.join(pth.dirname(pth.abspath(sys.argv[0])),
+ root, filename)
+ hash = hashlib.sha1(open(path).read()).hexdigest()
+ print path, hash
+ output.write('"' + hash + '"' + ': ' + '{"filename": "' + filename + '", "result": 6' + "},\n")
+
+output.close()
diff --git a/tools/library-fetch-tools/jslibfetcher.py b/tools/library-fetch-tools/jslibfetcher.py
new file mode 100644
index 0000000..8a457e3
--- /dev/null
+++ b/tools/library-fetch-tools/jslibfetcher.py
@@ -0,0 +1,190 @@
+import urllib
+import os
+
+
+def process(url, destination):
+ destination = "jslibs/%s" % destination
+
+ if os.path.exists(destination):
+ return
+
+ try:
+ print url
+ urllib.urlretrieve(url, destination)
+ except Exception as e:
+ print "Failed", e
+
+
+def get_pattern(prefix, url_pattern, versions):
+ for version in versions:
+ url = url_pattern % version
+ process(url, "%s.%s.%s" % (prefix, version, url.split("/")[-1]))
+
+
+process("https://addons.cdn.mozilla.net/en-US/firefox/files/browse/149703/"
+ "file-serve/bootstrap.js?token=e9d0767e-643c-48ad-b09e-fc075ca60b77",
+ "PersonasInteractive_bootstrap.js")
+
+process("https://raw.github.com/voldsoftware/toolbarbutton-jplib/stable/lib/"
+ "toolbarbutton.js", "toolbarbutton.js")
+
+
+DOJO_VERSIONS = ("1.1.1", "1.2.0", "1.2.3", "1.3.0", "1.3.1", "1.3.2", "1.4.0",
+ "1.4.1", "1.4.3", "1.5", "1.5.1", "1.6", "1.6.1", "1.7.0",
+ "1.7.1", "1.7.2", "1.7.3", "1.8.0")
+# Google doesn't yet host EXT4.*
+EXT_VERSIONS = ("3.0.0", "3.1.0")
+JQUERY_CODE_VERSIONS = ("1.0.pack", "1.0.1.pack", "1.0.1", "1.0.2.pack",
+ "1.0.2", "1.0.3.pack", "1.0.3", "1.0.4.pack", "1.0.4",
+ "1.1.pack", "1.1", "1.1.1.pack", "1.1.1", "1.1.2.pack",
+ "1.1.2", "1.1.3.pack", "1.4.min", "1.4", "1.4.1.min",
+ "1.4.1", "1.4.2.min", "1.4.2", "1.4.3.min", "1.4.4",
+ "1.5.min", "1.5", "1.5.1.min", "1.5.1", "1.5.2.min",
+ "1.5.2", "1.6.min", "1.6", "1.6.1.min", "1.6.1",
+ "1.6.2.min", "1.6.2", "1.6.3.min", "1.6.3",
+ "1.6.4.min", "1.6.4", "1.7.min", "1.7", "1.7.1.min",
+ "1.7.1", "1.7.2.min", "1.7.2", "1.8.0.min", "1.8.0",
+ "1.8.1.min", "1.8.1", "1.8.2.min", "1.8.2",
+ "1.8.3.min", "1.8.3", "1.9.0.min", "1.9.0",
+ "1.9.1.min", "1.9.1", "1.10.0", "2.0.0.min", "2.0.0",
+ "2.0.1.min", "2.0.1")
+JQUERY_GCODE_VERSIONS = ("1.1.3", "1.1.3.1.pack", "1.1.3.1", "1.1.4.pack",
+ "1.1.4", "1.2.min", "1.2.pack", "1.2", "1.2.1.min",
+ "1.2.1.pack", "1.2.1", "1.2.2.pack", "1.2.2.min",
+ "1.2.2", "1.2.3.pack", "1.2.3.min", "1.2.3",
+ "1.2.4.min", "1.2.4.pack", "1.2.4", "1.2.5.min",
+ "1.2.5.pack", "1.2.5", "1.2.6.min", "1.2.6.pack",
+ "1.2.6", "1.3.min", "1.3", "1.3.1.min", "1.3.1",
+ "1.3.2.min", "1.3.2")
+JQUERYUI_VERSIONS = ("1.5.2", "1.5.3", "1.6.0", "1.7.0", "1.7.1", "1.7.2",
+ "1.7.3", "1.8.0", "1.8.1", "1.8.2", "1.8.4", "1.8.5",
+ "1.8.6", "1.8.7", "1.8.8", "1.8.9", "1.8.10", "1.8.11",
+ "1.8.12", "1.8.13", "1.8.14", "1.8.15", "1.8.16", "1.8.17",
+ "1.8.18", "1.8.19", "1.8.20", "1.8.21", "1.8.22", "1.8.23")
+MOOTOOLS_VERSIONS = ("1.1.1", "1.1.2", "1.2.1", "1.2.2", "1.2.3", "1.2.4",
+ "1.2.5", "1.3.0", "1.3.1", "1.3.2", "1.4.0", "1.4.1",
+ "1.4.2", "1.4.3", "1.4.4", "1.4.5")
+PROTOTYPE_VERSIONS = ("1.6.0.2", "1.6.0.3", "1.6.1.0", "1.7.0.0", "1.7.1.0")
+SCRIPTACULOUS_VERSIONS = ("1.8.1", "1.8.2", "1.8.3", "1.9.0")
+SWFOBJECT_VERSIONS = ("2.1", "2.2")
+UNDERSCORE_VERSIONS = ("1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.2.4", "1.2.3",
+ "1.2.2", "1.2.1", "1.2.0", "1.1.7", "1.1.6", "1.1.5",
+ "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.0.4",
+ "1.0.3", "1.0.2", "1.0.1", "1.0.0")
+YUI_VERSIONS = ("2.6.0", "2.7.0", "2.8.0r4", "2.8.1", "2.8.2", "2.9.0")
+YUI_NEW_VERSIONS = ("3.3.0", "3.4.0", "3.4.1", "3.5.0", "3.5.1", "3.6.0")
+
+
+get_pattern("dojo",
+ "https://ajax.googleapis.com/ajax/libs/dojo/%s/dojo/dojo.xd.js",
+ DOJO_VERSIONS)
+get_pattern("dojo",
+ "https://ajax.googleapis.com/ajax/libs/dojo/%s/dojo/dojo.xd.js.uncompressed.js",
+ DOJO_VERSIONS)
+DOJO_V = lambda v:"http://download.dojotoolkit.org/" \
+ "release-%s/dojo-release-%s/release/dojo-release-%s/" \
+ "dojo/%%s" % (v, v, v)
+urllib.urlretrieve(DOJO_V("1.0.3") % "dojo.js",
+ "jslibs/dojo.1.0.3.js")
+urllib.urlretrieve(DOJO_V("1.0.3") % "dojo.js.uncompressed.js",
+ "jslibs/dojo.uncompressed.1.0.3.js")
+
+urllib.urlretrieve(DOJO_V("1.1.2") % "dojo.js",
+ "jslibs/dojo.1.1.2.js")
+urllib.urlretrieve(DOJO_V("1.1.2") % "dojo.js.uncompressed.js",
+ "jslibs/dojo.uncompressed.1.1.2.js")
+
+urllib.urlretrieve(DOJO_V("1.2.4") % "dojo.js",
+ "jslibs/dojo.1.2.4.js")
+urllib.urlretrieve(DOJO_V("1.2.4") % "dojo.js.uncompressed.js",
+ "jslibs/dojo.uncompressed.1.2.4.js")
+
+urllib.urlretrieve(DOJO_V("1.3.3") % "dojo.js",
+ "jslibs/dojo.1.3.3.js")
+urllib.urlretrieve(DOJO_V("1.3.3") % "dojo.js.uncompressed.js",
+ "jslibs/dojo.uncompressed.1.3.3.js")
+
+# EXT.js
+get_pattern("ext-core",
+ "https://ajax.googleapis.com/ajax/libs/ext-core/%s/ext-core.js",
+ EXT_VERSIONS)
+get_pattern("ext-debug",
+ "https://ajax.googleapis.com/ajax/libs/ext-core/%s/ext-core-debug.js",
+ EXT_VERSIONS)
+
+# jQuery
+get_pattern("jquery",
+ "http://code.jquery.com/jquery-%s.js",
+ JQUERY_CODE_VERSIONS)
+get_pattern("jquery",
+ "http://jqueryjs.googlecode.com/files/jquery-%s.js",
+ JQUERY_GCODE_VERSIONS)
+
+# jQueryUI
+get_pattern("jqueryui",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/%s/jquery-ui.min.js",
+ JQUERYUI_VERSIONS)
+get_pattern("jqueryui",
+ "https://ajax.googleapis.com/ajax/libs/jqueryui/%s/jquery-ui.js",
+ JQUERYUI_VERSIONS)
+
+# MooTools
+get_pattern("mootools",
+ "https://ajax.googleapis.com/ajax/libs/mootools/%s/mootools-yui-compressed.js",
+ MOOTOOLS_VERSIONS)
+get_pattern("mootools",
+ "https://ajax.googleapis.com/ajax/libs/mootools/%s/mootools.js",
+ MOOTOOLS_VERSIONS)
+
+# Prototype.js
+get_pattern("prototype",
+ "https://ajax.googleapis.com/ajax/libs/prototype/%s/prototype.js",
+ PROTOTYPE_VERSIONS)
+
+# Scriptaculous
+get_pattern("scriptaculous",
+ "https://ajax.googleapis.com/ajax/libs/scriptaculous/%s/scriptaculous.js",
+ SCRIPTACULOUS_VERSIONS)
+
+# SWFObject
+get_pattern("swfobject",
+ "https://ajax.googleapis.com/ajax/libs/swfobject/%s/swfobject.js",
+ SWFOBJECT_VERSIONS)
+get_pattern("swfobject",
+ "https://ajax.googleapis.com/ajax/libs/swfobject/%s/swfobject_src.js",
+ SWFOBJECT_VERSIONS)
+
+# Underscore
+get_pattern("underscore",
+ "https://raw.github.com/documentcloud/underscore/%s/underscore.js",
+ UNDERSCORE_VERSIONS)
+get_pattern("underscore",
+ "https://raw.github.com/documentcloud/underscore/%s/underscore-min.js",
+ UNDERSCORE_VERSIONS)
+
+# Old-style YUI loader libraries:
+get_pattern("yui",
+ "http://yui.yahooapis.com/%s/build/yuiloader/yuiloader-min.js",
+ YUI_VERSIONS)
+get_pattern("yui",
+ "http://yui.yahooapis.com/%s/build/yuiloader/yuiloader.js",
+ YUI_VERSIONS)
+
+# New-style YUI libraries
+get_pattern("yui",
+ "http://yui.yahooapis.com/%s/build/yui-base/yui-base-min.js",
+ YUI_NEW_VERSIONS)
+get_pattern("yui",
+ "http://yui.yahooapis.com/%s/build/yui-base/yui-base.js",
+ YUI_NEW_VERSIONS)
+
+
+CRYPTO_FILES = ["aes", "cipher-core", "core", "enc-base64", "enc-utf16",
+ "evpkdf", "hmac", "md5", "mode-cfb", "mode-ctr", "mode-ecb",
+ "mode-ofb", "pad-ansix923", "pad-iso10126", "pad-iso97971",
+ "pad-nopadding", "pad-zeropadding", "pbkdf2", "rabbit", "rc4",
+ "sha1", "sha224", "sha256", "sha384", "sha512", "tripledes",
+ "x64-core"]
+get_pattern(
+ "crypto_js", "http://crypto-js.googlecode.com/svn/tags/3.0.2/src/%s.js",
+ CRYPTO_FILES)
diff --git a/tools/library-fetch-tools/list-of-js-for-testing.html b/tools/library-fetch-tools/list-of-js-for-testing.html
new file mode 100644
index 0000000..cadd49f
--- /dev/null
+++ b/tools/library-fetch-tools/list-of-js-for-testing.html
@@ -0,0 +1,337 @@
+<script src="https://addons.cdn.mozilla.net/en-US/firefox/files/browse/149703/file-serve/bootstrap.js?token=e9d0767e-643c-48ad-b09e-fc075ca60b77"></script>
+<script src="https://raw.github.com/voldsoftware/toolbarbutton-jplib/stable/lib/toolbarbutton.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.1.1/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.3.0/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.3.1/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.4.3/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.5.1/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.xd.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.1.1/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.2.3/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.3.0/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.3.1/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.4.3/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.5.1/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.xd.js.uncompressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/ext-core/3.0.0/ext-core.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/ext-core/3.0.0/ext-core-debug.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core-debug.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.1.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.2.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.2.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.3.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.3.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.4.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.0.4.js"></script>
+<script src="http://code.jquery.com/jquery-1.1.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.1.1.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.1.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.1.2.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.1.2.js"></script>
+<script src="http://code.jquery.com/jquery-1.1.3.pack.js"></script>
+<script src="http://code.jquery.com/jquery-1.4.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.4.js"></script>
+<script src="http://code.jquery.com/jquery-1.4.1.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.4.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.4.2.js"></script>
+<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.4.4.js"></script>
+<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.5.js"></script>
+<script src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.5.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.5.2.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.2.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.3.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.3.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.6.4.js"></script>
+<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.7.js"></script>
+<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.7.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.7.2.js"></script>
+<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
+<script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.8.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
+<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
+<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
+<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
+<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
+<script src="http://code.jquery.com/jquery-1.10.0.js"></script>
+<script src="http://code.jquery.com/jquery-2.0.0.min.js"></script>
+<script src="http://code.jquery.com/jquery-2.0.0.js"></script>
+<script src="http://code.jquery.com/jquery-2.0.1.min.js"></script>
+<script src="http://code.jquery.com/jquery-2.0.1.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.1.3.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.1.3.1.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.1.3.1.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.1.4.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.1.4.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.1.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.1.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.1.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.2.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.2.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.2.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.3.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.3.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.4.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.4.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.4.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.5.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.5.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.5.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
+<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.6.0/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.6.0/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.1.1/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.1.2/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.5/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.0/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.2/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.3/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.4/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.1.1/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.1.2/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.2.5/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.1/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.0/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.2/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.3/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.4/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/scriptaculous.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject_src.js"></script>
+<script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.3.3/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.3.2/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.3.1/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.3.0/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.4/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.3/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.2/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.1/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.0/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.7/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.6/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.5/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.4/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.3/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.2/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.1/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.0/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.4/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.3/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.2/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.1/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.0/underscore.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.3.3/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.3.2/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.3.1/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.3.0/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.4/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.3/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.2/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.1/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.2.0/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.7/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.6/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.5/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.4/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.3/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.2/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.1/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.1.0/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.4/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.3/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.2/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.1/underscore-min.js"></script>
+<script src="https://raw.github.com/documentcloud/underscore/1.0.0/underscore-min.js"></script>
+<script src="http://yui.yahooapis.com/2.6.0/build/yuiloader/yuiloader-min.js"></script>
+<script src="http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader-min.js"></script>
+<script src="http://yui.yahooapis.com/2.8.0r4/build/yuiloader/yuiloader-min.js"></script>
+<script src="http://yui.yahooapis.com/2.8.1/build/yuiloader/yuiloader-min.js"></script>
+<script src="http://yui.yahooapis.com/2.8.2/build/yuiloader/yuiloader-min.js"></script>
+<script src="http://yui.yahooapis.com/2.9.0/build/yuiloader/yuiloader-min.js"></script>
+<script src="http://yui.yahooapis.com/2.6.0/build/yuiloader/yuiloader.js"></script>
+<script src="http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader.js"></script>
+<script src="http://yui.yahooapis.com/2.8.0r4/build/yuiloader/yuiloader.js"></script>
+<script src="http://yui.yahooapis.com/2.8.1/build/yuiloader/yuiloader.js"></script>
+<script src="http://yui.yahooapis.com/2.8.2/build/yuiloader/yuiloader.js"></script>
+<script src="http://yui.yahooapis.com/2.9.0/build/yuiloader/yuiloader.js"></script>
+<script src="http://yui.yahooapis.com/3.3.0/build/yui-base/yui-base-min.js"></script>
+<script src="http://yui.yahooapis.com/3.4.0/build/yui-base/yui-base-min.js"></script>
+<script src="http://yui.yahooapis.com/3.4.1/build/yui-base/yui-base-min.js"></script>
+<script src="http://yui.yahooapis.com/3.5.0/build/yui-base/yui-base-min.js"></script>
+<script src="http://yui.yahooapis.com/3.5.1/build/yui-base/yui-base-min.js"></script>
+<script src="http://yui.yahooapis.com/3.6.0/build/yui-base/yui-base-min.js"></script>
+<script src="http://yui.yahooapis.com/3.3.0/build/yui-base/yui-base.js"></script>
+<script src="http://yui.yahooapis.com/3.4.0/build/yui-base/yui-base.js"></script>
+<script src="http://yui.yahooapis.com/3.4.1/build/yui-base/yui-base.js"></script>
+<script src="http://yui.yahooapis.com/3.5.0/build/yui-base/yui-base.js"></script>
+<script src="http://yui.yahooapis.com/3.5.1/build/yui-base/yui-base.js"></script>
+<script src="http://yui.yahooapis.com/3.6.0/build/yui-base/yui-base.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/aes.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/cipher-core.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/core.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/enc-base64.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/enc-utf16.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/evpkdf.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/hmac.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/md5.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/mode-cfb.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/mode-ctr.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/mode-ecb.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/mode-ofb.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-ansix923.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-iso10126.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-iso97971.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-nopadding.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pad-zeropadding.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/pbkdf2.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/rabbit.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/rc4.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha1.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha224.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha256.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha384.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/sha512.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/tripledes.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/src/x64-core.js"></script>
diff --git a/tools/library-fetch-tools/whitelist_hashes.txt b/tools/library-fetch-tools/whitelist_hashes.txt
new file mode 100644
index 0000000..01e74c9
--- /dev/null
+++ b/tools/library-fetch-tools/whitelist_hashes.txt
@@ -0,0 +1,306 @@
+"bd9624f882f7d3d29292ddc7f484987b3e991cb5": {"filename": "underscore.1.3.0.underscore.js", "result": 6},
+"db895a7ed5c8b42e27de2b3ef3199d038a259fdb": {"filename": "jqueryui.1.8.8.jquery-ui.min.js", "result": 6},
+"1523029ce227a35976407408c5d08039c8fe4f0e": {"filename": "yui.2.7.0.yuiloader.js", "result": 6},
+"da851ac384c279992d1855d59257f8d98c603063": {"filename": "jqueryui.1.7.0.jquery-ui.min.js", "result": 6},
+"c10dbe0c2b23444d0794f3376398702d84f41583": {"filename": "jquery.1.2.6.pack.jquery-1.2.6.pack.js", "result": 6},
+"fe810f47883364fbc4dc2c61e03a3aca0f74fed7": {"filename": "jqueryui.1.5.3.jquery-ui.min.js", "result": 6},
+"b3db6906c1c0641b7a3098e547e0a8039accd80a": {"filename": "yui.3.5.0.yui-base.js", "result": 6},
+"7622c9ac2335be6dcd3ab8b47132e94089cef931": {"filename": "jquery.1.6.2.min.jquery-1.6.2.min.js", "result": 6},
+"a7e07121debf460f86aa77073676c1e936478c22": {"filename": "jquery.1.1.3.jquery-1.1.3.js", "result": 6},
+"35a54ef9e4073d390afdb39874c82198cafc78f6": {"filename": "dojo.uncompressed.1.0.3.js", "result": 6},
+"4cc838a3be933fda21bbbfc8f52b01e14a1e70a5": {"filename": "dojo.1.4.1.dojo.xd.js.uncompressed.js", "result": 6},
+"669d164e3bff6156b21084cf035979d62433df75": {"filename": "mootools.1.2.2.mootools-yui-compressed.js", "result": 6},
+"1f102103bea71c5e173a916137c563dc62a97cdb": {"filename": "jqueryui.1.8.1.jquery-ui.js", "result": 6},
+"4c12e01d990bd2b1075812d9f28e3ffa50ca59df": {"filename": "jquery.1.0.3.jquery-1.0.3.js", "result": 6},
+"b1a271458ae47d0b47c9e0996956091a93dec16f": {"filename": "mootools.1.4.1.mootools-yui-compressed.js", "result": 6},
+"5f47da5d3c8902e763ef6ae02e9307a63a95ae5a": {"filename": "yui.2.6.0.yuiloader-min.js", "result": 6},
+"2804fac51308f459c3eb9c3d20e7ee009a8ba31c": {"filename": "jqueryui.1.8.5.jquery-ui.js", "result": 6},
+"81afb4cd3755671fea5e74d7118d7d460c475308": {"filename": "underscore.1.1.7.underscore-min.js", "result": 6},
+"b48e01c35c1e6ad622386b9a3161bd1bf02723c8": {"filename": "jqueryui.1.8.13.jquery-ui.min.js", "result": 6},
+"b5efe44645f5358e3d785091af3440f80afa85e3": {"filename": "jquery.1.4.min.jquery-1.4.min.js", "result": 6},
+"0cf62d1dd0c483b423f5dfd655f62d03ed2668f6": {"filename": "jquery.1.6.3.min.jquery-1.6.3.min.js", "result": 6},
+"c147a1a86a2c33e60f160b8861501f43f4638c8d": {"filename": "prototype.1.6.1.0.prototype.js", "result": 6},
+"ede1d022640f26eaa6109da9e924670f6ed14cce": {"filename": "underscore.1.3.2.underscore-min.js", "result": 6},
+"24fdaa88685c8b2dadcc94559ceef318fdcd115b": {"filename": "jquery.1.1.1.jquery-1.1.1.js", "result": 6},
+"8fdfbe7ccaf0bdcde4c0b34738c0cd73b4587a45": {"filename": "jqueryui.1.8.6.jquery-ui.min.js", "result": 6},
+"788bb58005b75a004cd7abbd26f942eea0391f47": {"filename": "jquery.1.1.2.jquery-1.1.2.js", "result": 6},
+"3aca6488dfb65cf0e600a7a70376ca1354b7377c": {"filename": "jquery.1.2.jquery-1.2.js", "result": 6},
+"f2fa9179d764f6a688dc0c99b1b5283f1b680249": {"filename": "underscore.1.1.1.underscore.js", "result": 6},
+"2fabac9f0be842198a46b98ff8a75d420d9bede7": {"filename": "dojo.1.7.0.dojo.xd.js.uncompressed.js", "result": 6},
+"09fdd3d9aebc9086b27b45b3fb051ebded272b39": {"filename": "jqueryui.1.8.1.jquery-ui.min.js", "result": 6},
+"fc21f8084ad4040ddbf620ba79acd3998fb3dc7b": {"filename": "mootools.1.3.2.mootools-yui-compressed.js", "result": 6},
+"0881516b541abe68d79724c08c1a665872f8f2c2": {"filename": "jqueryui.1.8.18.jquery-ui.js", "result": 6},
+"9718416c0fc55875d8a1599c230498c647a631ec": {"filename": "jqueryui.1.5.2.jquery-ui.js", "result": 6},
+"db30b6127f8f59f6c15123db943a7e7ed3f3d9d3": {"filename": "dojo.1.7.3.dojo.xd.js", "result": 6},
+"7b3bca1ff4ab9e8225776a8406de5f40f706791c": {"filename": "jqueryui.1.6.0.jquery-ui.js", "result": 6},
+"8f1cfeefecc782f53f411de1bf64c77b48b8ba56": {"filename": "yui.2.8.1.yuiloader-min.js", "result": 6},
+"06adc576409427237ce3c269bb9a568d3cd53c9b": {"filename": "jqueryui.1.8.7.jquery-ui.min.js", "result": 6},
+"d9f710afddaba467707c0d6e7b187a8beae1e1f2": {"filename": "yui.2.8.2.yuiloader.js", "result": 6},
+"c82ea9768b18696832408b6cc729e2e121def691": {"filename": "jquery.1.2.3.jquery-1.2.3.js", "result": 6},
+"298ffe964a1373fd7e587e616b8bda0bcc9c3a19": {"filename": "jquery.1.8.0.jquery-1.8.0.js", "result": 6},
+"e0c497fc264d7706da23235266ed52acf2c7b89a": {"filename": "jquery.1.2.min.jquery-1.2.min.js", "result": 6},
+"b842a8ca5e996e001e648fc8c73316cd55e496ed": {"filename": "underscore.1.0.4.underscore.js", "result": 6},
+"9514b1927292acf4c670fae6492e9ce2e263472f": {"filename": "yui.2.8.0r4.yuiloader.js", "result": 6},
+"c7e2076a3af9997731499bc1f7dc3941b522c1eb": {"filename": "mootools.1.4.3.mootools-yui-compressed.js", "result": 6},
+"9262d972b175f4550aa10926e07dd3ecc42f5c46": {"filename": "dojo.1.1.2.js", "result": 6},
+"ea6cc893792569fdbb344181034eb668261f2b24": {"filename": "jquery.1.5.1.jquery-1.5.1.js", "result": 6},
+"fe91b37266d1cdb4b4f51297f69326e271704f35": {"filename": "mootools.1.3.1.mootools-yui-compressed.js", "result": 6},
+"fa05290dadfb7d2659a55c50b77595e23f999a74": {"filename": "jquery.1.0.1.jquery-1.0.1.js", "result": 6},
+"a2035b74876c5212cfe3e4e35dfd070e74e8c3fd": {"filename": "jqueryui.1.8.22.jquery-ui.js", "result": 6},
+"a3e5c42f93722ad28cda811f8635bddf213819ed": {"filename": "dojo.1.6.dojo.xd.js", "result": 6},
+"f853ce5ba28824d7e19b9ea9751aa8e4db8972df": {"filename": "dojo.1.8.0.dojo.xd.js.uncompressed.js", "result": 6},
+"55c7f265deba4afc1335071fafbbf7fda8f02bbe": {"filename": "jquery.1.2.6.jquery-1.2.6.js", "result": 6},
+"0a2054143eddc76447bacf3da455ffc1c726e304": {"filename": "yui.3.6.0.yui-base.js", "result": 6},
+"e1db767afb82018ab6a695fe52334f2f5d81a0e3": {"filename": "dojo.1.6.dojo.xd.js.uncompressed.js", "result": 6},
+"a3c5deba8c4fd335bc0ebea9ecd6a6684cf864c8": {"filename": "jquery.1.8.1.min.jquery-1.8.1.min.js", "result": 6},
+"34454bfed864addf8ec4aacdd9adf872f8360ed3": {"filename": "underscore.1.3.1.underscore.js", "result": 6},
+"7f7859e006f0644a43a7294b50b39e7e9159b3a2": {"filename": "jqueryui.1.7.2.jquery-ui.js", "result": 6},
+"2e140b943f459e383f569227b3e5569f0dbc6f34": {"filename": "jqueryui.1.8.14.jquery-ui.js", "result": 6},
+"1be9c3684054001f53fa7ff6d85ec3cb573a9cd2": {"filename": "jquery.1.2.6.min.jquery-1.2.6.min.js", "result": 6},
+"2de2ecea5ba12e7235ffb44d6892cc77fe6f4abe": {"filename": "underscore.1.1.4.underscore-min.js", "result": 6},
+"bc018ec49a5c7757577bb63e5d5f8a99be0e3954": {"filename": "mootools.1.4.2.mootools.js", "result": 6},
+"9b719fdcb41dc4953d5ed938776c9db87a65d80c": {"filename": "jqueryui.1.5.3.jquery-ui.js", "result": 6},
+"5af7abb29b3b091080db17e53ef6ddcfa555dbe6": {"filename": "jquery.1.1.4.jquery-1.1.4.js", "result": 6},
+"7df0e9aae795337db012b3efd0b9ee9cc7719b56": {"filename": "mootools.1.3.0.mootools.js", "result": 6},
+"3d9fc65389ce7de16f87909039aa2e728c693b3d": {"filename": "mootools.1.2.5.mootools.js", "result": 6},
+"661f092a83af631218c46f4d155b1a4ee5cda6ae": {"filename": "jquery.1.8.1.jquery-1.8.1.js", "result": 6},
+"8e8b0dccbacc70dc6406023be9e35dfa4f3a944e": {"filename": "jqueryui.1.8.16.jquery-ui.min.js", "result": 6},
+"a6edefef305d9164212fa140426629c7d8a58c93": {"filename": "dojo.1.1.1.dojo.xd.js.uncompressed.js", "result": 6},
+"3d542e33a9f3eb3cb45e06fe93d08dd4b7490496": {"filename": "prototype.1.7.0.0.prototype.js", "result": 6},
+"71cce71820cc47b3bd1098618d248325fcf24ddb": {"filename": "jquery.1.6.4.min.jquery-1.6.4.min.js", "result": 6},
+"c7f5b42b2306a79f67988ee073ac98c2a1d5782f": {"filename": "dojo.1.2.3.dojo.xd.js.uncompressed.js", "result": 6},
+"921e7702ac9e4c4a4bca052b7bc83b0304440ee3": {"filename": "jquery.1.6.4.jquery-1.6.4.js", "result": 6},
+"84b1514a01def3bc0b52f6fa03d0d9fa349bef72": {"filename": "jquery.1.0.2.pack.jquery-1.0.2.pack.js", "result": 6},
+"333b6d92a99eac873b1de2045c670fbdb61970ab": {"filename": "yui.3.5.1.yui-base.js", "result": 6},
+"0d7896e2bb23f88e26e52b22a075350b354df447": {"filename": "jquery.1.7.2.jquery-1.7.2.js", "result": 6},
+"3dc9f7c2642efff4482e68c9d9df874bf98f5bcb": {"filename": "jquery.1.3.2.min.jquery-1.3.2.min.js", "result": 6},
+"baa693e82387a328abccf9694c6d2db571ac8aca": {"filename": "underscore.1.3.3.underscore-min.js", "result": 6},
+"83d1b489e30275a03f568f7e3fa6537d695e0197": {"filename": "jquery.1.2.pack.jquery-1.2.pack.js", "result": 6},
+"dd7783b4c8d4ecaad4091d1d32df2f97d7b10ddc": {"filename": "mootools.1.1.2.mootools.js", "result": 6},
+"5cd73db8238d48c08c88f12fe9e5b99b6fa644f7": {"filename": "jqueryui.1.8.12.jquery-ui.js", "result": 6},
+"058cbd179f032f667823545519aa2d10b0b69508": {"filename": "underscore.1.1.2.underscore.js", "result": 6},
+"e5de581f09ac990adae2b4aede35264f1dc5cd72": {"filename": "jqueryui.1.8.10.jquery-ui.js", "result": 6},
+"80494ad8eb98e317ffec3671b00944cdc30cee02": {"filename": "yui.3.4.0.yui-base-min.js", "result": 6},
+"5846c870e0f1daca152db22277915adb6520ffa3": {"filename": "underscore.1.0.0.underscore.js", "result": 6},
+"f188985665f8b3d94f5d73609b211405db0b0d09": {"filename": "jqueryui.1.8.4.jquery-ui.js", "result": 6},
+"0c3d725fac553c73368496769ff77c3045103704": {"filename": "jqueryui.1.8.11.jquery-ui.js", "result": 6},
+"b87f7150da2b0811ed143443af4038e3e2d41eda": {"filename": "jqueryui.1.7.0.jquery-ui.js", "result": 6},
+"fe56013bb04c602e676feb34bb49add4da2e0225": {"filename": "scriptaculous.1.8.3.scriptaculous.js", "result": 6},
+"a2358d630d1a5dad24b679d52e9777b7349910b2": {"filename": "yui.3.5.0.yui-base-min.js", "result": 6},
+"02d2e4a524b0da52c3cb236619ad065fec44d69a": {"filename": "jqueryui.1.8.5.jquery-ui.min.js", "result": 6},
+"6b911b0dc178423b946b0299851d9661004c21ef": {"filename": "jquery.1.4.1.jquery-1.4.1.js", "result": 6},
+"ca0aea084a63d0a56e1bbf17fde5061f631b391f": {"filename": "jquery.1.2.1.pack.jquery-1.2.1.pack.js", "result": 6},
+"0e9545b59077541c44f521769243a8b717d83aae": {"filename": "mootools.1.2.5.mootools-yui-compressed.js", "result": 6},
+"e67cf6a985999c7ef5595772e4ffefeacd0c6ac3": {"filename": "underscore.1.0.1.underscore.js", "result": 6},
+"b6d2c0b655b327407966b52303449dedce084ded": {"filename": "dojo.1.4.3.dojo.xd.js.uncompressed.js", "result": 6},
+"ae74362cdb2fadb2eee6c962f47f1e33af51c79d": {"filename": "jqueryui.1.8.20.jquery-ui.min.js", "result": 6},
+"16306f8187df578589821e6eb6b807ac4d467d1f": {"filename": "jquery.1.1.pack.jquery-1.1.pack.js", "result": 6},
+"88c03b5c437ac3551661ecfbe6e1de155c3099c4": {"filename": "jquery.1.0.pack.jquery-1.0.pack.js", "result": 6},
+"2cc787ebd4d29f2e24646f76f9c525336949783e": {"filename": "mootools.1.4.5.mootools.js", "result": 6},
+"24dd74d65d2e02aae973af97ebbb31b9820a5bbb": {"filename": "jquery.1.1.1.pack.jquery-1.1.1.pack.js", "result": 6},
+"d5203dbbb97db1a68ca5a3adf265f17cdaea738d": {"filename": "jqueryui.1.8.8.jquery-ui.js", "result": 6},
+"c34d6c84ec67d4a61af87b1634bc007f2d46ba91": {"filename": "dojo.uncompressed.1.3.3.js", "result": 6},
+"0c89448016629bb2ea758f4e98529c2e166a122d": {"filename": "mootools.1.4.1.mootools.js", "result": 6},
+"86f0df8662b511142dfc4e0ce9c81d805c8d7a7e": {"filename": "mootools.1.4.0.mootools-yui-compressed.js", "result": 6},
+"5f99079e4564f94a1d5e45d22d6dc18acbb148da": {"filename": "jqueryui.1.8.21.jquery-ui.js", "result": 6},
+"bbf7ce8f5ce8d8f9d207f8973328527ac0093b17": {"filename": "jqueryui.1.8.2.jquery-ui.min.js", "result": 6},
+"6bb906d86dd239add79d0779a9fcdf9740aa7e3b": {"filename": "dojo.1.1.1.dojo.xd.js", "result": 6},
+"d0d4200eedc83fe692dd65aeab5a548bfe840d06": {"filename": "jquery.1.1.3.1.pack.jquery-1.1.3.1.pack.js", "result": 6},
+"55bba460dcbb70562536ddd5c8734b311f38c42d": {"filename": "mootools.1.2.1.mootools.js", "result": 6},
+"772b2587aa2fa345fb760eff9ebe5acd97937243": {"filename": "underscore.1.3.3.underscore.js", "result": 6},
+"9eb9ac595e9b5544e2dc79fff7cd2d0b4b5ef71f": {"filename": "jquery.1.7.1.min.jquery-1.7.1.min.js", "result": 6},
+"cf36297804ca93709e18a7f9de289610bc97f9c5": {"filename": "jquery.1.6.min.jquery-1.6.min.js", "result": 6},
+"e6277bc5142dc6f3775eda216997c5e88f48f328": {"filename": "dojo.1.7.2.dojo.xd.js", "result": 6},
+"abcd2ba13348f178b17141b445bc99f1917d47af": {"filename": "jquery.1.7.2.min.jquery-1.7.2.min.js", "result": 6},
+"4a2c9fd552e1ca9ad66feaaad365990b1e664a8f": {"filename": "jquery.1.0.4.pack.jquery-1.0.4.pack.js", "result": 6},
+"97f93241957893ebd7febc5b5bac9a7bd1d94a0f": {"filename": "underscore.1.0.3.underscore-min.js", "result": 6},
+"8c135fc57355fe5d5a18f3dbe5736bc772bb20a7": {"filename": "dojo.1.3.2.dojo.xd.js", "result": 6},
+"6dc7644a54d5cc254a1f6d7cb7154128b2b6570a": {"filename": "mootools.1.4.3.mootools.js", "result": 6},
+"842cb8f83614f6de98f70fa7de2f866eecae7ab4": {"filename": "jqueryui.1.7.1.jquery-ui.js", "result": 6},
+"4a5dc1389aad050a44ee5e81408238a317ab3413": {"filename": "jquery.1.5.1.min.jquery-1.5.1.min.js", "result": 6},
+"973e1554af7d9240e059e38165f2e7b5fc7aa0a5": {"filename": "jqueryui.1.8.10.jquery-ui.min.js", "result": 6},
+"66851ab2133e27b97c4f3048416b947aa7ed82c5": {"filename": "swfobject.2.1.swfobject.js", "result": 6},
+"4c977634c87efbd2b7113993d36dad603b8dcf2f": {"filename": "underscore.1.2.1.underscore.js", "result": 6},
+"97be02d1785b7bb4f41ae116a6a9bef74cb018d6": {"filename": "jquery.1.4.3.min.jquery-1.4.3.min.js", "result": 6},
+"677c1ad6d84705c818d63a43298ee3a12959c1b3": {"filename": "jquery.1.2.3.pack.jquery-1.2.3.pack.js", "result": 6},
+"741b8eeb65774256a8a76ea1af91f976357fcd81": {"filename": "dojo.1.5.1.dojo.xd.js", "result": 6},
+"ffd1b70071749bf5f4802db4b1b6a60937d58d24": {"filename": "dojo.1.2.4.js", "result": 6},
+"df435b881e8364ddfbd44d5f786b10c75f964175": {"filename": "dojo.1.3.2.dojo.xd.js.uncompressed.js", "result": 6},
+"df60c759fdccee4cb04169c2e3ff2f77a3c83907": {"filename": "dojo.1.0.3.js", "result": 6},
+"fc39ed8ca4a58668124471e509506443de4467f2": {"filename": "mootools.1.4.4.mootools-yui-compressed.js", "result": 6},
+"0a0a820f2bc4f2dac8dcfde2282411275e2dc697": {"filename": "dojo.1.5.dojo.xd.js.uncompressed.js", "result": 6},
+"6c445baf655cccb16ee2788714827ab186ed94bf": {"filename": "scriptaculous.1.8.2.scriptaculous.js", "result": 6},
+"fed603a4db640b82de54b246de4be7a1cffa8780": {"filename": "jquery.1.3.1.min.jquery-1.3.1.min.js", "result": 6},
+"149b5180cb9de3f646fc26802440a6ac6e758d40": {"filename": "jquery.1.8.2.min.jquery-1.8.2.min.js", "result": 6},
+"c1dff1c5dbb68af6e22bd401afd28aab970a8aff": {"filename": "underscore.1.0.3.underscore.js", "result": 6},
+"8963108fa84c2033a1052d47079d7f75a7e5b60e": {"filename": "jquery.1.2.5.jquery-1.2.5.js", "result": 6},
+"61c88c8898ae6bd653737a9dae52209a98998def": {"filename": "jqueryui.1.8.2.jquery-ui.js", "result": 6},
+"384cbfe95d92a30d7c86ac07ea5de56f79c15f6a": {"filename": "jquery.1.2.1.jquery-1.2.1.js", "result": 6},
+"960e36796c42dadf66fafb63bba6087c7d6e1d85": {"filename": "jqueryui.1.8.0.jquery-ui.js", "result": 6},
+"d97ecac3f1b3ccf1f0f68434e8406f87f5acc907": {"filename": "jquery.1.2.2.min.jquery-1.2.2.min.js", "result": 6},
+"2bab42610adee25cdc0d3a4ba96b94f1e9ccd115": {"filename": "dojo.1.2.0.dojo.xd.js", "result": 6},
+"3c1ddf62af20a1f5c5de7a3af180b32528dc47db": {"filename": "mootools.1.2.2.mootools.js", "result": 6},
+"8980e43d4750c63eb57cfff5f0723f118d243c67": {"filename": "dojo.1.3.0.dojo.xd.js", "result": 6},
+"f0b95e99225f314fbe37ccf6b74ce2f916c517de": {"filename": "jquery.1.3.2.jquery-1.3.2.js", "result": 6},
+"f3abd53f3725675e3e049c414749e16df11951ba": {"filename": "jquery.1.3.jquery-1.3.js", "result": 6},
+"d26763498c38c5f245e81eb26d46604c39040d6d": {"filename": "jquery.1.7.jquery-1.7.js", "result": 6},
+"e77f9c1022bb48425d63cbaf309d7718ff5d3fbd": {"filename": "yui.2.8.0r4.yuiloader-min.js", "result": 6},
+"08f37f8169e620c6ecd87635c18fc2b22e3e850e": {"filename": "scriptaculous.1.9.0.scriptaculous.js", "result": 6},
+"6be187a67b639b65dc8427eb8e790e42bbe4d7dd": {"filename": "jquery.1.3.1.jquery-1.3.1.js", "result": 6},
+"31d0cb90f7b82088df6c4e00b5765f9dccc48329": {"filename": "jqueryui.1.8.23.jquery-ui.js", "result": 6},
+"b5f2733aac4e257929a5f1ff93410ee0bda311b6": {"filename": "jqueryui.1.7.3.jquery-ui.min.js", "result": 6},
+"33f5808531e82f2f6e8859da3a765c4d8a0073d2": {"filename": "jqueryui.1.8.11.jquery-ui.min.js", "result": 6},
+"85b15aef55b1eede971c7febd0c00ba04dc16edf": {"filename": "jqueryui.1.8.17.jquery-ui.js", "result": 6},
+"1185da1043863517c6aa0a4e0a3bc433dfb98313": {"filename": "underscore.1.2.2.underscore-min.js", "result": 6},
+"6952564ff6404bd93cb523f1634b451ac1cc8fec": {"filename": "jqueryui.1.8.14.jquery-ui.min.js", "result": 6},
+"6463e558dd79d51a2e8464806824c7bbc18c77fd": {"filename": "jquery.1.2.3.min.jquery-1.2.3.min.js", "result": 6},
+"22c1eefcce5be20a3e0966f5bcdf88ed81e9f5e7": {"filename": "jquery.1.6.1.jquery-1.6.1.js", "result": 6},
+"31555f340a206de7622fb760718ef4a1b296ed44": {"filename": "jquery.1.1.jquery-1.1.js", "result": 6},
+"133de2283d03193cb06f62f92c494afe098460a5": {"filename": "underscore.1.2.0.underscore.js", "result": 6},
+"67070ff953d6b0f886083edba723f6d66fa6cbca": {"filename": "jqueryui.1.8.15.jquery-ui.min.js", "result": 6},
+"431b7ebb5e36d5af5e7890b782789ac983e28d00": {"filename": "jqueryui.1.8.19.jquery-ui.min.js", "result": 6},
+"7d6e352b0d26655ba851863561b5d912cc24caa7": {"filename": "underscore.1.2.0.underscore-min.js", "result": 6},
+"9fa29ea8f3ec6714b3b6236eb2ce6e1ce905c560": {"filename": "yui.2.6.0.yuiloader.js", "result": 6},
+"4dc6c77a03258ee7fbe5e877a1ed97311bc45652": {"filename": "swfobject.2.2.swfobject_src.js", "result": 6},
+"0a15952061f6fb7a5493281f6ff8eb916a417e2f": {"filename": "underscore.1.3.1.underscore-min.js", "result": 6},
+"d3b30b0fead39e4c40fb0c91408e74439020a279": {"filename": "jquery.1.0.2.jquery-1.0.2.js", "result": 6},
+"00a5e26ff9ed4b84fc93c764225684c33588a41e": {"filename": "yui.3.6.0.yui-base-min.js", "result": 6},
+"81eff28ad7eb0f8037d887200d158f25140faca7": {"filename": "underscore.1.1.0.underscore.js", "result": 6},
+"aa113da84ddbad46a8002ea22393a238eccf9ee4": {"filename": "yui.2.9.0.yuiloader-min.js", "result": 6},
+"ad0775c89a87111019840dc7bbf902d832e4ccdf": {"filename": "underscore.1.0.0.underscore-min.js", "result": 6},
+"3e5c6d7c6e09965d36df8c1e3d9dca6462c41ec1": {"filename": "jquery.1.6.3.jquery-1.6.3.js", "result": 6},
+"71adcc2cae87e412e521e4a7276efeaee2347927": {"filename": "jquery.1.2.2.jquery-1.2.2.js", "result": 6},
+"e398b87b98ae72cbee9f7d3044189ea638f3f80c": {"filename": "jqueryui.1.8.22.jquery-ui.min.js", "result": 6},
+"7361e8afa72bd0098e2520584786474c9c4a5064": {"filename": "underscore.1.0.2.underscore-min.js", "result": 6},
+"911a35988b8540414cfbc990fbc112eb124fd968": {"filename": "dojo.1.5.dojo.xd.js", "result": 6},
+"eeee9d4604e71f2e01b818fc1439f7b5baf1be7a": {"filename": "jquery.1.6.2.jquery-1.6.2.js", "result": 6},
+"fc4c1a4691f3819ecd16eaefa68f96f764538f1e": {"filename": "jqueryui.1.8.17.jquery-ui.min.js", "result": 6},
+"28e41c3ce9232633468013342c49fd62a4f5f6bd": {"filename": "underscore.1.2.2.underscore.js", "result": 6},
+"6111fcf6c2277eba8821ca365dbbea472a3206e7": {"filename": "mootools.1.4.4.mootools.js", "result": 6},
+"868141351efa758d031779c776e608e3a049d823": {"filename": "underscore.1.1.4.underscore.js", "result": 6},
+"65fe3b80fae349ecb3acd6541ef651d1ff4961f6": {"filename": "mootools.1.2.1.mootools-yui-compressed.js", "result": 6},
+"ee68308411c690cd51cc8a43fe6ae60d3d1678af": {"filename": "underscore.1.0.4.underscore-min.js", "result": 6},
+"5717e22c3b2c7caf870fc0772a64344962b59ee6": {"filename": "underscore.1.1.6.underscore.js", "result": 6},
+"a3e5c42f93722ad28cda811f8635bddf213819ed": {"filename": "dojo.1.6.1.dojo.xd.js", "result": 6},
+"cc66556593e147584f19b41b697405f828f7562e": {"filename": "jquery.1.5.jquery-1.5.js", "result": 6},
+"08341cd159e29f561ca0ec16c99bf4b85e43d30f": {"filename": "jquery.1.0.1.pack.jquery-1.0.1.pack.js", "result": 6},
+"a192b2ef3371febba192179ff86e3da3f633160d": {"filename": "jqueryui.1.8.9.jquery-ui.min.js", "result": 6},
+"e002b335c75b5edefcd251962f61f53a2ab8e0f2": {"filename": "jqueryui.1.8.0.jquery-ui.min.js", "result": 6},
+"bcdd63e18a8a7cf728253f738556ad3b88d74649": {"filename": "underscore.1.1.2.underscore-min.js", "result": 6},
+"e80905e4a45e31075b89189f5ba4913fc0451fdf": {"filename": "yui.2.9.0.yuiloader.js", "result": 6},
+"f4d4125bcd5151aad69dd849a11fc1ca589cc64b": {"filename": "mootools.1.3.1.mootools.js", "result": 6},
+"b509dd44ba3f9c72cf8bba6fcb5f06fae15cabf6": {"filename": "jquery.1.5.2.jquery-1.5.2.js", "result": 6},
+"3f1b0e9e54af1af2db2c8a639530448723462151": {"filename": "jquery.1.7.min.jquery-1.7.min.js", "result": 6},
+"f02e1f7f1bb966d5fcf16b03daa79ee077a993f8": {"filename": "jquery.1.4.jquery-1.4.js", "result": 6},
+"f519d9c0761a99a03c32a07fe1611444c2c223d1": {"filename": "underscore.1.1.6.underscore-min.js", "result": 6},
+"cc019ac09f68258ee3442fe7cc440adf78a3cef2": {"filename": "mootools.1.4.5.mootools-yui-compressed.js", "result": 6},
+"70b1fe9dd4ebec0b5d417647e549bca8f9200020": {"filename": "dojo.1.3.1.dojo.xd.js", "result": 6},
+"e5335c2a82f26e49b1324edc21e452de040d5cdc": {"filename": "mootools.1.2.4.mootools.js", "result": 6},
+"7dc1b4f3e358c58030c4676c990eff60a0fc838f": {"filename": "ext-core.3.1.0.ext-core.js", "result": 6},
+"8b71e136c6275d0eeed2b55b9e718a54ce343015": {"filename": "jqueryui.1.8.7.jquery-ui.js", "result": 6},
+"99b7a6ecd023a00fdb104f2da21859e6bb9d49fa": {"filename": "jquery.1.5.min.jquery-1.5.min.js", "result": 6},
+"6fca78dac2797c02d86a4bf6514eda398b7dbe62": {"filename": "jquery.1.6.1.min.jquery-1.6.1.min.js", "result": 6},
+"6869cb783670d6a4923aaccfe4331015961ed8d6": {"filename": "jquery.1.2.4.pack.jquery-1.2.4.pack.js", "result": 6},
+"65cbff4e9d95d47a6f31d96ab4ea361c1f538a7b": {"filename": "jquery.1.4.2.min.jquery-1.4.2.min.js", "result": 6},
+"07916c0b7274275f916fe288d01b254545b17d9a": {"filename": "underscore.1.2.4.underscore.js", "result": 6},
+"e55462193a857ffe36e42bfcbecfebf1ca33d0b8": {"filename": "mootools.1.3.2.mootools.js", "result": 6},
+"0cafb88edcaebad82c207cdf124de1889364c9f3": {"filename": "jquery.1.2.1.min.jquery-1.2.1.min.js", "result": 6},
+"00667aafa5aab2ff1522a1c95b308eafdc5058de": {"filename": "dojo.uncompressed.1.2.4.js", "result": 6},
+"c7e9c7f2fb17e0d2ca2391e33007bf3547fec465": {"filename": "prototype.1.7.1.0.prototype.js", "result": 6},
+"1b96be82b697e835b903c6c22799c8e4e55e285c": {"filename": "jqueryui.1.8.6.jquery-ui.js", "result": 6},
+"34d32c47711aa10bdeb196c55d489962296a64c4": {"filename": "jqueryui.1.8.12.jquery-ui.min.js", "result": 6},
+"9025fe9334566eb919ddca85a8f949b01c7d837d": {"filename": "jquery.1.2.5.pack.jquery-1.2.5.pack.js", "result": 6},
+"03a65e56fc95caea1b85a591c984e9b6c080726d": {"filename": "mootools.1.1.1.mootools-yui-compressed.js", "result": 6},
+"7b9e8594368d30387059e5fdef9d662095dbbf7a": {"filename": "jquery.1.3.min.jquery-1.3.min.js", "result": 6},
+"bb2be1fe71a420e39ee514fd82474e6fbfea7e27": {"filename": "yui.3.3.0.yui-base.js", "result": 6},
+"d8afec39893c1a99139212feb40888847f8a5253": {"filename": "dojo.1.2.0.dojo.xd.js.uncompressed.js", "result": 6},
+"f76616dd0b644ae8e594b11571b542e7151cd0af": {"filename": "PersonasInteractive_bootstrap.js", "result": 6},
+"359c6c1ed98081b9a69eb3513b9deced59c957f9": {"filename": "jquery.1.8.0.min.jquery-1.8.0.min.js", "result": 6},
+"53dd39212504739ac18790a4461b9a67c50f2728": {"filename": "jqueryui.1.8.13.jquery-ui.js", "result": 6},
+"427300f82762288c5af967dbf642fbec58c201ea": {"filename": "jquery.1.4.4.jquery-1.4.4.js", "result": 6},
+"d9b48fef067caa58d4e1dec54801c22fe0ea7449": {"filename": "jqueryui.1.8.16.jquery-ui.js", "result": 6},
+"680f1bd5b4021dbac8b82d68a818d3a94f097ffd": {"filename": "jqueryui.1.8.18.jquery-ui.min.js", "result": 6},
+"981a1582976d1b569d8c6c4cbb65fb48bd05c4e8": {"filename": "dojo.1.8.0.dojo.xd.js", "result": 6},
+"9e389ede8ed7f782c5ecf2f87c3afa3b1e309bff": {"filename": "underscore.1.1.3.underscore-min.js", "result": 6},
+"e1e87320b2d14e36a9bba1b637b5247645df7185": {"filename": "jqueryui.1.8.19.jquery-ui.js", "result": 6},
+"2710cce192fcc4dc676d9572cd852f104ea59387": {"filename": "jquery.1.2.2.pack.jquery-1.2.2.pack.js", "result": 6},
+"278d68b8e9edad4895836e272fbc8f78ec4f2f3e": {"filename": "prototype.1.6.0.3.prototype.js", "result": 6},
+"cfbc3fa20d685d100308e123c3310dc9600ef0fd": {"filename": "underscore.1.2.3.underscore-min.js", "result": 6},
+"8d84b347dfe4f5b75f7b5f670326ca5c8041b7a9": {"filename": "underscore.1.2.3.underscore.js", "result": 6},
+"20860bad9c83c3890be57052f009b9d97848c9ec": {"filename": "jquery.1.2.5.min.jquery-1.2.5.min.js", "result": 6},
+"034970f98cb529c779c8f961b2b7c09ecb499240": {"filename": "jquery.1.6.jquery-1.6.js", "result": 6},
+"429282063ca7f3bae9797d70a6f09f2e3e05458a": {"filename": "jqueryui.1.8.23.jquery-ui.min.js", "result": 6},
+"9564fa7a6a001e4e56b0244ccda03eef3940813e": {"filename": "underscore.1.1.3.underscore.js", "result": 6},
+"e1c9252b3e60673e4fa1bb1648cb18cd33139535": {"filename": "jquery.1.1.3.1.jquery-1.1.3.1.js", "result": 6},
+"5847ed101f55d51c53538a7078971e7de8fb6762": {"filename": "swfobject.2.2.swfobject.js", "result": 6},
+"f444ee6b041735ee6109dd2fe3c3a7755fa949f7": {"filename": "dojo.1.3.0.dojo.xd.js.uncompressed.js", "result": 6},
+"e1db767afb82018ab6a695fe52334f2f5d81a0e3": {"filename": "dojo.1.6.1.dojo.xd.js.uncompressed.js", "result": 6},
+"f78ae3cdaf4a6a21dfb2565491f5d295462d8be3": {"filename": "jqueryui.1.7.1.jquery-ui.min.js", "result": 6},
+"3fa74bb289537fcdee796b26968e47d53d38f903": {"filename": "underscore.1.3.2.underscore.js", "result": 6},
+"42936431058c6c4663e64e2c07931b9159083c31": {"filename": "jqueryui.1.8.4.jquery-ui.min.js", "result": 6},
+"083bbcd739b7b1336f13c72603e1704b164c02bd": {"filename": "underscore.1.2.1.underscore-min.js", "result": 6},
+"f3e20ad41082a93dbd09202590717da71aebd316": {"filename": "mootools.1.2.3.mootools-yui-compressed.js", "result": 6},
+"14682f01c5c15f8656cb01425487ad675676df8e": {"filename": "yui.3.5.1.yui-base-min.js", "result": 6},
+"49a747d3284b1d04f3eb823a4188f7725004f823": {"filename": "underscore.1.1.0.underscore-min.js", "result": 6},
+"9d6f8bdcadd59eba977e9e31066bf393c9fdf8a4": {"filename": "jquery.1.0.4.jquery-1.0.4.js", "result": 6},
+"8dda5f159c9bedee9f4a6b7a7a6028a554977994": {"filename": "dojo.1.4.3.dojo.xd.js", "result": 6},
+"5ed6bdacae842fc530dbc83aabb9a466c7f2b5a1": {"filename": "jqueryui.1.6.0.jquery-ui.min.js", "result": 6},
+"a4fadcd6f68d7823a9fd9d1f6089025041a3212a": {"filename": "yui.2.8.2.yuiloader-min.js", "result": 6},
+"07c089df7b7a5da16f434870087d6b0e1c45d3b5": {"filename": "jquery.1.1.2.pack.jquery-1.1.2.pack.js", "result": 6},
+"3bb92e84642c03cf0fe49174d0e1c420d46d2e18": {"filename": "jquery.1.2.4.jquery-1.2.4.js", "result": 6},
+"a90b5f6afb6c78b30c3539392d49e45fd9dfe3d9": {"filename": "dojo.1.5.1.dojo.xd.js.uncompressed.js", "result": 6},
+"7e0294019938a772f4ddd7799501496074e0f0fb": {"filename": "underscore.1.1.7.underscore.js", "result": 6},
+"15c3f73c75bb3ab87040fe55240f9dd5ea69b6bf": {"filename": "ext-debug.3.1.0.ext-core-debug.js", "result": 6},
+"2fee700150a7de876acc21403f77e57dae2f5618": {"filename": "underscore.1.1.5.underscore.js", "result": 6},
+"5de53da57fc8b7ab6c77d597c22875d747352fef": {"filename": "underscore.1.1.1.underscore-min.js", "result": 6},
+"c43a38fce1aa745d59b1a6f7ab7def81f28701a4": {"filename": "mootools.1.2.3.mootools.js", "result": 6},
+"265a86a9d9df5dfdbad77e06c85605bec4beb32a": {"filename": "jquery.1.4.2.jquery-1.4.2.js", "result": 6},
+"0d2bc9db63acd9cc238a4925e79f9a3079490970": {"filename": "jquery.1.2.4.min.jquery-1.2.4.min.js", "result": 6},
+"f577a5e1173b2f0bb65a593dc2560ded3b0add8f": {"filename": "jquery.1.8.2.jquery-1.8.2.js", "result": 6},
+"f665459959c5167c0905974a62ffe923f2c19813": {"filename": "underscore.1.1.5.underscore-min.js", "result": 6},
+"e9b5baec45507c35477aac5d19afbca8cad92426": {"filename": "jqueryui.1.8.21.jquery-ui.min.js", "result": 6},
+"19214655c4152b79f204e222a481d1e18da84972": {"filename": "dojo.1.3.1.dojo.xd.js.uncompressed.js", "result": 6},
+"cdacc2b0045fa1b920b64664b88b155d0c0df169": {"filename": "underscore.1.0.2.underscore.js", "result": 6},
+"e1ae2c72f8c5e1b6c423c015349a476f8a908b22": {"filename": "yui.3.4.1.yui-base-min.js", "result": 6},
+"493afa22594fdff6e6fc4f21f99c626533c35b06": {"filename": "mootools.1.3.0.mootools-yui-compressed.js", "result": 6},
+"ddb4126bf4713cb4e0f2310401e58cb9e3f98997": {"filename": "jquery.1.0.3.pack.jquery-1.0.3.pack.js", "result": 6},
+"da0482df1221d0ee24a14904b4ef2c764368ae6f": {"filename": "dojo.1.7.3.dojo.xd.js.uncompressed.js", "result": 6},
+"2ef4341a4ca0b9a0fc1aea422d85b5d9771fde87": {"filename": "dojo.1.4.0.dojo.xd.js.uncompressed.js", "result": 6},
+"37c2a4215a6a5c94824b34161f37f10f0c1a3c7d": {"filename": "mootools.1.4.0.mootools.js", "result": 6},
+"ef373e9177d92e2ea5ca09173803540351a4a564": {"filename": "dojo.1.7.1.dojo.xd.js.uncompressed.js", "result": 6},
+"710c3a99f0bd456c2fd6dcbcbd1e500e0646ec19": {"filename": "underscore.1.0.1.underscore-min.js", "result": 6},
+"5cc87d3fcd5cb3c5913c08bad17ff80f4d0d7f46": {"filename": "yui.3.4.0.yui-base.js", "result": 6},
+"86752ba2e4f3855a8a5e45d5f07567ea70a9cc98": {"filename": "underscore.1.3.0.underscore-min.js", "result": 6},
+"1e8f9e1614db771782bc9e871fb712b06610b9f4": {"filename": "mootools.1.4.2.mootools-yui-compressed.js", "result": 6},
+"d2fc56e1b9f2014fb7710d186a355a57e3acd283": {"filename": "dojo.1.2.3.dojo.xd.js", "result": 6},
+"015cf89260f3e8f0b86f5a17558125c933692989": {"filename": "prototype.1.6.0.2.prototype.js", "result": 6},
+"c2e5f0d3b036f582908142d3bd13db67a618caa4": {"filename": "dojo.1.7.1.dojo.xd.js", "result": 6},
+"990dbb08231ef9c9c59653051f5ac7c1e2185d46": {"filename": "jqueryui.1.8.15.jquery-ui.js", "result": 6},
+"90fab357529f510e5134ad0dcdad3f654894d4fc": {"filename": "jqueryui.1.7.3.jquery-ui.js", "result": 6},
+"74974f9dc0810ea359367589cb273dd5174d80df": {"filename": "scriptaculous.1.8.1.scriptaculous.js", "result": 6},
+"d19d40a20252730e9fd9af1c7867c0f5417ebe32": {"filename": "ext-core.3.0.0.ext-core.js", "result": 6},
+"8b95d59f6b28b072ceb4228a6db107b934500a02": {"filename": "dojo.1.4.0.dojo.xd.js", "result": 6},
+"0c80055d513ce3103bb70ca956be005f63e32922": {"filename": "jquery.1.1.4.pack.jquery-1.1.4.pack.js", "result": 6},
+"e70997dd3dbadadebf375908515617059d0c597e": {"filename": "yui.3.4.1.yui-base.js", "result": 6},
+"2a3fa481079f9e02043810cbeee6b5481abf51c0": {"filename": "jqueryui.1.8.20.jquery-ui.js", "result": 6},
+"c71ddb1b3843c24e909a31595b7e873d7e6da45d": {"filename": "jqueryui.1.8.9.jquery-ui.js", "result": 6},
+"bff995d3a845903f281b0b51fea421059459a808": {"filename": "jquery.1.4.1.min.jquery-1.4.1.min.js", "result": 6},
+"8ab3016267333541f4c2b10aa49efd9950e4c398": {"filename": "dojo.uncompressed.1.1.2.js", "result": 6},
+"b9c72aa78de3c124248f30234c64bf6f3b1a7cb5": {"filename": "jquery.1.1.3.pack.jquery-1.1.3.pack.js", "result": 6},
+"9bdf0dfad487422fd36693d4119b59175f0112ee": {"filename": "yui.2.8.1.yuiloader.js", "result": 6},
+"c0c37b7d3119f29d3759fdaf7eb8bc4670ea9e7f": {"filename": "mootools.1.1.1.mootools.js", "result": 6},
+"b8dcaa1c866905c0bdb0b70c8e564ff1c3fe27ad": {"filename": "jquery.1.5.2.min.jquery-1.5.2.min.js", "result": 6},
+"5c83aac1a3409dc1ec3a228e4c765292eb4434d4": {"filename": "ext-debug.3.0.0.ext-core-debug.js", "result": 6},
+"28780fdb8fc54bf7d80b1f223abca4f77cd89e85": {"filename": "swfobject.2.1.swfobject_src.js", "result": 6},
+"e956e4de8f223992e2d1362d78c5b5bb33e27497": {"filename": "mootools.1.2.4.mootools-yui-compressed.js", "result": 6},
+"63f6a94752e5fde78627529763e67ecd4ef78f12": {"filename": "underscore.1.2.4.underscore-min.js", "result": 6},
+"b47730ffaec4272a8a01756af2ef13ecea1c4e92": {"filename": "jquery.1.7.1.jquery-1.7.1.js", "result": 6},
+"52ebc252c54e6cdaa9e349e1fea37a2950f6af96": {"filename": "yui.2.7.0.yuiloader-min.js", "result": 6},
+"bb2be1fe71a420e39ee514fd82474e6fbfea7e27": {"filename": "yui.3.3.0.yui-base-min.js", "result": 6},
+"be2c78821546f6d3a96827715d7358487d2c58ef": {"filename": "dojo.1.7.2.dojo.xd.js.uncompressed.js", "result": 6},
+"97e561dfeb842c21b35e6f9963914316221cca1d": {"filename": "dojo.1.3.3.js", "result": 6},
+"4400cb5fdfecf571231ad886ae69b427e31a0b5c": {"filename": "dojo.1.7.0.dojo.xd.js", "result": 6},
+"5f970c3c8ca26a94c14a1ae1e7321621cf4eae0c": {"filename": "mootools.1.1.2.mootools-yui-compressed.js", "result": 6},
+"c753cf372377ef0b5a18204cd86df8d4792fa8f5": {"filename": "dojo.1.4.1.dojo.xd.js", "result": 6},
+"f978dcb9ea6ecfbc7f8a2f9948bacd679c0cd1b4": {"filename": "jqueryui.1.7.2.jquery-ui.min.js", "result": 6},
+"5b59bc1a7087c3a83abd5b9ff559a88428ceab0a": {"filename": "jqueryui.1.5.2.jquery-ui.min.js", "result": 6},