[Pkg-mozext-commits] [video-without-flash] 02/02: Imported Upstream version 1.5.0

Dmitry Smirnov onlyjob at moszumanska.debian.org
Tue Nov 18 03:07:11 UTC 2014


This is an automated email from the git hooks/post-receive script.

onlyjob pushed a commit to branch upstream
in repository video-without-flash.

commit b362922 (upstream)
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date:   Tue Nov 18 02:21:51 2014

    Imported Upstream version 1.5.0
---
 LICENSE                                | 674 +++++++++++++++++++++++++++++++++
 Makefile                               | 159 ++++++++
 README.md                              | 137 +++++++
 chrome.manifest                        |   7 +
 chrome/Makefile.in                     |  10 +
 chrome/content/browserOverlay.js       | 164 ++++++++
 chrome/content/browserOverlay.xul      |  36 ++
 chrome/content/list_modules.js         |  55 +++
 chrome/content/onload.js               |  18 +
 chrome/content/player.css              |  69 ++++
 chrome/content/player.js               | 191 ++++++++++
 chrome/content/prefs.xul               |  61 +++
 chrome/content/utils.js                |  60 +++
 chrome/content/youtube_utils.js        |  43 +++
 chrome/locale/en-US/browserOverlay.dtd |   3 +
 chrome/skin/toolbar-button.css         |  14 +
 chrome/skin/video-icon.png             | Bin 0 -> 4316 bytes
 chrome/skin/video-icon_14.png          | Bin 0 -> 1587 bytes
 chrome/skin/video-icon_24.png          | Bin 0 -> 2318 bytes
 defaults/preferences/vwof.js           |   4 +
 install.rdf                            |  25 ++
 modules/FC2.jsm                        |  70 ++++
 modules/HTML5.jsm                      |  36 ++
 modules/Makefile.in                    |   2 +
 modules/blip.jsm                       | 111 ++++++
 modules/dailymotion.jsm                |  62 +++
 modules/niconico.jsm                   |  53 +++
 modules/youtube.jsm                    | 127 +++++++
 28 files changed, 2191 insertions(+)

diff --git a/LICENSE b/LICENSE
new file mode 100755
index 0000000..ef7e7ef
--- /dev/null
+++ b/LICENSE
@@ -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:
+
+    {project}  Copyright (C) {year}  {fullname}
+    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/Makefile b/Makefile
new file mode 100755
index 0000000..583beee
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,159 @@
+# The name of the extension.
+extension_name := vwof
+
+# The UUID of the extension.
+extension_uuid := vwof at drev.com
+
+brand = firefox
+
+# The name of the profile dir where the extension can be installed.
+profile_dir := "devel"
+
+# The zip application to be used.
+ZIP := zip
+
+# The target location of the build and build files.
+bin_dir := ../bin
+
+# The target XPI file.
+xpi_file := $(bin_dir)/$(extension_name).xpi
+
+# The type of operating system this make command is running on.
+os_type := $(patsubst darwin%,darwin,$(shell echo $(OSTYPE)))
+os_type = linux-gnu
+
+# The location of the extension profile.
+ifeq ($(os_type), darwin)
+  profile_location := \
+    ~/Library/Application\ Support/Firefox/Profiles/$(profile_dir)/extensions/$(extension_uuid)
+else
+  ifeq ($(os_type), linux-gnu)
+    profile_location := \
+      ~/.mozilla/$(brand)/$(profile_dir)/extensions/$(extension_uuid)
+  else
+    profile_location := \
+      "$(subst \,\\,$(APPDATA))\\Mozilla\\Firefox\\Profiles\\$(profile_dir)\\extensions\\$(extension_uuid)"
+  endif
+endif
+
+# The temporary location where the extension tree will be copied and built.
+build_dir := $(bin_dir)/build
+
+# The install.rdf file.
+install_rdf := install.rdf
+
+# The chrome.manifest file.
+chrome_manifest := chrome.manifest
+
+# The modules (JSM) dir.
+modules_dir := modules
+
+# The defaults dir.
+defaults_dir := defaults
+
+# The preferences dir.
+preferences_dir := $(defaults_dir)/preferences
+
+content_dir := content
+
+# This builds the extension XPI file.
+.PHONY: all
+all: $(xpi_file)
+	@echo
+	@echo "Build finished successfully."
+	@echo
+
+# This cleans all temporary files and directories created by 'make'.
+.PHONY: clean
+clean:
+	@rm -rf $(build_dir)
+	@rm -f $(xpi_file)
+	@echo "Cleanup is done."
+
+
+# The includes are added after the targets because we want this file to contain
+# the default (first) target.
+include chrome/Makefile.in
+include modules/Makefile.in
+
+# The sources for the XPI file. Uses variables defined in the included
+# Makefiles.
+xpi_built := $(build_dir)/$(install_rdf) \
+             $(build_dir)/$(chrome_manifest) \
+	     $(addprefix $(build_dir)/,$(sources)) \
+             $(addprefix $(build_dir)/,$(modules_sources)) \
+             $(build_dir)/$(preferences_dir)/$(extension_name).js
+
+xpi_built_no_dir := $(subst $(build_dir)/,,$(xpi_built))
+
+# This builds everything except for the actual XPI, and then it copies it to the
+# specified profile directory, allowing a quick update that requires no install.
+.PHONY: install
+install: $(build_dir) $(xpi_built)
+	@echo "Installing in profile folder: $(profile_location)"
+	@if [ ! -x $(profile_location) ]; \
+  then \
+    echo "Creating profile $(profile_location)"; \
+    mkdir  $(profile_location); \
+  fi
+	@cp -Rf  $(build_dir)/* $(profile_location)
+
+$(xpi_file): $(build_dir) $(xpi_built)
+	@echo "Creating XPI file."
+	@cd $(build_dir); $(ZIP) ../$(xpi_file) $(xpi_built_no_dir)
+	@echo "Creating XPI file. Done!"
+
+$(build_dir)/$(modules_dir)/%: $(modules_dir)/% $(build_dir)/$(modules_dir)
+	@echo adding $< to $@
+	@cp -f $< $@
+
+$(build_dir)/$(preferences_dir)/%: \
+  $(preferences_dir)/% $(build_dir)/$(preferences_dir)
+	@echo adding $< to $@
+	@cp -f $< $@
+
+$(build_dir)/$(defaults_dir)/%: $(defaults_dir)/% $(build_dir)/$(defaults_dir)
+	@echo adding $< to $@
+	@cp -f $< $@
+
+$(build_dir)/$(preferences_dir): $(build_dir)/$(defaults_dir)
+	@if [ ! -x $(build_dir)/$(preferences_dir) ]; \
+  then \
+    mkdir $(build_dir)/$(preferences_dir); \
+  fi
+
+$(build_dir)/$(defaults_dir):
+	@if [ ! -x $(build_dir)/$(defaults_dir) ]; \
+  then \
+    mkdir $(build_dir)/$(defaults_dir); \
+  fi
+
+#This is the default target
+$(build_dir)/%: %
+	@echo copying $< to $(build_dir)
+	@cp --parents  $< $(build_dir)
+
+$(build_dir):
+	@if [ ! -x $(build_dir) ]; \
+  then \
+    mkdir $(build_dir); \
+  fi
+
+$(build_dir)/$(modules_dir):
+	@if [ ! -x $(build_dir)/$(modules_dir) ]; \
+  then \
+    mkdir $(build_dir)/$(modules_dir); \
+  fi
+
+$(build_dir)/$(source_root)/$(content_dir):
+	@if [ ! -x $(build_dir)/$(source_root)/$(content_dir) ]; \
+  then \
+    mkdir $(build_dir)/$(content_dir); \
+  fi
+
+run:
+	$(brand) -purgecaches -P & 
+
+rerun:
+	killall $(brand) ; $(brand) -purgecaches -P & 
+
diff --git a/README.md b/README.md
new file mode 100755
index 0000000..8fd8cf5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,137 @@
+video-without-flash
+===================
+
+Firefox extension for watching videos without the flash plugin
+
+
+<i>Fetch video source of flash based media and play the video directly with Firefox, without the use of the flash plug-in. </i>
+
+<b> Supported sites/embed video player </b>
+<ul>
+<li>Youtube</li>
+<li>Blip</li>
+<li>HTML5</li>
+<li>Dailymotion</li>
+<li>NicoVideo</li>
+<li>FC2</li>
+</ul>
+
+Due to some minor variations of providing the video by a same media provider (different version of there player, use of the embed tag) a few videos may not be detected. 
+
+<b> Usage </b>
+By default the video are detected when a page load, you can disable this behavior in the preference pane and manually try to detect video by pressing 
+ ALT-W or Right Click and "Watch video without flash". 
+
+<b>Why you  may want to use this extension</b>
+<ul>
+<li>You experienced some lag or bad CPU performance using flash </li>
+<li>You only use flash to watch videos, and do not want to install a non-free packages on your linux station (this extension is released under the GPL)</li>
+</ul>
+
+<b> Pro tips </b>
+*To read MP4 videos you must install a media plugin like vlc-web-plugin or gecko-mplayer. Under Windows the vlc web plugin can be install when running the vlc install exe. 
+
+* The video can be save with a "right click / save as" on the "open in a new tab"  link.
+
+* Numerous options in the preference pane : select preferred format / quality when available, disable modules. 
+
+<b> Known bugs </b> 
+(unfortunately these are upstream bugs, nothing I can do about it)
+
+* YouTube : The video area is not reloading when clicking on a suggested video link. After clicking on such a link, please use the ALT-w command to refresh the player area
+
+* VLC plugin : The video crashes when a video is paused when played with the vlc web plugin.
+
+<b> How does it works </b> 
+This extension fetch the direct link to videos using regular expression, XPath, and DOM. When available,  a picture and a select control are displayed to read the video with firefox, using the firefox internal HTML5 compliant media player or a plugin like vlc or mplayer if the user had installed it. 
+
+Each media provider is handled by a "parser". Javascript modules (.jsm) that are loaded at startup. The extension can fairly easy be extended due to it modular approache, as new media provider can be added by implementing a new jsm file. 
+
+<b>Why a HTML5 parser ? </b>
+For licensing reasons firefox do not support at the moment the H264 codec, although  it may change in the future. If a site uses HTML5 to display a video, but the video itself is encoded with H264 or a variant you normally wont be able to play it. By using the HTML5 parser, you can read the video if a media player plugin is installed as stated previously.
+
+
+= Technical documentation for developers =
+
+== How to write a new parser == 
+
+<i>Do not esitate to fork and add your own parser</i>
+
+* Step 1 : Add the name of your parser without the .jsm extension in the browser variable "extensions.vwof.modules" you can do it with about:config for test purposes or do it permanently in src/defaults/preferenes/vwof.js
+The boolean value (parsername:1) indicate the activation or not by default of the plugin (it can be set mannually by the user in the preference pane). 
+
+
+* Step 2 : Create a jsm file in the modules directory
+
+The parser must respect the following API  : 
+
+```javascript
+var parser = {
+    BASE_URI: '',
+    parse_embed: function(cw) {
+        var video_info = [];
+	return video_info;
+    },
+
+    parse_site: function(cw) {
+	var video_info = [];
+	var player = cw.document.getElementById('');
+	if(!player)return;
+
+	return video_info;
+    }
+};
+```
+
+=== video_info variable ===
+
+video player is an array of an hash
+
+each video is an entry in the array and the hash contains video information
+
+If the videos array contains more than one element a combo box (select tag)
+will be added in the player displaying the format and quality
+
+```javascript
+video_info = 
+[
+{
+'player':,              //DOM where the video player will be embed, replacing all child nodes, if undefined, the video open in a new tab
+
+'video_img':,           //string link to the picture displayed as a preview, if undefined the background is black
+
+'videos': []            //array of video informations, see below
+}
+];
+
+videos = 
+[
+{
+'quality':,              //quality of the video (low, medium, hd720, hd1080)
+
+'format':,               //format of the video (webm, mp4, flv, ...)
+
+'url':                   //direct link to the video, this is the only mandatory variable
+}
+];
+
+
+== How to build ==
+
+This plugin comes with a home made makefile based on mozilla school xul example.
+
+Targets are : 
+
+* make
+  Create an .xpi in the ../bin/build directory (manually create ../bin/build if necessary)
+
+* make install
+  install the plugin in the profil directory. By default the profil name is "devel"
+  you can change this behaviour by passing the profile_dir variable (example : make install profile_dir=default)
+
+* you need to restart firefox to apply the changes, it can be done with the make target
+  make rerun
+
+  which will run the following command : killall firefox ; firefox -purgecaches -P &
+
+
diff --git a/chrome.manifest b/chrome.manifest
new file mode 100755
index 0000000..5c6f57d
--- /dev/null
+++ b/chrome.manifest
@@ -0,0 +1,7 @@
+content   vwof              chrome/content/  contentaccessible=yes
+skin      vwof  classic/1.0 chrome/skin/
+locale    vwof  en-US       chrome/locale/en-US/
+resource  vwof              modules/
+
+overlay chrome://browser/content/browser.xul  chrome://vwof/content/browserOverlay.xul
+style chrome://global/content/customizeToolbar.xul chrome://vwof/skin/toolbar-button.css
\ No newline at end of file
diff --git a/chrome/Makefile.in b/chrome/Makefile.in
new file mode 100755
index 0000000..328c40b
--- /dev/null
+++ b/chrome/Makefile.in
@@ -0,0 +1,10 @@
+source_root := chrome
+sources := $(wildcard $(source_root)/content/*.js) \
+               $(wildcard $(source_root)/content/*.xul) \
+               $(wildcard $(source_root)/content/*.xml) \
+               $(wildcard $(source_root)/content/*.css) \
+               $(wildcard $(source_root)/skin/*.css) \
+               $(wildcard $(source_root)/skin/*.png) \
+               $(wildcard $(source_root)/skin/*.svg) \
+               $(wildcard $(source_root)/locale/*/*.dtd) \
+               $(wildcard $(source_root)/locale/*/*.properties)
diff --git a/chrome/content/browserOverlay.js b/chrome/content/browserOverlay.js
new file mode 100755
index 0000000..904bda1
--- /dev/null
+++ b/chrome/content/browserOverlay.js
@@ -0,0 +1,164 @@
+if("undefined" == typeof(vwofChrome)){
+    var vwofChrome = {};
+}
+
+vwofChrome.BrowserOverlay = {
+    parser_name:["blip", "dailymotion", "FC2", "HTML5", "niconico", "youtube"],
+    parsers:{},   //hash of the parsers (loaded from jsm modules)
+
+    /**
+       function called at startup
+    */
+    startup:function() {
+	this.load_modules();
+	this.set_parsers_activation();
+    },
+    set_parsers_activation:function(){
+	//check in the preferences : activated a parser on page load or not
+	Components.utils.import("resource://gre/modules/Services.jsm");
+	var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
+	    .getService(Components.interfaces.nsIPrefBranch);
+
+	var modules_list = prefManager.getCharPref("extensions.vwof.modules");
+	var modules = JSON.parse(modules_list);  //parser / value from the preferences
+
+	for(var key_parser in this.parsers){
+ 	    var parser = this.parsers[key_parser].parser;
+
+	    //if a pref is defined for this parser
+	    if(modules[key_parser])
+		parser['activated'] = modules[key_parser]?true:false;
+	    else 
+		parser['activated'] = false;
+	}
+    },
+    /**
+       Load modules listed in the extensions.vwof.modules pref variable to this.parsers hash
+    */
+    load_modules:function(){
+	try{
+	    Components.utils.import("resource://gre/modules/Services.jsm");
+	    var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+	    var modules_list = prefManager.getCharPref("extensions.vwof.modules");
+	    var modules = JSON.parse(modules_list);
+
+	    for(var i=0;i<this.parser_name.length;i++){
+		let key_parser = this.parser_name[i];
+		let context = {};
+		let res = 'resource://vwof/'+key_parser+'.jsm';
+		Services.scriptloader.loadSubScript(res, context, "UTF-8");
+		this.parsers[key_parser] = context;
+	    }
+	}
+	catch(err){
+	    alert(err);
+	};
+	
+    },    
+    /**
+       call every parse function from loaded parsers
+    */
+    getVideoInfo:function (cw) {
+	var video_info = [];	// array of video_data
+	var has_parsed_site = false;
+	
+	for(var key_parser in this.parsers){
+	    
+  	    try{
+		var parser = this.parsers[key_parser].parser;
+		var video_data = [];  //array of video links with quality
+
+		if(parser['activated'] != true)continue;
+
+		//if the parser has a URI and it's the current location
+		if(parser.BASE_URI && cw.location.hostname == parser.BASE_URI){
+		    video_data = parser.parse_site(cw);
+		    has_parsed_site = true;
+		}
+		else if(parser.parse_embed){
+		    video_data = parser.parse_embed(cw);
+		}
+
+		//if there is at least a video url retreived from the parser
+		if(video_data.length >= 1){		    
+		    //set the source (name of the parser)
+		    for(var i=0;i < video_data.length;i++){
+			video_data[i]['source'] = key_parser;
+		    }
+		    
+		    //concat the chunks of video(s) from this parser
+		    video_info = video_info.concat(video_data);    
+		}
+	    }
+	    catch(err){
+		console.error("vwof plugin, exception in parser "+key_parser+": "+err);
+	    };
+
+	    //video web sites never have several videos on a same page, 
+	    //stop the search if a hit was found
+	    if(has_parsed_site){break;}
+	}
+
+	return video_info;
+    },
+
+    /**
+       get the video source and add a link in the document 
+    */
+    detectVideo:function(cw) {
+
+	//check if the content window is defined
+	if (!cw ||
+	    !cw.document
+	   ){
+	    return;
+	}
+
+	var video_info = this.getVideoInfo(cw);
+
+	for (var i = 0; i < video_info.length; i++) {
+	    if(video_info[i]['player']){
+    		var replace_location = video_info[i]['player'];
+		var player = vwofPlayer.create_video_selector(video_info[i], cw);
+		var replace_parent = replace_location.parentNode;
+		replace_parent.replaceChild(player, replace_location);
+	    }
+	}
+    }
+};
+
+
+/**
+   Listeners
+
+   initialize the application on startup
+*/
+window.addEventListener("load", function() { vwofChrome.BrowserOverlay.startup(); }, false);
+
+/**
+   Listener that observe the prefs variables
+
+   If the module list changes (new module, module deactivated/activated), the parser list is reloaded
+*/
+var myPrefObserver = {
+    register: function() {
+	// load preference service
+	var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+	    .getService(Components.interfaces.nsIPrefService);
+	this.branch = prefService.getBranch("extensions.vwof.");
+	this.branch.addObserver("", this, false);
+    },
+
+    unregister: function() {
+	this.branch.removeObserver("", this);
+    },
+
+    observe: function(aSubject, aTopic, aData) {
+	switch (aData) {
+	case "modules":
+	    vwofChrome.BrowserOverlay.set_parsers_activation();
+	    break;
+	}
+    }
+}
+myPrefObserver.register();
diff --git a/chrome/content/browserOverlay.xul b/chrome/content/browserOverlay.xul
new file mode 100755
index 0000000..cbaeea7
--- /dev/null
+++ b/chrome/content/browserOverlay.xul
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://vwof/skin/toolbar-button.css" type="text/css"?>
+
+<overlay id="vwof-browser-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <script type="application/x-javascript" src="chrome://vwof/content/browserOverlay.js" />
+  <script type="application/x-javascript" src="chrome://vwof/content/utils.js" />  
+  <script type="application/x-javascript" src="chrome://vwof/content/youtube_utils.js" />
+  <script type="application/x-javascript" src="chrome://vwof/content/player.js" />
+  <script type="application/x-javascript" src="chrome://vwof/content/onload.js" />
+
+  <script type="application/x-javascript">
+    function oncommand_detectvideo(){
+      var cw = getBrowser().contentWindow;
+      vwofChrome.BrowserOverlay.detectVideo(cw);
+    }
+
+    function vwof_toggle(event){
+      var c = event.target.hasAttribute('checked')?1:0;
+      var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+      prefManager.setBoolPref("extensions.vwof.activate_onload", c);
+    }
+
+  </script>
+  
+  <keyset>
+    <key id="vwof-key-detect-video" modifiers="alt" key="w" oncommand="oncommand_detectvideo();"/>
+  </keyset>
+
+  <popup id="contentAreaContextMenu">
+    <menuitem id="vwof-detect-video" key="vwof-key-detect-video" label="Watch video without flash" oncommand="oncommand_detectvideo();"/>
+  </popup>
+
+  <toolbarpalette id="BrowserToolbarPalette">
+    <toolbarbutton id="vwof-button" class="vwof-button" tooltiptext="Video WithOut Flash" oncommand="vwof_toggle(event);" type="checkbox"></toolbarbutton>
+  </toolbarpalette>
+</overlay>
diff --git a/chrome/content/list_modules.js b/chrome/content/list_modules.js
new file mode 100755
index 0000000..89c55aa
--- /dev/null
+++ b/chrome/content/list_modules.js
@@ -0,0 +1,55 @@
+var checkbox_wide = document.getElementById("vwof_yt_wide");
+var wide = vwofChrome.youtubeUtils.yt_is_wide();
+checkbox_wide.setAttribute("checked", wide);
+
+var prefPane = document.getElementById('vwof_pref_modules');
+var s_modules = document.getElementById('extensions.vwof.modules').value;
+modules = JSON.parse(s_modules);
+
+var element_label = document.createElement('label');
+element_label.setAttribute('value', 'Module activation');
+prefPane.appendChild(element_label);
+
+let element_grid = document.createElement('grid');
+var element_columns = document.createElement('columns');
+var element_column_site = document.createElement('column');
+var element_column_embed = document.createElement('column');
+var element_rows = document.createElement('rows');
+
+element_columns.appendChild(element_column_site);
+element_columns.appendChild(element_column_embed);
+element_grid.appendChild(element_columns);
+element_grid.appendChild(element_rows);
+
+for(var i=0;i<vwofChrome.BrowserOverlay.parser_name.length;i++){
+    var element_row = document.createElement('row');
+
+    let key_module = vwofChrome.BrowserOverlay.parser_name[i];
+
+    var element_label_key = document.createElement('label');
+    element_label_key.setAttribute('value', key_module);
+    element_row.appendChild(element_label_key);
+
+    var element_checkbox_site = document.createElement('checkbox');
+    element_checkbox_site.setAttribute('checked', modules[key_module]?'true':'false');
+    element_checkbox_site.setAttribute('class', key_module);
+    element_checkbox_site.addEventListener('command', update_module);
+    element_row.appendChild(element_checkbox_site);
+
+    element_rows.appendChild(element_row);
+}
+
+prefPane.appendChild(element_grid);
+
+function update_module(event){
+    var l = event.target.getAttribute('class');
+    var c = event.target.hasAttribute('checked')?1:0;
+
+    modules[l] = c;
+    var s_modules = JSON.stringify(modules);
+
+    var prefManager = Components.classes["@mozilla.org/preferences-service;1"].
+	getService(Components.interfaces.nsIPrefBranch);
+
+    prefManager.setCharPref("extensions.vwof.modules", s_modules);
+}
diff --git a/chrome/content/onload.js b/chrome/content/onload.js
new file mode 100755
index 0000000..8d4672e
--- /dev/null
+++ b/chrome/content/onload.js
@@ -0,0 +1,18 @@
+function pageLoad(event) {
+    var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+    var activate_onload = prefManager.getBoolPref("extensions.vwof.activate_onload");
+    
+    if (activate_onload
+	&& event.originalTarget instanceof HTMLDocument
+       ){
+	var cw = event.originalTarget.defaultView;
+	vwofChrome.BrowserOverlay.detectVideo(cw);
+    }
+}
+
+window.addEventListener("DOMContentLoaded", function () {
+    gBrowser.addEventListener("load", pageLoad, true);
+}, false);
+
+// When no longer needed
+gBrowser.removeEventListener("load", pageLoad, true);
diff --git a/chrome/content/player.css b/chrome/content/player.css
new file mode 100755
index 0000000..20815d7
--- /dev/null
+++ b/chrome/content/player.css
@@ -0,0 +1,69 @@
+.vwof_player {
+    position:relative;
+    width: 100%;
+    height: 100%;
+    border: 1px #000;
+    background-color: #000;
+    background-size: 100%;
+    background-repeat: no-repeat;
+    background-size: contain;
+    background-position: center top;    
+    display:block;
+    cursor:pointer;
+    z-index:1;
+    text-align:left;
+    vertical-align:top;
+    opacity:0.8;
+    box-shadow: 0 5px 10px #222;
+}
+
+.vwof_player:hover{
+    opacity:1.0;   
+}
+
+.vwof_video_info, .vwof_player span, .vwof_player a{
+    background-color:rgba(2,2,2,0.8);
+    text-shadow: 1em 1em 5em black;
+    box-shadow: 0 5px 10px #222;
+}
+
+.vwof_player span, .vwof_player a{
+    position:absolute;
+    font-family:white,bold;
+    font:14px bold;
+    color:white;
+    font-weight: bold;
+    margin-top: 8px;
+    margin-right:5px;  
+
+}
+
+.vwof_player a{
+    text-decoration: underline;
+    top:5px;
+    right:5px;
+}
+
+.vwof_player a:hover {
+    color:#88AAFF;
+    transition:.5s;
+}
+
+.vwof_video_info{
+    vertical-align:top;
+    margin-top:8px;
+    margin-left:2px;
+    padding: 5px;
+    font-size: 16px;
+    line-height: 1;
+    border: 0;
+    border-radius: 0.2;
+    color: #FFF;  
+}
+
+.vwof_frame{
+    height:100%;
+    width:100%;
+    border:none;
+    z-index:1;
+}
diff --git a/chrome/content/player.js b/chrome/content/player.js
new file mode 100755
index 0000000..565be9a
--- /dev/null
+++ b/chrome/content/player.js
@@ -0,0 +1,191 @@
+if ("undefined" == typeof(vwofPlayer)) {
+    var vwofPlayer = {};
+};
+
+vwofPlayer = {
+    /**
+       add the player stylecheet link to the head of the document
+    */
+    add_style:function(doc, style_id){
+	var style = doc.createElement('link');
+	style.setAttribute('type', 'text/css');
+	style.setAttribute('rel', 'stylesheet');
+	style.setAttribute('href', 'chrome://vwof/content/player.css');
+	style.setAttribute('id', style_id);
+	doc.head.appendChild(style);
+    },
+    /**
+       callback function called when the video selector is clicked
+       replace the video selector with a frame pointing to the selected video
+       firefox will set the content of the frame with it's HTML5 video player
+    */
+    video_selector_click:function(event){
+	const doc = event.originalTarget.ownerDocument;
+        var player_style_size = 'min-width:'+this.clientWidth+'px;min-height:'+this.clientHeight+'px;';
+
+	var i = document.createElement('iframe');
+	i.setAttribute('id', 'vwof_frame_'+this.id);
+	i.setAttribute('class', 'vwof_frame');
+	i.setAttribute('style', player_style_size);
+
+	var e = doc.getElementById('vwof_select_video_'+this.id);
+	if(e){
+	    i.setAttribute('src', e.options[e.selectedIndex].value);
+	}
+	else{
+	    var l=doc.getElementById('vwof_link_new_tab_'+this.id);
+	    i.setAttribute('src', l.href);
+	}
+
+	//replace the video selector with the frame
+	var video_selector_parent = this.parentNode;
+	video_selector_parent.replaceChild(i, this);
+    },
+    /**
+       Create the html code to embed the video selector in the document
+    */
+    create_video_selector:function(video_info, cw){
+	//set the player size depending on the location where embed it
+	var cstyle = cw.getComputedStyle(video_info['player']);
+	var doc = cw.document;
+
+	var h = cstyle.getPropertyValue("height");
+	var w = cstyle.getPropertyValue("width");
+	if(w == "0px")w="90vw";
+	if(h == "0px")h="90vh";
+
+        var player_style_size = 'min-width:'+w+';min-height:'+h+';';
+	var player_style_image = '';
+	video_selector_id = 'vwof_' + Math.floor((Math.random() * 99));
+
+	//add the player css if necessary
+	const style_id = 'vowf_player_style';
+	if(!doc.getElementById(style_id)){
+	    this.add_style(doc, style_id);
+	}
+	
+	//Create the 'video selector' (a div with detected videos links)
+	var video_selector = doc.createElement('div');
+	video_selector.setAttribute('class', 'vwof_player');
+	
+	//identify the div player if the original element did not have an id
+	if(!video_selector.id)video_selector.setAttribute('id', video_selector_id);
+	
+	//thumbnail
+	if(img = video_info['video_img']){
+	    player_style_image = 'background-image:url('+img+');';
+	}
+
+	//vwof icon
+	var node_image = doc.createElement('img');
+	node_image.setAttribute('src', 'chrome://vwof/skin/video-icon.png');
+	video_selector.appendChild(node_image);
+
+	//select video format and quality
+	var prefered_index = 0;
+	
+	//if the number of video found for this video selector is only one, do
+	//not display the selectbox and append a simple text
+	if(video_info.videos.length == 1){
+	    var node_span = doc.createElement('span');
+	    node_span.setAttribute('class', 'vwof_video_info');
+	    var format = video_info.videos[0].format ? video_info.videos[0].format : '';
+	    var quality = video_info.videos[0].quality ? video_info.videos[0].quality : '';
+	    var node_info = doc.createTextNode(format + ' ' + quality);
+	    
+	    node_span.appendChild(node_info);
+	    video_selector.appendChild(node_span);
+	}
+	else{
+	    prefered_index = this.find_prefered_video(video_info.videos);
+
+	    var node_select = doc.createElement('select');
+	    node_select.setAttribute('id', 'vwof_select_video_'+ video_selector_id);
+	    node_select.setAttribute('class', 'vwof_video_info');
+	    node_select.addEventListener('click', function(event){
+		event.stopPropagation();
+	    });
+
+	    //update the open in a new tab link when the selectbox index changes
+	    node_select.addEventListener('change', function(event){
+		var doc = this.ownerDocument;
+		var link = doc.getElementById('vwof_link_new_tab_'+video_selector_id);
+		link.setAttribute('href', this.options[this.selectedIndex].value);
+	    });
+
+	    for(var i=0;i<video_info.videos.length;i++){
+		var node_option = doc.createElement('option');
+		node_option.setAttribute('value', video_info.videos[i].url);
+		
+		var format = video_info.videos[i].format ? video_info.videos[i].format : '';
+		var quality = video_info.videos[i].quality ? video_info.videos[i].quality : '';
+		var node_option_content = doc.createTextNode(format + ' ' + quality);
+
+		if(i == prefered_index){
+		    node_option.setAttribute('selected', 'true');
+		}
+		
+		node_option.appendChild(node_option_content);
+		node_select.appendChild(node_option);
+		video_selector.appendChild(node_select);
+	    }
+	}
+
+	video_selector.addEventListener('click', this.video_selector_click);
+	
+	//open in a new tab link
+	var node_link_new_tab = doc.createElement('a');
+	node_link_new_tab.setAttribute('id', 'vwof_link_new_tab_'+video_selector_id);
+	node_link_new_tab.addEventListener('click', function(event){
+	    event.stopPropagation();
+	});
+	node_link_new_tab.setAttribute('href', video_info.videos[prefered_index].url);
+	node_link_new_tab.setAttribute('target', '_blank');
+	var a_content_new_tab = doc.createTextNode('Open in a new tab');
+	node_link_new_tab.appendChild(a_content_new_tab);
+	video_selector.appendChild(node_link_new_tab);
+
+	//display media source
+	if(video_info['source']){
+	    var node_span = doc.createElement('span');
+	    var node_source = doc.createTextNode('Powered by ' + video_info['source']);
+	    node_span.setAttribute('style', 'bottom:1px;left:1px;');
+	    node_span.appendChild(node_source);
+	    video_selector.appendChild(node_span);
+	}
+
+	//apply style to the player
+	video_selector.setAttribute('style', player_style_image + player_style_size);
+	
+	return video_selector;
+    },
+
+    /**
+       returns the index of the video which the format and quality matches most the preference settings
+    */
+    find_prefered_video: function(videos){
+	var candidate = [];
+	var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+	var prefered_format = prefManager.getCharPref("extensions.vwof.prefered_format");
+	var prefered_quality = prefManager.getCharPref("extensions.vwof.prefered_quality");
+	var i;
+
+	//match quality
+	for(i=0;i<videos.length;i++){
+	    if(videos[i].quality && videos[i].quality == prefered_quality){
+		candidate.push(i);
+	    }
+	}
+
+	//match format over quality selected cantidates
+	for(i=0;i<candidate.length;i++){
+	    if(videos[candidate[i]].format && videos[candidate[i]].format.match(prefered_format)){
+		return candidate[i];
+	    }
+	}
+
+	//return the first candidat, or if no candidate the video in the middle of the list
+	var index = candidate.length > 0 ? candidate[0] : Math.floor(videos.length / 2);
+	return index;
+    }
+};
diff --git a/chrome/content/prefs.xul b/chrome/content/prefs.xul
new file mode 100755
index 0000000..ceca964
--- /dev/null
+++ b/chrome/content/prefs.xul
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<prefwindow id="vwofPrefWindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <prefpane id="vwof_pref_general" label="General">
+  
+    <preferences>
+      <preference id="extensions.vwof.activate_onload" name="extensions.vwof.activate_onload" type="bool"/>
+      <preference id="full-screen-api.approval-required" name="full-screen-api.approval-required" type="bool"/>
+    </preferences>
+
+    <checkbox label="Activate on page load" preference="extensions.vwof.activate_onload"/>
+    <checkbox label="Enable missing flash plugin warnings" preference="plugins.notifyMissingFlash"/>
+    <checkbox label="Enable approval message when fullscreen" preference="full-screen-api.approval-required"/>
+    
+  </prefpane>
+
+  <prefpane id="vwof_pref_prefered_format" label="Prefered format">
+    <preferences>
+      <preference id="extensions.vwof.prefered_quality" name="extensions.vwof.prefered_quality" type="string" />
+      <preference id="extensions.vwof.prefered_format" name="extensions.vwof.prefered_format" type="string" />
+    </preferences>
+    
+    <label value="Prefered format" control="prefered_format" />
+    <menulist id="prefered_format" preference="extensions.vwof.prefered_format" preference-editable="true">
+      <menupopup>
+	<menuitem label="webm" value="webm"/>
+	<menuitem label="mp4" value="mp4"/>
+	<menuitem label="avi" value="avi"/>
+	<menuitem label="flv" value="flv"/>	
+      </menupopup>
+    </menulist>
+
+    <label value="Prefered quality" control="prefered_quality" />    
+    <menulist id="prefered_quality" preference="extensions.vwof.prefered_quality" preference-editable="true">
+      <menupopup>
+	<menuitem label="hd1080" value="hd1080"/>
+	<menuitem label="hd720" value="hd720"/>
+	<menuitem label="medium" value="medium"/>
+	<menuitem label="low" value="low"/>	
+      </menupopup>
+    </menulist>
+    
+  </prefpane>
+  
+  <prefpane id="vwof_pref_modules" label="modules">
+    <script type="application/x-javascript" src="chrome://vwof/content/browserOverlay.js" />
+    <script type="application/x-javascript" src="chrome://vwof/content/youtube_utils.js" />
+
+    <preferences>
+      <preference id="extensions.vwof.modules" name="extensions.vwof.modules" type="string"/>
+    </preferences>
+ 
+    <checkbox id="vwof_yt_wide" label="YouTube large player" oncommand="vwofChrome.youtubeUtils.toggle_yt_wide(event)"/>
+    <!--button label="Reload modules" oncommand="vwofChrome.BrowserOverlay.reload_modules()"/-->     
+  </prefpane>
+  
+  <script src="youtube_utils.js"/> 
+  <script src="list_modules.js"/>
+
+</prefwindow>
+
diff --git a/chrome/content/utils.js b/chrome/content/utils.js
new file mode 100755
index 0000000..5d1025e
--- /dev/null
+++ b/chrome/content/utils.js
@@ -0,0 +1,60 @@
+vwofChrome.utils = {
+    /**
+       needed by some parser to get the video source
+    */
+    get:function(uri){
+	const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1",
+						      "nsIXMLHttpRequest",
+						      "open");
+	
+	let xmlhttp = XMLHttpRequest("GET", uri, false);
+	xmlhttp.send();
+	return xmlhttp;
+    },
+    
+    /**
+       converts url vars into a js associative array
+    */
+    url_vars_to_array: function(url){
+	var arr_variable = url.split('&');
+	var arr_assoc = {};
+	var i;
+	
+	for(i=0;i<arr_variable.length;i++){
+	    var arr_tmp = arr_variable[i].split('=');
+	    arr_assoc[arr_tmp[0]] = arr_tmp[1];
+	}
+	return arr_assoc;
+    },
+
+    // return the two-digit hexadecimal code for a byte
+    toHexString:function(charCode)
+    {
+	return ("0" + charCode.toString(16)).slice(-2);
+    },
+
+    // do a md5 sum
+    md5:function(str){
+	var converter =
+	    Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
+	    createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+
+	// we use UTF-8 here, you can choose other encodings.
+	converter.charset = "UTF-8";
+	// result is an out parameter,
+	// result.value will contain the array length
+	var result = {};
+	// data is an array of bytes
+	var data = converter.convertToByteArray(str, result);
+	var ch = Components.classes["@mozilla.org/security/hash;1"]
+            .createInstance(Components.interfaces.nsICryptoHash);
+	ch.init(ch.MD5);
+	ch.update(data, data.length);
+	var hash = ch.finish(false);
+
+	// convert the binary hash data to a hex string.
+	var s = [this.toHexString(hash.charCodeAt(i)) for (i in hash)].join("");
+
+	return s;
+    }
+};
diff --git a/chrome/content/youtube_utils.js b/chrome/content/youtube_utils.js
new file mode 100755
index 0000000..7842b7c
--- /dev/null
+++ b/chrome/content/youtube_utils.js
@@ -0,0 +1,43 @@
+if("undefined" == typeof(vwofChrome)){
+    var vwofChrome = {};
+}
+vwofChrome.youtubeUtils = {
+    toggle_yt_wide:function (event){
+	var c = event.target.hasAttribute('checked')?1:0;
+	var wide;
+	if(c == 1){
+	    wide = "wide=1;";
+	}
+	else{
+	    wide = "wide=0;";
+	}
+
+	var url = "http://youtube.com";
+	var cookieString = wide+"domain=youtube.com;expires=Fri, 31 Dec 9999 23:59:59 GMT";
+	
+	var cookieUri = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(url, null, null);
+	Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService).setCookieString(cookieUri, null, cookieString, null);
+    },
+
+    yt_is_wide:function(){
+	var wide = false;
+	try
+	{
+	    var ios = Components.classes["@mozilla.org/network/io-service;1"]
+		.getService(Components.interfaces.nsIIOService);
+	    var uri = ios.newURI("http://www.youtube.com/", null, null);
+
+	    var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
+	    var cookie = cookieSvc.getCookieString(uri, null);
+
+	    if(cookie.indexOf("wide=1") != -1){
+		wide=true;
+	    }
+	}
+	catch (errorInfo)
+	{
+	    console.error(errorInfo);
+	}
+	return wide;
+    }
+};
diff --git a/chrome/locale/en-US/browserOverlay.dtd b/chrome/locale/en-US/browserOverlay.dtd
new file mode 100755
index 0000000..9b759db
--- /dev/null
+++ b/chrome/locale/en-US/browserOverlay.dtd
@@ -0,0 +1,3 @@
+<!ENTITY vwof.open.label            "Open Video WithOut Flash">
+<!ENTITY vwof.openMenu.accesskey    "O">
+<!ENTITY vwof.openItem.accesskey    "V">
diff --git a/chrome/skin/toolbar-button.css b/chrome/skin/toolbar-button.css
new file mode 100755
index 0000000..a475ebb
--- /dev/null
+++ b/chrome/skin/toolbar-button.css
@@ -0,0 +1,14 @@
+/*  skin/toolbar-button.css  */
+
+#vwof-button {
+  list-style-image: url("chrome://vwof/skin/video-icon_24.png");
+}
+
+toolbar[iconsize="small"] #vwof-button {
+  list-style-image: url("chrome://vwof/skin/video-icon_14.png");
+}
+
+#vwof-button:checked{
+    background-color:#FF0000;
+}
+
diff --git a/chrome/skin/video-icon.png b/chrome/skin/video-icon.png
new file mode 100755
index 0000000..ff8f336
Binary files /dev/null and b/chrome/skin/video-icon.png differ
diff --git a/chrome/skin/video-icon_14.png b/chrome/skin/video-icon_14.png
new file mode 100755
index 0000000..d4150b6
Binary files /dev/null and b/chrome/skin/video-icon_14.png differ
diff --git a/chrome/skin/video-icon_24.png b/chrome/skin/video-icon_24.png
new file mode 100755
index 0000000..bf273fa
Binary files /dev/null and b/chrome/skin/video-icon_24.png differ
diff --git a/defaults/preferences/vwof.js b/defaults/preferences/vwof.js
new file mode 100755
index 0000000..ab25570
--- /dev/null
+++ b/defaults/preferences/vwof.js
@@ -0,0 +1,4 @@
+pref("extensions.vwof.activate_onload", true);
+pref("extensions.vwof.prefered_quality", 'medium');
+pref("extensions.vwof.prefered_format", 'webm');
+pref("extensions.vwof.modules", '{"HTML5":1, "blip":1, "youtube":1, "dailymotion":1, "niconico":1, "FC2":1}');
diff --git a/install.rdf b/install.rdf
new file mode 100755
index 0000000..dd4cba4
--- /dev/null
+++ b/install.rdf
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+  <Description about="urn:mozilla:install-manifest">
+    <em:id>vwof at drev.com</em:id>
+    <em:name>Video WithOut Flash</em:name>
+    <em:description>Watch videos without flash</em:description>
+    <em:version>1.5.0</em:version>
+    <em:creator>Drevet Olivier</em:creator>
+    <em:homepageURL>http://olivier.drevet.free.fr</em:homepageURL>
+    <em:type>2</em:type>
+    <em:optionsURL>chrome://vwof/content/prefs.xul</em:optionsURL>
+
+    <!-- Mozilla Firefox -->
+    <em:targetApplication>
+      <Description>
+        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+        <em:minVersion>3.0</em:minVersion>
+        <em:maxVersion>33.0</em:maxVersion>
+      </Description>
+    </em:targetApplication>
+  </Description>
+</RDF>
diff --git a/modules/FC2.jsm b/modules/FC2.jsm
new file mode 100755
index 0000000..1018e14
--- /dev/null
+++ b/modules/FC2.jsm
@@ -0,0 +1,70 @@
+var parser = {
+    BASE_URI : 'video.fc2.com',
+    API_GET_VIDEO:'http://video.fc2.com/ginfo.php?upid=UPID&mimi=MIMI&gk=GK',
+    SALT:'_gGddgPfeaf_gzyr',
+    
+    parse_site:function(cw) {
+	const REGEX_VIDEO_ID_SITE = /content\/(\w+)/;
+	const XPATH_VIDEO_IMG = '/html/head/meta[@property="og:image"]/@content';
+	const doc = cw.document;
+	var video_info = [];
+	var id;
+
+	//get the video id
+	if(url_match = doc.URL.match(REGEX_VIDEO_ID_SITE)){
+	    id = url_match[1];
+	}
+	else{
+	    throw('cannot retreive ID of a '+this.BASE_URI+' video on '+doc.URL);
+	}
+
+	//get MD5 from video id and salt
+	var id_salt = id+this.SALT;
+	var md5sum = vwofChrome.utils.md5(id_salt);
+
+	//get gk (signature generated by JS)
+	var gk = [];
+	var res;
+	var re_fun = /function cass\(\)\{([\s\S]+?)\}/;	
+	var re_arr = /Array\(([0-9]),'(\w)'\)/g;
+	var source = doc.documentElement.innerHTML;
+	var function_content = source.match(re_fun)[1];
+	while(res = re_arr.exec(function_content)){  
+          gk[res[1]] = res[2];
+        }
+
+	//construct the url 
+	var api_video_uri = this.API_GET_VIDEO.replace('UPID', id);
+	api_video_uri = api_video_uri.replace('MIMI', md5sum);
+	api_video_uri = api_video_uri.replace('GK', gk.join(''));
+	
+	var data = vwofChrome.utils.get(api_video_uri).responseText;
+	//extract the video url (filepath) from the data
+	var assoc_data = vwofChrome.utils.url_vars_to_array(data);
+	var filepath = assoc_data['filepath'];
+	if(!filepath)return;
+
+	var mid = assoc_data['mid'];
+	var url = filepath+'?mid='+mid;
+	
+	//get player
+	var player = doc.getElementById('videoplayer');
+	if(!player){
+	    player = doc.getElementsByClassName('req_regist_wrap01 box_inset01')[0];
+	    var bnr_wifi = doc.getElementsByClassName('bnr_wifi')[0];
+	    if(bnr_wifi)bnr_wifi.style.display = 'none';
+	}
+	
+	//get thumbnail
+	var video_img = doc.evaluate(XPATH_VIDEO_IMG, doc, null,
+				     cw.XPathResult.STRING_TYPE, null).stringValue;
+
+	video_info.push({
+	    'player':player,
+	    'video_img': video_img,
+	    'videos': [ {'quality': 'medium', 'format':'flv', 'url':url} ]
+	});
+
+	return video_info;
+    }
+};
diff --git a/modules/HTML5.jsm b/modules/HTML5.jsm
new file mode 100755
index 0000000..9543b83
--- /dev/null
+++ b/modules/HTML5.jsm
@@ -0,0 +1,36 @@
+/**
+   HTML5 parser
+   used to play videos which use codec unsupported by default in firefox
+   but can be readed with the help of a media plugin (vlc-web-plugin, mplayer)
+*/
+
+var parser = {
+    parse_embed: function(cw) {
+	const doc = cw.document;
+	const XPATH_PLAYER = "//video";
+	const XPATH_VIDEO_URI = 'source';
+	var video_info = [];
+	var xp_res_player = doc.evaluate(XPATH_PLAYER, doc, null, 
+					 cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+					 null);
+
+	while (player = xp_res_player.iterateNext()) {
+	    var videos = [];
+            var xp_res_video = doc.evaluate(XPATH_VIDEO_URI, player, null, 
+					    cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+					    null);
+
+	    while (node_video = xp_res_video.iterateNext()) {
+		videos.push({'format': node_video.type, 'url': node_video.src});
+	    }
+
+	    video_info.push({
+		'player':player,
+		'video_img':player.poster,
+		'videos': videos
+	    });
+	}
+
+	return video_info;
+    }
+};
diff --git a/modules/Makefile.in b/modules/Makefile.in
new file mode 100755
index 0000000..23f8111
--- /dev/null
+++ b/modules/Makefile.in
@@ -0,0 +1,2 @@
+# The sources for the module files.
+modules_sources := $(wildcard $(modules_dir)/*.jsm)
diff --git a/modules/blip.jsm b/modules/blip.jsm
new file mode 100755
index 0000000..f1d3137
--- /dev/null
+++ b/modules/blip.jsm
@@ -0,0 +1,111 @@
+var parser = {
+    BASE_URI: 'blip.tv',
+    URL_PARAM_JSON: '?skin=json&no_wrap=1',
+
+    parse_embed: function(cw) {
+	var doc = cw.document;
+	const XPATH_PLAYER = "//iframe[starts-with(@src, 'http://blip.tv/play')]";
+	var video_info = [];
+	var player;
+	var video_img;
+	
+	var xp_res_player = doc.evaluate(XPATH_PLAYER, doc,
+					 null, cw.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, 
+					 null );
+
+	while (player = xp_res_player.iterateNext()) {
+    	    var videos = [];
+	    var encoded_file;
+	    var player_doc = vwofChrome.utils.get(player.src).responseText;
+
+	    if((encoded_file = player_doc.match(/"file":"(.+?)",/)) !== null){
+		var file = decodeURIComponent(encoded_file[1]);
+		file = file.replace('rss/flash', 'posts/view');
+		var json_string = vwofChrome.utils.get(file+this.URL_PARAM_JSON).responseText;
+		var parse_data = this.parse_json_data(json_string);
+		video_img = parse_data[0];
+		videos = parse_data[1];
+	    }
+	    else{
+		const URL_BASE = 'http://blip.tv/file/get/';
+
+		const REGEX_VIDEO_URI_HD = 'bliphd720 : "(.*)"';
+		const REGEX_VIDEO_URI_SD = 'blipsd : "(.*)"';
+		const REGEX_VIDEO_URI_LD = 'blipld : "(.*)"';
+		const REGEX_VIDEO_IMG = 'config\.video\.thumbnail = "(.*)"';
+
+		var video_uri_hd = player_doc.match(REGEX_VIDEO_URI_HD);
+		var video_uri_sd = player_doc.match(REGEX_VIDEO_URI_SD);
+		var video_uri_ld = player_doc.match(REGEX_VIDEO_URI_LD);
+		var video_uri_img = player_doc.match(REGEX_VIDEO_IMG);
+
+		if(video_uri_hd[1] != ""){
+		    videos.push({'quality':'hd720' , 'url':URL_BASE+video_uri_hd[1]});
+		}
+		if(video_uri_sd[1] != ""){
+		    videos.push({'quality':'medium', 'url':URL_BASE+video_uri_sd[1]});
+		}
+		if(video_uri_ld[1] != ""){
+		    videos.push({'quality':'low' , 'url':URL_BASE+video_uri_ld[1]});
+		}
+	
+		if(video_uri_img){
+		    video_img = 'http:'+video_uri_img[1];
+		    video_img = video_img.replace('THUMB_WIDTH', player.width);
+		    video_img = video_img.replace('THUMB_HEIGHT', player.height);
+		}
+	    }
+
+	    video_info.push({
+		'player': player,
+		'video_img':video_img,
+		'videos': videos
+	    });
+	}
+
+	return video_info;
+    },
+
+    parse_site: function(cw) {
+	var doc = cw.document;
+	var video_info = [];
+	var player = doc.getElementById('PlayeriFrame');
+	if(!player)return;
+	
+	var json_string = vwofChrome.utils.get(doc.URL+this.URL_PARAM_JSON).responseText;
+	var parse_data = this.parse_json_data(json_string);
+	var video_img = parse_data[0];
+	var videos = parse_data[1];
+	
+	video_info.push({
+	    'player': player,
+	    'video_img': video_img,
+	    'videos': videos
+	});
+
+	return video_info;
+    },
+
+    parse_json_data: function(json_string){
+	var post = JSON.parse(json_string).Post;
+	
+	var videos = [];
+	for(var i=0;i<post.additionalMedia.length;i++){
+	    var format = post.additionalMedia[i].primary_mime_type;
+	    if(format == 'text/plain')continue;
+	    
+	    //remove video part of the mime type for a prettier display
+	    format=format.replace('video/', '');
+
+	    videos.push({'format': format,
+			 'quality': post.additionalMedia[i].media_width + '/' + 
+			 post.additionalMedia[i].media_height,
+			 'url':post.additionalMedia[i].url}
+		       );
+	}
+
+	var video_img = post.thumbnailUrl;
+
+	return [video_img, videos];
+    }
+};
diff --git a/modules/dailymotion.jsm b/modules/dailymotion.jsm
new file mode 100755
index 0000000..4718a27
--- /dev/null
+++ b/modules/dailymotion.jsm
@@ -0,0 +1,62 @@
+var parser = {
+    BASE_URI        : 'www.dailymotion.com',
+    parse_site:function(cw) {
+	var video_info = [];
+
+	var player = cw.document.getElementById('container_player_main');	
+	var video_data = this.get_video_data(player.contentDocument);
+	video_data['player'] = player;
+
+	video_info.push(video_data);
+	return video_info;
+    },
+
+    parse_embed: function(cw) {
+	const XPATH_PLAYER = "//iframe[contains(@src, '"+this.BASE_URI +"/embed')]";
+
+	var video_info = [];
+	var xp_res_player = cw.document.evaluate(XPATH_PLAYER, cw.document, null, 
+						 cw.XPathResult.UNORDERED_NODE_ITERATOR_TYPE,
+						 null );
+	var player;
+	
+	while (player = xp_res_player.iterateNext()) {
+
+	    var video_data = this.get_video_data(player.contentDocument);
+	    
+	    video_data['player'] = player;
+	    video_info.push(video_data);
+	}
+	return video_info;
+    },
+
+    get_video_data: function(contentDocument){
+	var info = contentDocument.body.innerHTML.match(/var info = ({.*})/);
+	var json_info = JSON.parse(info[1]);
+	var videos = [];
+
+	for(info_key in json_info){
+	    if( (video_data = info_key.match(/stream_(.*)_(.*)_url/) ) && json_info[info_key] != undefined){
+		var format = video_data[1];
+		var quality = video_data[2];
+
+		switch(quality){
+		    case 'ld':quality = 'low';break;
+		    case 'hq':quality = 'high';break;
+		    case 'hd':quality = 'hd';break;
+		}
+		
+		videos.push( {'format':format, 'quality':quality, 'url':json_info[info_key]} );
+	    }
+	}
+	
+	var video_info = {
+	    'video_img': json_info.thumbnail_url,
+	    'videos': videos
+	};	
+	
+	return video_info;
+	
+    },
+
+};
diff --git a/modules/niconico.jsm b/modules/niconico.jsm
new file mode 100755
index 0000000..61bb763
--- /dev/null
+++ b/modules/niconico.jsm
@@ -0,0 +1,53 @@
+var parser = {
+    BASE_URI: 'www.nicovideo.jp',
+
+    parse_site: function(cw) {
+	const doc = cw.document;
+	var video_info = [];
+	var player = doc.getElementById('nicoplayerContainer');	
+
+	//remove the 'limited functionality' alert warning
+	const XPATH_CHECK_FLASH = '/html/body/script[67]';
+	var node_script_check_flash = doc.evaluate(XPATH_CHECK_FLASH,
+						   doc, null,
+						   cw.XPathResult.FIRST_ORDERED_NODE_TYPE,
+						   null).singleNodeValue;
+	if(node_script_check_flash)node_script_check_flash.textContent = '';
+
+	//auto redirect to the 'skip flash install' page
+	if(new RegExp(/\/watch\/sm\d+$/).test(cw.location.href)){
+	    cw.location.assign(cw.location.href+'?ver=q9');
+	}
+	
+	////get some video information  (thumbnail, video id, etc)
+	//the script content contains a json string with informations
+	const XPATH_SCRIPT = '/html/body/script';
+	var script_content = doc.evaluate(XPATH_SCRIPT, doc,
+					  null, cw.XPathResult.STRING_TYPE,
+					  null).stringValue;
+
+	//extract the json formated part of the script content
+	var string_data = script_content.match(/window.watchAPIData = (.*);/)[1];    
+	var json_data = JSON.parse(string_data);
+	
+	////get the video link from the flapi
+	const video_id = json_data.flashvars.videoId;
+	const flapi_url = 'http://flapi.nicovideo.jp/api/getflv?v='+video_id;
+	const data = vwofChrome.utils.get(flapi_url).responseText;
+	const assoc_data = vwofChrome.utils.url_vars_to_array(data);
+	const url = decodeURIComponent(assoc_data['url']);
+	
+	var videos = [ {
+	    'quality':'medium',
+	    'url': url
+	} ];
+	
+	video_info.push({
+	    'player': player,
+	    'video_img': json_data.videoDetail.thumbnail,
+	    'videos': videos
+	});
+	
+	return video_info;
+    }
+};
diff --git a/modules/youtube.jsm b/modules/youtube.jsm
new file mode 100755
index 0000000..dd110cb
--- /dev/null
+++ b/modules/youtube.jsm
@@ -0,0 +1,127 @@
+var parser = {
+    BASE_URI : 'www.youtube.com',
+    API_GET_VIDEO:'http://youtube.com/get_video_info?video_id=VIDEO_ID',
+    
+    /**
+       parse a video on the web site
+    */
+    parse_site:function(cw) {
+	const REGEX_VIDEO_ID_SITE = /watch\?v=([\w\-]{11})/;
+	var doc = cw.document;	
+	var video_info = [];
+	var id;
+
+	//get the video id from the current url
+	if(url_match = doc.URL.match(REGEX_VIDEO_ID_SITE)){
+	    id = url_match[1];
+	}
+	else{
+	    throw('cannot retreive ID of a '+this.BASE_URI+' video on '+doc.URL);
+	}
+
+	var player_api = doc.getElementById('player-api');
+	if(player_api){
+	    player_api.setAttribute('id', 'vwof_player-api');  //prevent the player-api div to be erased by the missing plugin tv-static message
+	    if(vwofChrome.youtubeUtils.yt_is_wide()){
+		player_api.setAttribute("style", "margin:auto;");  //center the player
+	    }
+	}
+	else {
+	    player_api = doc.getElementById('vwof_player-api');  //the page has previously been proceeded
+	}
+
+	//remove all child from the player api, in case we need to load a new video
+	while (player_api.firstChild) {
+	    player_api.removeChild(player_api.firstChild);
+	}
+
+	var player = doc.createElement('div');
+	player_api.appendChild(player);
+	
+	var api_video_uri = this.API_GET_VIDEO.replace('VIDEO_ID', id);
+	var data = vwofChrome.utils.get(api_video_uri).responseText;
+	var video_data = this.parse_data(data);
+	video_data['player'] = player;
+	
+	//this div overlap with the player when the screen resolution is low
+	var guide =  doc.getElementById('guide');
+	if(guide)guide.style.display = 'none';
+	
+	video_info.push(video_data);
+	
+	/*var URL_API_COMMENTS = 'https://apis.google.com/u/0/wm/4/_/widget/render/comments?usegapi=1&first_party_property=YOUTUBE&href='+encodeURIComponent(doc.URL);
+	var comments = vwofChrome.utils.get(URL_API_COMMENTS);
+	var comment_frame = doc.createElement('iframe');
+	comment_frame.src = URL_API_COMMENTS;
+	doc.getElementById('watch-discussion').appendChild(comment_frame);*/
+
+	return video_info;
+    },
+
+    /**
+       parse iframe embed in sites, potentialy several videos
+    */
+    parse_embed: function(cw) {
+	var video_info = [];
+	var player;
+	const REGEX_VIDEO_ID_IFRAME = /embed\/([\w\-]{11})/;
+	const XPATH_PLAYER_IFRAME = "//iframe[contains(@src, '"+this.BASE_URI+"/embed')]";
+	
+	var xp_res_player = cw.document.evaluate(XPATH_PLAYER_IFRAME, cw.document, null, cw.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null );
+
+	while (player = xp_res_player.iterateNext()) {
+
+	    var id = player.src.match(REGEX_VIDEO_ID_IFRAME)[1];
+	    var api_video_uri = this.API_GET_VIDEO.replace('VIDEO_ID', id);
+	    var data = vwofChrome.utils.get(api_video_uri).responseText;
+
+	    var parsed_array = this.parse_data(data);
+	    parsed_array['player'] = player;
+	    video_info.push(parsed_array);
+	}
+	
+	return video_info;
+    },
+
+
+    /**
+       this is where the video data are retreived from the enormous json
+       returned by the youtube's get_video_info page
+    */
+    parse_data: function(data){
+	var videos = [];
+	var assoc_data = vwofChrome.utils.url_vars_to_array(data);
+
+	var url_encoded_fmt_stream_map = assoc_data['url_encoded_fmt_stream_map'];
+	var url_decoded_fmt_stream_map = decodeURIComponent(url_encoded_fmt_stream_map);
+	var arr_url_decoded_fmt_stream_map = url_decoded_fmt_stream_map.split(',');
+	var i;
+	
+	for(i=0;i<arr_url_decoded_fmt_stream_map.length;i++){
+	    var assoc_url_decoded_fmt_stream = vwofChrome.utils.url_vars_to_array(arr_url_decoded_fmt_stream_map[i]);
+	    var encoded_uri = assoc_url_decoded_fmt_stream['url'];
+	    var decoded_uri = decodeURIComponent(encoded_uri);
+	    decoded_uri += '&signature='+assoc_url_decoded_fmt_stream['sig'];    //add the signature to the decoded url
+	    var type = decodeURIComponent(assoc_url_decoded_fmt_stream['type']);
+	    var quality = decodeURIComponent(assoc_url_decoded_fmt_stream['quality']);
+
+	    //small is replaced by low so the prefered format can detect the quality
+	    if(quality == 'small')quality = 'low';
+	    //remove some part of the mime type (we know it's a video)
+	    //we want to display only the type and codecs
+	    if(type){
+		type=type.replace('video/', '');
+		type=type.replace(/;\+codecs="(.+)"/, '($1)');
+	    }
+	    
+	    videos.push( {'quality': quality, 'format':type, 'url':decoded_uri} );
+	}
+	
+	var video_info = {
+	    'video_img': decodeURIComponent(assoc_data['iurl']),
+	    'videos': videos
+	};
+
+	return video_info;
+    }
+};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/video-without-flash.git



More information about the Pkg-mozext-commits mailing list