First commit.
1
subsites/projects/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
ErrorDocument 404 /index.php
|
||||
1
subsites/projects/algo/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bak/
|
||||
681
subsites/projects/algo/COPYING
Normal file
@@ -0,0 +1,681 @@
|
||||
Most of the images on Algo are released under the Creative Commons
|
||||
Attribution-ShareAlike license with Niels Serup being the author.
|
||||
When this is not the case, a text file with <name of image>.txt will
|
||||
state the license.
|
||||
|
||||
The source code of Algo is released under the GPLv3 (see below).
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
BIN
subsites/projects/algo/algo_v.0.1.7z
Normal file
BIN
subsites/projects/algo/algo_v.0.1.zip
Normal file
1
subsites/projects/algo/dir.txt
Normal file
@@ -0,0 +1 @@
|
||||
This directory holds the main HTML file and the main CSS file.
|
||||
244
subsites/projects/algo/environment.css
Normal file
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
Algo: a dekstop environment look-a-like in your web browser
|
||||
Copyright (C) 2009 Niels Serup
|
||||
|
||||
This file is part of Algo.
|
||||
|
||||
Algo 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.
|
||||
|
||||
Algo 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 Algo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Standard stuff
|
||||
This file holds all standard css stuff that must not
|
||||
(and cannot) be changed in any css theme file. */
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
font-family: 'dejavu sans' arial;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Navigation bar (normally there are two navigation bars -
|
||||
one at the top of the page and one at the bottom of the page). */
|
||||
.navbar {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Dropdowns */
|
||||
.dropdown {
|
||||
display: block;
|
||||
float: left;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dropdown * {
|
||||
display: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dropdown .top {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropdown .group {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dropdown .entries {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.dropdown .entry, .dropdown .header {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dropdown .side {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.dropdown:hover * {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropdown:hover .top {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dropdown:hover .entries {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.dropdown .group:hover > .entries {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* When an entry in a dropdown list is clicked, the .dropdown class receives
|
||||
another class: the .dropdownh class. This takes care of hiding the box. */
|
||||
.dropdownh *, .dropdownh:hover * {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Area - the area where the windows are */
|
||||
.area {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Windows */
|
||||
.window {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.window > * {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
/* The handle is there, but it's transparent */
|
||||
.window > .handle {
|
||||
background: #000;
|
||||
filter: alpha(opacity=0);
|
||||
-moz-opacity: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* The following stuff features the divs around the window. */
|
||||
.window > .tl {
|
||||
cursor: nw-resize;
|
||||
}
|
||||
|
||||
.window > .tr {
|
||||
cursor: ne-resize;
|
||||
}
|
||||
|
||||
.window > .r {
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
.window > .br {
|
||||
cursor: se-resize;
|
||||
}
|
||||
|
||||
.window > .b {
|
||||
cursor: s-resize;
|
||||
}
|
||||
|
||||
.window > .bl {
|
||||
cursor: sw-resize;
|
||||
}
|
||||
|
||||
.window > .l {
|
||||
cursor: w-resize;
|
||||
}
|
||||
|
||||
/* The .t class (the top, or header, of the window) is only for showing
|
||||
a background image (read: css theme files). The .resize_handle acts as
|
||||
the top resizer. */
|
||||
.window > .resize_handle {
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.window > .title {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* .data is the object/iframe */
|
||||
.window > .data {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* .data_overlay is showed whenever moving or adjusting a window.
|
||||
If it is not on, the object/iframe might catch focus of the mouse */
|
||||
.window > .data_overlay {
|
||||
display: none;
|
||||
background: #000;
|
||||
filter: alpha(opacity=0);
|
||||
-moz-opacity: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* .options is the div that holds the minimize, maximize and close button */
|
||||
.window > .options > *, .window_max > .options > * {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* When a window is maximized, it receives a new class - the .window_max class
|
||||
Resize cursors must not be visible when in maximized mode */
|
||||
.window_max > .tl, .window_max > .resize_handle, .window_max > .tr, .window_max > .r, .window_max > .br, .window_max > .b, .window_max > .bl, .window_max > .l, .nrsz > .tl, .nrsz > .resize_handle, .nrsz > .tr, .nrsz > .r, .nrsz > .br, .nrsz > .b, .nrsz > .bl, .nrsz > .l {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* .overlay is the general overlay that is displayed (yes, it's transparent)
|
||||
whenever moving or adjusting a window. Same reasons as .data_overlay */
|
||||
.overlay {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #000;
|
||||
filter: alpha(opacity=0);
|
||||
-moz-opacity: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* .appboxes holds information about the text boxes,
|
||||
normally placed in the bottom navigation bar,
|
||||
that show which windows are open */
|
||||
.appboxes * {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* .abs is shown when there is not enough space for all appboxes on one line.
|
||||
.scrollup and .scrolldown are the buttons used for scrolling. */
|
||||
.abs {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: 100%;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.scrollup {
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.scrolldown {
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
|
||||
/* .highlightfix is a fix needed (at least in Firefox).
|
||||
When moving or adjusting a window, some text will
|
||||
automatically turn highlighted. This fix fixes that. */
|
||||
.highlightfix {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
1
subsites/projects/algo/img/dir.txt
Normal file
@@ -0,0 +1 @@
|
||||
This folder holds images indepent of themes.
|
||||
15
subsites/projects/algo/index.htm
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Algo</title>
|
||||
<link type='text/css' rel='stylesheet' href='environment.css' />
|
||||
<script type='text/javascript' src='js/httpobj.js'></script>
|
||||
<script type='text/javascript' src='js/navbar.js'></script>
|
||||
<script type='text/javascript' src='js/screen.js'></script>
|
||||
<script type='text/javascript' src='js/scr_window.js'></script>
|
||||
<script type='text/javascript' src='js/themes.js'></script>
|
||||
<script type='text/javascript' src='js/onload.js'></script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
11
subsites/projects/algo/js/dir.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
This folder holds the JavaScript files used by Algohol. For an understanding of how the JavaScript environment of Algohol works, it's a good idea to read the files in the following order:
|
||||
|
||||
1. navbar.js
|
||||
2. screen.js
|
||||
3. scr_window.js
|
||||
4. themes.js
|
||||
5. onload.js
|
||||
|
||||
The 5 files are all commented.
|
||||
|
||||
The httpobj.js file found in this directory does not have anything to do with the environment directly, but it's still pretty important. Algohol needs it. The httpobj.js file is not commented.
|
||||
106
subsites/projects/algo/js/httpobj.js
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
httpobj: javascript class using XMLHttpRequest to send and retrieve info.
|
||||
See /httpobj to get an example of the usage.
|
||||
*/
|
||||
//v.1.0
|
||||
function httpobj() {
|
||||
// Get XMLHttpRequest object
|
||||
this.obj = this.getobj()
|
||||
if (!this.obj) {
|
||||
alert('Your browser does not support HTTP Requests! Get a new one (a browser, that is. Not a request).')
|
||||
delete this
|
||||
return false
|
||||
}
|
||||
|
||||
// Define default variables
|
||||
this.param = {}
|
||||
this.method = 'POST'
|
||||
|
||||
// Fix for later on
|
||||
this.obj.topelem = this
|
||||
}
|
||||
|
||||
httpobj.prototype.getobj = function() {
|
||||
// Try to get the XMLHttpRequest object
|
||||
try { return new XMLHttpRequest() } catch (e) {}
|
||||
try { return new ActiveXObject('Msxml2.XMLHTTP.6.0') } catch(e) {}
|
||||
try { return new ActiveXObject('Msxml2.XMLHTTP.3.0') } catch(e) {}
|
||||
try { return new ActiveXObject('Msxml2.XMLHTTP') } catch(e) {}
|
||||
try { return new ActiveXObject('Microsoft.XMLHTTP') }
|
||||
catch(e) {
|
||||
return false // FAILURE
|
||||
}
|
||||
}
|
||||
|
||||
httpobj.prototype.send = function() {
|
||||
/*
|
||||
send(): Sends parametres (param) to url (url) and sets up function to
|
||||
react on retrievement
|
||||
*/
|
||||
|
||||
if (!this.url) {
|
||||
// Exit function if either url or the function to be called is undefined
|
||||
delete this
|
||||
return false
|
||||
}
|
||||
|
||||
// Transform param into string type ?foo=bar&hmm=aha
|
||||
this.text_params = ''
|
||||
if (this.param) {
|
||||
for (var x in this.param)
|
||||
this.text_params += '&' + x + '=' + this.param[x]
|
||||
this.text_params = this.text_params.substr(1)
|
||||
}
|
||||
|
||||
if (this.method.toLowerCase() == 'get') {
|
||||
// In case of GET method, use '?'
|
||||
var after_url
|
||||
if (!this.param)
|
||||
after_url = ''
|
||||
else
|
||||
after_url = '?' + this.text_params
|
||||
|
||||
this.obj.open('GET', this.url + after_url, true)
|
||||
this.obj.send(null)
|
||||
}
|
||||
else {
|
||||
// In case of POST method, use RequestHeader
|
||||
this.obj.open('POST', this.url, true)
|
||||
this.obj.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
|
||||
this.obj.setRequestHeader('Content-length', this.text_params.length)
|
||||
this.obj.setRequestHeader('Connection', 'close')
|
||||
this.obj.send(this.text_params)
|
||||
}
|
||||
|
||||
// What to do when something happens
|
||||
this.obj.onreadystatechange = function() {
|
||||
// Only do something when it's complete
|
||||
if (this.readyState == 4 || this.readyState == 'complete') {
|
||||
// Define 3 variables to be used with the user-defined function (func)
|
||||
var text, params, state
|
||||
text = this.responseText
|
||||
params = this.topelem.param // this.topelem = this.obj.topelem = this
|
||||
|
||||
// State 0 is good, state 1 is bad
|
||||
state = 0
|
||||
if (this.status != 200) {
|
||||
state = 1
|
||||
text = ''
|
||||
}
|
||||
|
||||
// Call user-defined function
|
||||
if (this.topelem.func)
|
||||
eval(this.topelem.func)
|
||||
delete this
|
||||
}
|
||||
}
|
||||
return true // It has a chance of working..
|
||||
}
|
||||
285
subsites/projects/algo/js/navbar.js
Normal file
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
Algo: a dekstop environment look-a-like in your web browser
|
||||
Copyright (C) 2009 Niels Serup
|
||||
|
||||
This file is part of Algo.
|
||||
|
||||
Algo 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.
|
||||
|
||||
Algo 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 Algo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
The navbar class creates a navigation bar. Normally Algo features two
|
||||
navigation bars - one at the top of the page and one at the bottom of the
|
||||
page. Several obejcts can be added to a navigation bar after its creation,
|
||||
including dropdowns, appboxes (the boxes with text that you can click on,
|
||||
usually found in the bottom navigation bar) and a clock. The style of the
|
||||
navigation bar itself and the objects on the navigation bar is found in an
|
||||
external css themes file.
|
||||
*/
|
||||
function navbar(pos) {
|
||||
// navnum = the order in which it was created (0, 1, etc.)
|
||||
this.navnum = navi.length
|
||||
// If pos is undefined, set the navigation bar to be at the top
|
||||
if (pos == undefined || pos == -1) var pos = [[0, ''], -1, -1, [0, '']]
|
||||
// Save pos
|
||||
this.pos = pos
|
||||
|
||||
// Create the actual navigation bar element
|
||||
this.menu = document.createElement('div')
|
||||
|
||||
/* Makes it identifiable by a css file.
|
||||
By adding " navi" followed by the number of the navbar,
|
||||
each navbar can be independently changed by a css file */
|
||||
this.menu.className = 'navbar navi' + this.navnum
|
||||
|
||||
// Update the position of the navbar
|
||||
this.update()
|
||||
|
||||
// Append the navbar to the wrapper
|
||||
wrapper.appendChild(this.menu)
|
||||
}
|
||||
|
||||
navbar.prototype.update = function() {
|
||||
// Loop through the 4 global directions (top to right)
|
||||
for (var i = 0; i < global_directions_length; i++) {
|
||||
/* If the pos is not no-existant, style the navbar's menu element with the
|
||||
amount ([i][0]) followed by a unit ([i][1]) */
|
||||
if (this.pos[i] != -1)
|
||||
this.menu.style[global_directions[i]] = this.pos[i][0] + this.pos[i][1]
|
||||
}
|
||||
}
|
||||
|
||||
navbar.prototype.support = function(name) {
|
||||
/* When supporting objects, they will be linked to the supporting navbar
|
||||
to make them accesible later on via the global "posis" list */
|
||||
posis[name] = this.navnum
|
||||
|
||||
// Special cases
|
||||
if (name == 'dropdowns')
|
||||
this.drops = []
|
||||
}
|
||||
|
||||
navbar.prototype.unsupport = function(name) {
|
||||
// Cease support of a certain object
|
||||
if (posis[name] == undefined) return
|
||||
delete posis[name]
|
||||
|
||||
// Special cases
|
||||
if (name == 'dropdowns')
|
||||
delete this.dropdowns
|
||||
else if (name == 'appboxes')
|
||||
delete this.appboxes
|
||||
}
|
||||
|
||||
// DROPDOWN
|
||||
navbar.prototype.drop = function(name, list) {
|
||||
/* Adds a dropdown menu. Dropdowns will appear in the order they are created.
|
||||
"name" is the name of the dropdown menu, while "list" holds all the
|
||||
entries in an array-like format.
|
||||
*/
|
||||
var listlen = list.length
|
||||
var wrap = this.append_level(list, name)
|
||||
this.dropdowns.appendChild(wrap)
|
||||
|
||||
// Adds a new dropdown object to the "drops"
|
||||
this.drops[this.drops.length] = [wrap, name, list]
|
||||
}
|
||||
|
||||
navbar.prototype.append_level = function(list, first) {
|
||||
/* This function creates the elements of a dropdown menu,
|
||||
based on a list of strings and (eventually) more lists.
|
||||
This function will call itself if a list at level one
|
||||
has another list. That way, there are no factors that
|
||||
limit the number of levels in a dropdown menu. "first"
|
||||
is set to the name of the list when called from the
|
||||
original drop prototype function, while it is set to
|
||||
false when called from this function itself. */
|
||||
var listlen = list.length
|
||||
var i, wrap, dtop, type, elem, elema, elemb, spl, title
|
||||
|
||||
// Creates the temporary element that will hold everything
|
||||
wrap = document.createElement('div')
|
||||
if (first) {
|
||||
wrap.className = 'dropdown'
|
||||
// dtop = the header element
|
||||
dtop = document.createElement('div')
|
||||
// Adds two classes, one general and one special (" drop" + drops.length)
|
||||
dtop.className = 'top drop' + navi[posis['dropdowns']].drops.length
|
||||
dtop.innerHTML = first
|
||||
wrap.appendChild(dtop)
|
||||
}
|
||||
else {
|
||||
/* If it's not the first time the function is called, it will create a
|
||||
div with entries instead of a div with a header. */
|
||||
wrap.className = 'entries'
|
||||
elem = document.createElement('div')
|
||||
elem.className = 'side'
|
||||
wrap.appendChild(elem)
|
||||
}
|
||||
|
||||
/* This is the main loop. It looks at the list entries and evaluates them
|
||||
based on what they are. If a string is encountered, it is written to the
|
||||
dropdown menu. If an object (a list in this case) is encountered, this
|
||||
function is recalled with the sublist as the main list. */
|
||||
for (i = 0; i < listlen; i++) {
|
||||
type = typeof(list[i])
|
||||
if (type == 'string') {
|
||||
spl = [list[i], 'true']
|
||||
if (list[i].indexOf('#') != -1)
|
||||
spl = list[i].split('#')
|
||||
elem = document.createElement('div')
|
||||
elem.className = 'entry'
|
||||
elem.rel = spl[1]
|
||||
elem.onmouseup = function() {
|
||||
navi[posis['dropdowns']].hide_drops()
|
||||
}
|
||||
elem.innerHTML = spl[0]
|
||||
elem.onclick = function() {
|
||||
eval('scr.setwindow(\'' + this.innerHTML + '\',' + this.rel + ')')
|
||||
}
|
||||
wrap.appendChild(elem)
|
||||
}
|
||||
else if (type == 'object') {
|
||||
elem = document.createElement('div')
|
||||
elem.className = 'group'
|
||||
elema = document.createElement('div')
|
||||
elema.className = 'header'
|
||||
elema.innerHTML = list[i][0]
|
||||
elem.appendChild(elema)
|
||||
elema = this.append_level(list[i][1])
|
||||
elem.appendChild(elema)
|
||||
wrap.appendChild(elem)
|
||||
}
|
||||
}
|
||||
return wrap
|
||||
}
|
||||
|
||||
navbar.prototype.hide_drops = function() {
|
||||
/* When clicking on an entry in a dropdown menu, the mouse will still hover
|
||||
the dropdown element, and the dropdown element will still be visible.
|
||||
By temporarily changing the class of the dropdown menu, this function
|
||||
makes the dropdown disappear. */
|
||||
if (!hiding_drops) {
|
||||
hiding_drops = true
|
||||
var l = this.drops.length
|
||||
for (i = 0; i < l; i++) {
|
||||
this.drops[i][0].className = 'dropdownh dropdown'
|
||||
}
|
||||
// No need to wait for more than 0.1 seconds
|
||||
setTimeout('navi[posis[\'dropdowns\']].hide_drops()', 100)
|
||||
}
|
||||
else {
|
||||
hiding_drops = false
|
||||
var l = this.drops.length
|
||||
for (i = 0; i < l; i++) {
|
||||
this.drops[i][0].className = 'dropdown'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
navbar.prototype.box = function(name, pos) {
|
||||
/* This function adds a box with an object to the navigation bar. "pos" is
|
||||
the css float property and is completely optional. For the most part it
|
||||
should in fact not be neccesary to use it, as the styles of most elements
|
||||
added by this function is defined in a css file. */
|
||||
if (pos == undefined) pos = 'none'
|
||||
this[name] = document.createElement('div')
|
||||
this[name].className = name
|
||||
this[name].style.cssFloat = pos
|
||||
this.menu.appendChild(this[name])
|
||||
|
||||
// Special cases
|
||||
if (name == 'clock') {
|
||||
this.setclock()
|
||||
this.clockinterval = setInterval('navi[posis[\'clock\']].setclock()', 30000)
|
||||
}
|
||||
if (name == 'abs_scroller') {
|
||||
// abs_scroller appears when there is not enough space for all appboxes.
|
||||
this.abs_scroller.className = 'abs'
|
||||
var elem
|
||||
elem = document.createElement('div')
|
||||
elem.className = 'scrollup'
|
||||
elem.onclick = function() {
|
||||
// Scroll up
|
||||
navi[posis['appboxes']].abs_scroll(1)
|
||||
}
|
||||
this.abs_scroller.appendChild(elem)
|
||||
elem = document.createElement('div')
|
||||
elem.className = 'scrolldown'
|
||||
elem.onclick = function() {
|
||||
// Scroll down
|
||||
navi[posis['appboxes']].abs_scroll(-1)
|
||||
}
|
||||
this.abs_scroller.appendChild(elem)
|
||||
|
||||
this.menu.style.overflow = 'hidden'
|
||||
}
|
||||
}
|
||||
|
||||
navbar.prototype.check_abs_height = function(force) {
|
||||
/* This function checks if there is a need for a scroller, i.e. if there are
|
||||
too many appboxes to be shown in one line. */
|
||||
var abs = navi[posis['appboxes']].height
|
||||
var rnum = navi[posis['appboxes']].appboxes.scrollHeight
|
||||
if (ie) {
|
||||
// Internet Explorer has some issues. This fix isn't perfect.
|
||||
if ((rnum / abs + '').indexOf('.') != -1) rnum += appbox_margin * 2
|
||||
}
|
||||
var num = rnum / abs
|
||||
if (num > 1) {
|
||||
// If there are too many appboxes
|
||||
navi[posis['appboxes']].appboxes.style.marginRight = abs_scroller_width + 3 + 'px'
|
||||
navi[posis['appboxes']].abs_scroller.style.display = 'block'
|
||||
/* If the force is true, scroll to the place where the window linked with
|
||||
the appbox is */
|
||||
if (force) this.abs_scroll(-Math.floor(wnds[scr.wndpos[0]].appbox.offsetTop / abs))
|
||||
}
|
||||
else {
|
||||
navi[posis['appboxes']].appboxes.style.marginRight = '0'
|
||||
navi[posis['appboxes']].abs_scroller.style.display = 'none'
|
||||
this.abs_scroll(-abs_scrolled)
|
||||
}
|
||||
}
|
||||
|
||||
navbar.prototype.abs_scroll = function(am) {
|
||||
var abam = abs_scrolled + am * 1
|
||||
var abs = this.height
|
||||
var rnum = this.appboxes.scrollHeight
|
||||
if (ie) {
|
||||
// Internet Explorer has some issues. This fix isn't perfect.
|
||||
if ((rnum / abs + '').indexOf('.') != -1) rnum += appbox_margin * 2
|
||||
}
|
||||
|
||||
/* num = the actual height of the appboxes container divided with the
|
||||
displayed height */
|
||||
var num = rnum / abs
|
||||
if (abs_scrolled + am < 1 && abam * -1 < num) {
|
||||
// Only do the scrolling if there's something to scroll to
|
||||
abs_scrolled = abam
|
||||
this.appboxes.style.marginTop = abs * abs_scrolled + 'px'
|
||||
}
|
||||
}
|
||||
|
||||
navbar.prototype.setclock = function() {
|
||||
var time = new Date ()
|
||||
|
||||
var hours = time.getHours()
|
||||
var minutes = time.getMinutes()
|
||||
|
||||
// "07" is nicer than just "7"
|
||||
hours = (hours < 10 ? "0" : "") + hours
|
||||
minutes = (minutes < 10 ? "0" : "") + minutes
|
||||
|
||||
this.clock.innerHTML = hours + ':' + minutes
|
||||
}
|
||||
166
subsites/projects/algo/js/onload.js
Normal file
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
Algo: a dekstop environment look-a-like in your web browser
|
||||
Copyright (C) 2009 Niels Serup
|
||||
|
||||
This file is part of Algo.
|
||||
|
||||
Algo 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.
|
||||
|
||||
Algo 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 Algo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
window.onload = function() {
|
||||
// Get the head element
|
||||
head_con = document.getElementsByTagName('head')[0]
|
||||
|
||||
// Theme support - .href will be added at the end of the onload function
|
||||
theme = document.createElement('link')
|
||||
theme.rel = 'stylesheet'
|
||||
theme.type = 'text/css'
|
||||
head_con.appendChild(theme)
|
||||
|
||||
|
||||
// wrapper holds everything
|
||||
wrapper = document.createElement('div')
|
||||
wrapper.style.display = 'none'
|
||||
document.body.appendChild(wrapper)
|
||||
|
||||
|
||||
// A lot of globals used in various functions
|
||||
global_directions = ['top', 'right', 'bottom', 'left']
|
||||
global_directions_length = global_directions.length
|
||||
global_directions_dt = ['tl', 't', 'tr', 'r', 'br', 'b', 'bl', 'l']
|
||||
global_directions_dt_length = global_directions.length
|
||||
global_options = ['minimize', 'maximize', 'close']
|
||||
hiding_drops = false
|
||||
posis = {}
|
||||
wnds = new Array()
|
||||
|
||||
x = 0
|
||||
y = 0
|
||||
moving_window = -1
|
||||
adjusting_window = -1
|
||||
adjusting_dir = -1
|
||||
start_x = -1
|
||||
start_y = -1
|
||||
diff_x = 0
|
||||
diff_y = 0
|
||||
|
||||
width_min = 150
|
||||
height_min = 100
|
||||
|
||||
abs_scroller_width = 10
|
||||
appbox_padding = 2
|
||||
appbox_margin = 2
|
||||
appbox_border = 1
|
||||
abs_scrolled = 0
|
||||
|
||||
theme_set = false
|
||||
|
||||
// Ew
|
||||
if (navigator.appName == 'Microsoft Internet Explorer') ie = true
|
||||
else ie = false
|
||||
|
||||
|
||||
/* Prepares fixing a highligthing problem that occurs whenever
|
||||
you've moved or adjusted a window. */
|
||||
highlightfix = document.createElement('textarea')
|
||||
highlightfix.className = 'highlightfix'
|
||||
highlightfix.value = 'fix'
|
||||
wrapper.appendChild(highlightfix)
|
||||
|
||||
// Extra security for some elements that just don't exist
|
||||
fallback = document.createElement('div')
|
||||
|
||||
|
||||
// navi = navigation bar = navbar. Here 2 are created.
|
||||
navi = []
|
||||
navi[0] = new navbar([[0, ''], -1, -1, [0, '']])
|
||||
navi[1] = new navbar([-1, -1, [0, ''], [0, '']])
|
||||
|
||||
// Where to put different stuff..
|
||||
navi[0].support('dropdowns')
|
||||
navi[0].support('clock')
|
||||
navi[1].support('appboxes')
|
||||
|
||||
// ..and actually putting it there
|
||||
navi[posis['dropdowns']].box('dropdowns', 'left')
|
||||
navi[posis['clock']].box('clock')
|
||||
navi[posis['appboxes']].box('appboxes', 'left')
|
||||
navi[posis['appboxes']].box('abs_scroller')
|
||||
|
||||
|
||||
|
||||
/* Create dropdown menus. You can change the way a window opens
|
||||
by writing a "#" after the title, followed by your variables */
|
||||
|
||||
navi[posis['dropdowns']].drop('Programs', [
|
||||
['Math', [
|
||||
'Calculator'
|
||||
]],
|
||||
['Office', [
|
||||
'Notes#true,-1,-1,400,400,w-405,sh-405'
|
||||
]]
|
||||
])
|
||||
|
||||
navi[posis['dropdowns']].drop('Algo', [
|
||||
'About',
|
||||
'Help',
|
||||
])
|
||||
|
||||
navi[posis['dropdowns']].drop('Test', [
|
||||
'A',
|
||||
['B', [
|
||||
'C',
|
||||
'D',
|
||||
['E', [
|
||||
['F', [
|
||||
'G',
|
||||
'H'
|
||||
]]
|
||||
]],
|
||||
'I'
|
||||
]]
|
||||
])
|
||||
|
||||
// Create the screen area (the area on which the windows can move freely)
|
||||
scr = new screen()
|
||||
scr.wh()
|
||||
|
||||
// Event actions
|
||||
document.onmousemove = scr.set_coor
|
||||
|
||||
window.onresize = function() {
|
||||
scr.update()
|
||||
for (var i = 0; i < scr.len; i++) {
|
||||
if (!wnds[i].normal) {
|
||||
scr.wh()
|
||||
wnds[i].width = w + scr.margin_g * 2
|
||||
wnds[i].height = sh + scr.margin_g
|
||||
wnds[i].update()
|
||||
}
|
||||
}
|
||||
// Check if scrollbars are needed to make all appboxes visible
|
||||
navi[posis['appboxes']].check_abs_height(false)
|
||||
}
|
||||
|
||||
document.onmouseup = function() {
|
||||
// End various stuff
|
||||
if (moving_window > -1)
|
||||
scr.move_end()
|
||||
if (adjusting_window > -1)
|
||||
scr.adjust_end()
|
||||
}
|
||||
|
||||
// Set the theme (will default to the default if you specify an unexisting theme)
|
||||
settheme('Default')
|
||||
}
|
||||
407
subsites/projects/algo/js/scr_window.js
Normal file
@@ -0,0 +1,407 @@
|
||||
/*
|
||||
Algo: a dekstop environment look-a-like in your web browser
|
||||
Copyright (C) 2009 Niels Serup
|
||||
|
||||
This file is part of Algo.
|
||||
|
||||
Algo 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.
|
||||
|
||||
Algo 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 Algo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is the scr_window class. It takes care of creating windows and
|
||||
editing windows. When a window has been created, it can be minimized,
|
||||
maximized and closed by the prototype functions of this class.
|
||||
*/
|
||||
function scr_window(title, icon, state, options, width, height, xpos, ypos, resizeable) {
|
||||
if (title == undefined) return // The title is the identifier - a must
|
||||
if (icon == undefined) var icon = false // Defaults to no icon
|
||||
if (state == undefined || state == -1) var state = 1 // 0 = minimized, 1 = normal, 2 = maximized
|
||||
if (options == undefined || options == -1) var options = [1, 1, 1] // Both minimizable, maximizeable and closeable
|
||||
if (width == undefined || width == -1) var width = 500 // Default width
|
||||
if (height == undefined || height == -1) var height = 350 // Default height
|
||||
if (xpos == undefined || xpos == -1) var xpos = (w - width) / 2 // Places it center
|
||||
if (ypos == undefined || ypos == -1) var ypos = (sh - height) / 2 // Places it in the middle
|
||||
if (resizeable == undefined || resizeable == -1) var resizeable = true // Resizable as default
|
||||
|
||||
if (width < width_min) width = width_min // Limits
|
||||
if (height < height_min) height = height_min // Limits
|
||||
|
||||
// Uniqueifyes the variables
|
||||
this.title = title
|
||||
this.icon = icon
|
||||
this.options = options
|
||||
this.width = width
|
||||
this.height = height
|
||||
this.resizeable = resizeable
|
||||
|
||||
/* Creates two unique numbers. "num" will change if a window opened before
|
||||
this window is closed, while onum will never change */
|
||||
this.num = scr.len
|
||||
this.onum = scr.olen
|
||||
|
||||
// Creates the appbox in the appbox navbar
|
||||
this.appbox = document.createElement('div')
|
||||
this.appbox.rel = wnds.length // Accesible by JavaScript
|
||||
this.appbox.onclick = function() {
|
||||
// Minimize if visible and current
|
||||
// Change focus if visible but not current
|
||||
// Unminimize if not visible (the "un"-part happens automatically)
|
||||
if (wnds[this.rel].visible) {
|
||||
if (wnds[this.rel].appbox.className == 'current')
|
||||
wnds[this.rel].minimize(this.rel)
|
||||
else
|
||||
scr.change_focus(this.rel)
|
||||
}
|
||||
else
|
||||
wnds[this.rel].minimize(this.rel)
|
||||
|
||||
}
|
||||
this.appbox.innerHTML = title
|
||||
// Appending it
|
||||
navi[posis['appboxes']].appboxes.appendChild(this.appbox)
|
||||
|
||||
|
||||
/* The following code creates all the neccesary elements for a window to
|
||||
exist. It's fairly straight-forward, but it takes up a lot of space */
|
||||
var elems, belems, el, tmp, i, c
|
||||
this.elem = document.createElement('div')
|
||||
this.elem.className = 'window'
|
||||
|
||||
el = 13 // The number of elements to be created
|
||||
if (icon) el++
|
||||
|
||||
tmp = 0
|
||||
if (options[0]) tmp++
|
||||
if (options[1]) tmp++
|
||||
if (options[2]) tmp++
|
||||
this.optboxes = tmp
|
||||
|
||||
if (tmp > 0) el++
|
||||
elems = new Array(el)
|
||||
belems = new Array(tmp)
|
||||
|
||||
// Borders
|
||||
for (i = 0; i < 8; i++) {
|
||||
elems[i] = document.createElement('div')
|
||||
elems[i].className = global_directions_dt[i]
|
||||
if (i != 1) {
|
||||
if (resizeable) {
|
||||
elems[i].rel = i + ''
|
||||
elems[i].onmousedown = function() {
|
||||
if (wnds[this.parentNode.rel].normal)
|
||||
scr.adjust_start(this.parentNode.rel, this.rel)
|
||||
}
|
||||
elems[i].onmouseup = function() {
|
||||
scr.adjust_end()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Title + text + icon + options
|
||||
elems[8] = document.createElement('div')
|
||||
elems[8].className = 'title'
|
||||
elems[8].innerHTML = this.title
|
||||
|
||||
elems[9] = document.createElement('div')
|
||||
elems[9].className = 'handle'
|
||||
elems[9].onmousedown = function() {
|
||||
if (wnds[this.parentNode.rel * 1].normal) {
|
||||
scr.move_start(this.parentNode.rel * 1)
|
||||
}
|
||||
}
|
||||
elems[9].onmouseup = function() {
|
||||
scr.move_end()
|
||||
}
|
||||
elems[9].ondblclick = function() {
|
||||
wnds[this.parentNode.rel * 1].maximize()
|
||||
}
|
||||
|
||||
elems[10] = document.createElement('div')
|
||||
elems[10].className = 'resize_handle'
|
||||
if (resizeable) {
|
||||
elems[10].rel = '1'
|
||||
elems[10].onmousedown = function() {
|
||||
if (wnds[this.parentNode.rel * 1].normal)
|
||||
scr.adjust_start(this.parentNode.rel * 1, this.rel * 1)
|
||||
}
|
||||
elems[10].onmouseup = function() {
|
||||
scr.adjust_end()
|
||||
}
|
||||
}
|
||||
else
|
||||
this.elem.className += ' nrsz' // Seen by a css file
|
||||
if (!ie) {
|
||||
elems[11] = document.createElement('object')
|
||||
elems[11].data = 'pages/links.php?title=' + escape(title) + '&num=' + this.onum
|
||||
elems[11].type = 'text/html'
|
||||
}
|
||||
else {
|
||||
elems[11] = document.createElement('iframe')
|
||||
elems[11].src = 'pages/links.php?title=' + escape(title) + '&num=' + this.onum
|
||||
elems[11].frameBorder = '0'
|
||||
}
|
||||
elems[11].className = 'data'
|
||||
|
||||
elems[12] = document.createElement('div')
|
||||
elems[12].className = 'data_overlay'
|
||||
|
||||
if (icon) {
|
||||
elems[13] = document.createElement('div')
|
||||
elems[13].className = 'icon'
|
||||
elems[13].style.backgroundImage = 'url(\'pages/links.php?title=' + escape(title) + '&type=png\')'
|
||||
}
|
||||
|
||||
if (this.optboxes > 0) {
|
||||
// If any options at all
|
||||
tmp = elems.length - 1
|
||||
elems[tmp] = document.createElement('div')
|
||||
elems[tmp].className ='options'
|
||||
|
||||
c = 0
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (options[i]) {
|
||||
belems[i] = document.createElement('div')
|
||||
belems[i].className = global_options[i] // Refer to onload.js
|
||||
if (global_options[i] == 'minimize') belems[i].onclick = function() {
|
||||
wnds[this.parentNode.parentNode.rel * 1].minimize()
|
||||
}
|
||||
else if (global_options[i] == 'maximize') belems[i].onclick = function() {
|
||||
wnds[this.parentNode.parentNode.rel * 1].maximize()
|
||||
}
|
||||
else belems[i].onclick = function() {
|
||||
wnds[this.parentNode.parentNode.rel * 1].close()
|
||||
}
|
||||
elems[tmp].appendChild(belems[i])
|
||||
c++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All clickable elements need elem.rel to determine what window to change
|
||||
this.elem.rel = wnds.length
|
||||
|
||||
this.elem.onmousedown = function() {
|
||||
scr.change_focus(this.rel * 1)
|
||||
}
|
||||
|
||||
this.elem.style.left= xpos + 'px'
|
||||
this.elem.style.top = ypos + 'px'
|
||||
|
||||
for (i = 0; i < el; i++) {
|
||||
// Append all created elements
|
||||
this.elem.appendChild(elems[i])
|
||||
}
|
||||
this.len = this.elem.childNodes.length
|
||||
|
||||
scr.elem.appendChild(this.elem)
|
||||
|
||||
this.visible = true
|
||||
this.normal = true
|
||||
if (state == 0) this.minimize()
|
||||
|
||||
this.update() // Adjust widths, heights, etc.
|
||||
this.update_appbox() // The same with the appbox
|
||||
|
||||
if (state == 2) this.maximize()
|
||||
}
|
||||
|
||||
scr_window.prototype.update = function() {
|
||||
/* This function updates the dimensions of the subelements of a window.
|
||||
scr holds standard information such as the general margin, while the
|
||||
window itself has some info about width, height, icons, etc. */
|
||||
var tmp, el
|
||||
|
||||
el = this.cn('tl')
|
||||
el.style.width = scr.margin_g + 'px' // margin_g is the general margin
|
||||
el.style.height = scr.hheight + 'px' // hheight is the header height
|
||||
|
||||
el = this.cn('t')
|
||||
el.style.left = scr.margin_g + 'px'
|
||||
el.style.width = this.width - scr.margin_g * 2 + 'px'
|
||||
el.style.height = scr.hheight + 'px'
|
||||
|
||||
el = this.cn('tr')
|
||||
el.style.left = this.width - scr.margin_g + 'px'
|
||||
el.style.width = scr.margin_g + 'px'
|
||||
el.style.height = scr.hheight + 'px'
|
||||
|
||||
el = this.cn('r')
|
||||
el.style.top = scr.hheight + 'px'
|
||||
el.style.left = this.width - scr.margin_g + 'px'
|
||||
el.style.width = scr.margin_g + 'px'
|
||||
el.style.height = this.height - scr.hheight - scr.margin_g + 'px'
|
||||
|
||||
el = this.cn('br')
|
||||
el.style.top = this.height - scr.margin_g + 'px'
|
||||
el.style.left = this.width - scr.margin_g + 'px'
|
||||
el.style.width = scr.margin_g + 'px'
|
||||
el.style.height = scr.margin_g + 'px'
|
||||
|
||||
el = this.cn('b')
|
||||
el.style.top = this.height - scr.margin_g + 'px'
|
||||
el.style.left = scr.margin_g + 'px'
|
||||
el.style.width = this.width - scr.margin_g * 2 + 'px'
|
||||
el.style.height = scr.margin_g + 'px'
|
||||
|
||||
el = this.cn('bl')
|
||||
el.style.top = this.height - scr.margin_g + 'px'
|
||||
el.style.width = scr.margin_g + 'px'
|
||||
el.style.height = scr.margin_g + 'px'
|
||||
|
||||
el = this.cn('l')
|
||||
el.style.top = scr.hheight + 'px'
|
||||
el.style.width = scr.margin_g + 'px'
|
||||
el.style.height = this.height - scr.hheight - scr.margin_g + 'px'
|
||||
|
||||
el = this.cn('title')
|
||||
el.style.top = scr.margin_g + 'px'
|
||||
el.style.height = scr.hheight - scr.margin_g + 'px'
|
||||
if (this.icon) tmp = scr.bw + scr.margin_t
|
||||
else tmp = 0
|
||||
el.style.left = scr.margin_g + scr.margin_t + tmp + 'px'
|
||||
el.style.width = this.width - scr.margin_g * 2 - scr.margin_t * 2 - this.optboxes * (scr.bw + scr.margin_t) - tmp + 'px'
|
||||
|
||||
el = this.cn('handle')
|
||||
el.style.top = scr.margin_g + 'px'
|
||||
el.style.height = scr.hheight - scr.margin_g + 'px'
|
||||
el.style.left = scr.margin_g + scr.bw + scr.margin_t + 'px'
|
||||
el.style.width = this.width - scr.margin_g * 2 - this.optboxes * (scr.bw + scr.margin_t) - tmp + 'px'
|
||||
|
||||
el = this.cn('resize_handle')
|
||||
el.style.left = scr.margin_g + 'px'
|
||||
el.style.width = this.width - scr.margin_g * 2 + 'px'
|
||||
el.style.height = scr.margin_g + 'px'
|
||||
|
||||
el = this.cn('data')
|
||||
el.style.top = scr.hheight + 'px'
|
||||
el.style.left = scr.margin_g + 'px'
|
||||
el.style.width = this.width - scr.margin_g * 2 + 'px'
|
||||
el.style.height = this.height - scr.hheight - scr.margin_g + 'px'
|
||||
|
||||
el = this.cn('data_overlay')
|
||||
el.style.top = scr.hheight + 'px'
|
||||
el.style.left = scr.margin_g + 'px'
|
||||
el.style.width = this.width - scr.margin_g * 2 + 'px'
|
||||
el.style.height = this.height - scr.hheight - scr.margin_g + 'px'
|
||||
|
||||
if (this.icon) {
|
||||
el = this.cn('icon')
|
||||
el.style.top = scr.margin_g + 'px'
|
||||
el.style.left = scr.margin_g + scr.margin_t + 'px'
|
||||
el.style.width = scr.bw + 'px' // bw is the box width
|
||||
el.style.height = scr.bh + 'px' // bh is the box height
|
||||
}
|
||||
|
||||
el = this.cn('options')
|
||||
if (el) {
|
||||
el.style.top = scr.margin_g + 'px'
|
||||
el.style.left = this.width - this.optboxes * (scr.bw + scr.margin_t) - scr.margin_g + 'px'
|
||||
el.style.width = this.optboxes * (scr.bw + scr.margin_t) - scr.margin_t + 'px' // margin_t is the margin used in the top of the window
|
||||
el.style.height = scr.bh + 'px'
|
||||
|
||||
var elc = el.childNodes
|
||||
var elcl = elc.length
|
||||
for (var i = 0; i < elcl; i++) {
|
||||
elc[i].style.left = i * (scr.bw + scr.margin_t) + 'px'
|
||||
elc[i].style.width = scr.bw + 'px'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scr_window.prototype.update_appbox = function() {
|
||||
this.appbox.style.height = navi[posis['appboxes']].height - appbox_padding * 2 - appbox_margin * 2 - appbox_border * 2 + 'px'
|
||||
}
|
||||
|
||||
scr_window.prototype.cn = function(what) {
|
||||
/* This function is a smart one. It returns a pointer to the node which
|
||||
has the class specified by "what". If it's not found, the returned node
|
||||
is "fallback", which does nothing but at the same time makes sure no
|
||||
errors pop up. */
|
||||
var i = 0
|
||||
var ok = false
|
||||
var nodes = this.elem.childNodes
|
||||
var node = fallback
|
||||
while (i < this.len && !ok) {
|
||||
if (nodes[i].className == what) {
|
||||
node = nodes[i]
|
||||
ok = true
|
||||
}
|
||||
i++
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
scr_window.prototype.settitle = function(title) {
|
||||
// Sets the title of the window and the appbox associated with the window
|
||||
this.cn('title').innerHTML = title
|
||||
this.appbox.innerHTML = title
|
||||
}
|
||||
|
||||
scr_window.prototype.minimize = function() {
|
||||
/*
|
||||
Minimizes if visible
|
||||
Unminimizes if not visible
|
||||
*/
|
||||
if (this.visible) {
|
||||
this.visible = false
|
||||
this.elem.style.display = 'none'
|
||||
scr.change_focus(this.num, 1)
|
||||
}
|
||||
else {
|
||||
this.visible = true
|
||||
this.elem.style.display = 'block'
|
||||
scr.change_focus(this.num)
|
||||
}
|
||||
}
|
||||
|
||||
scr_window.prototype.maximize = function() {
|
||||
/*
|
||||
Maximizes if normal
|
||||
Unmaximizes if already maximized
|
||||
*/
|
||||
if (this.normal) {
|
||||
this.normal = false
|
||||
this.savedpos = [this.elem.offsetLeft, this.elem.offsetTop, this.width, this.height]
|
||||
this.elem.style.left = -scr.margin_g + 'px'
|
||||
this.elem.style.top = 0
|
||||
this.width = w + scr.margin_g * 2
|
||||
this.height = sh + scr.margin_g
|
||||
this.elem.className = 'window window_max'
|
||||
}
|
||||
else {
|
||||
this.normal = true
|
||||
this.elem.style.left = this.savedpos[0] + 'px'
|
||||
this.elem.style.top = this.savedpos[1] + 'px'
|
||||
this.width = this.savedpos[2]
|
||||
this.height = this.savedpos[3]
|
||||
this.elem.className = 'window'
|
||||
if (!this.resizeable) this.elem.className += ' nrsz'
|
||||
}
|
||||
this.update()
|
||||
}
|
||||
|
||||
scr_window.prototype.close = function() {
|
||||
// Changes focus with det set to 2, which in turn removes the element
|
||||
scr.change_focus(this.num, 2)
|
||||
}
|
||||
|
||||
scr_window.prototype.renum = function(n) {
|
||||
/* This function changes the "num" variable and the attributes that use it.
|
||||
The "num" variable will in some cases have to be changed when a window
|
||||
closes. */
|
||||
this.num += n
|
||||
this.elem.rel = this.num
|
||||
this.appbox.rel = this.num
|
||||
}
|
||||
365
subsites/projects/algo/js/screen.js
Normal file
@@ -0,0 +1,365 @@
|
||||
/*
|
||||
Algo: a dekstop environment look-a-like in your web browser
|
||||
Copyright (C) 2009 Niels Serup
|
||||
|
||||
This file is part of Algo.
|
||||
|
||||
Algo 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.
|
||||
|
||||
Algo 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 Algo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
The screen class creates the screen on which all the windows appear.
|
||||
As a matter of fact, the screen class simply serves as a layer for adding
|
||||
windows. That's all. */
|
||||
function screen() {
|
||||
this.elem = document.createElement('div')
|
||||
this.elem.className = 'area'
|
||||
this.elem.style.width = '100%' // Height determined by JavaScript later on
|
||||
wrapper.appendChild(this.elem)
|
||||
|
||||
/* len and olen dynamically increases as new windows are opened. But while
|
||||
len is decreased when windows are closed, olen is never decreases. This
|
||||
proves helpful when the windows in objects/iframes must be able to access
|
||||
their own windows. */
|
||||
this.len = 0
|
||||
this.olen = 0
|
||||
/* wndpos holds information about the windows on the screen. Each wndpos
|
||||
entry is a link to a scr_window class. wndpos keeps the links in their
|
||||
index order. */
|
||||
this.wndpos = new Array()
|
||||
|
||||
/* It is neccessary to create an overlay, as the window objects/iframes will
|
||||
catch focus if the mouse is moved over them. The overlay is on whenever a
|
||||
window is being moved or adjusted */
|
||||
this.overlay = document.createElement('div')
|
||||
this.overlay.className = 'overlay'
|
||||
this.elem.appendChild(this.overlay)
|
||||
}
|
||||
|
||||
screen.prototype.rethink = function() {
|
||||
// rethink() reorganises the screen top and height based on the navbars.
|
||||
var navil = navi.length
|
||||
var mh, th, borders, bl, border
|
||||
mh = 0
|
||||
th = 0
|
||||
/* The following loop uses the height and the border height of the navbars
|
||||
to compute the space on which the screen should be positioned. */
|
||||
for (var i = 0; i < navil; i++) {
|
||||
border = 0
|
||||
borders = navi[i].border
|
||||
bl = borders.length
|
||||
for (var ii = 0; ii < bl; ii += 2) {
|
||||
border += borders[ii]
|
||||
}
|
||||
mh += navi[i].height
|
||||
if (navi[i].pos[0] != -1)
|
||||
th += navi[i].height + border
|
||||
if (navi[i].pos[0] != -1 || navi[i].pos[2] != -1)
|
||||
mh += border
|
||||
}
|
||||
// bi = the heights of the navbars plus the border heights of the navbars
|
||||
this.bi = mh
|
||||
this.elem.style.top = th + 'px'
|
||||
}
|
||||
|
||||
screen.prototype.update = function() {
|
||||
// Updates width and height and adjusts the height
|
||||
this.wh()
|
||||
this.elem.style.height = sh + 'px'
|
||||
}
|
||||
|
||||
screen.prototype.wh = function() {
|
||||
// Get screen width and height
|
||||
if (self.innerHeight) {
|
||||
h = self.innerHeight
|
||||
w = self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h = document.documentElement.clientHeight
|
||||
w = document.documentElement.clientWidth
|
||||
}
|
||||
else if (document.body) {
|
||||
h = document.body.clientHeight
|
||||
w = document.body.clientWidth
|
||||
}
|
||||
|
||||
// sh = screen height - navbars heights. The height of the screen area is sh
|
||||
sh = h - this.bi
|
||||
}
|
||||
|
||||
screen.prototype.change_focus = function(num, det) {
|
||||
/* This function changes focus to the window specified in "num". "det" is a
|
||||
special identifier that tells this function what to do. Or whatever. */
|
||||
if (det == undefined) var det = 0
|
||||
|
||||
var num = num * 1
|
||||
for (var i = 0; i < this.len; i++) {
|
||||
// Delete link from the wndpos list
|
||||
if (this.wndpos[i] == num) this.wndpos.splice(i, 1)
|
||||
}
|
||||
/*
|
||||
if det == 0: add window to front
|
||||
if det == 1: add window to back
|
||||
if det == 2: remove and close window
|
||||
*/
|
||||
if (det == 0)
|
||||
this.wndpos.splice(0, 0, num)
|
||||
else if (det == 1)
|
||||
this.wndpos.splice(this.len, this.len, num)
|
||||
else if (det == 2) {
|
||||
this.len--
|
||||
this.elem.removeChild(wnds[num].elem)
|
||||
navi[posis['appboxes']].appboxes.removeChild(wnds[num].appbox)
|
||||
|
||||
for (i = 0; i < this.len; i++) {
|
||||
if (this.wndpos[i] > num) {
|
||||
wnds[this.wndpos[i]].renum(-1) // Readjust windows with a higher index
|
||||
this.wndpos[i]--
|
||||
}
|
||||
}
|
||||
|
||||
// Different actions based on different variables
|
||||
if (moving_window > num) moving_window--
|
||||
else if (moving_window == num) this.move_end()
|
||||
|
||||
if (adjusting_window > num) adjusting_window--
|
||||
else if (adjusting_window == num) this.adjust_end()
|
||||
|
||||
delete wnds[num]
|
||||
wnds.splice(num, 1)
|
||||
|
||||
}
|
||||
// This function has no done anything visually. setindex takes care of that.
|
||||
this.setindex()
|
||||
}
|
||||
|
||||
screen.prototype.setindex = function() {
|
||||
/* This function writes any changes made in the classes in the wndpos to the
|
||||
screen. If focus has changed from one window to another, setindex makes
|
||||
the user see that. */
|
||||
for (var i = 1; i < this.len; i++) {
|
||||
wnds[this.wndpos[i]].elem.style.zIndex = this.len - i + 1
|
||||
wnds[this.wndpos[i]].elem.id = ''
|
||||
wnds[this.wndpos[i]].appbox.className = ''
|
||||
}
|
||||
if (this.len > 0) {
|
||||
// The first window in the hierarchy gets the focus
|
||||
wnds[this.wndpos[0]].elem.style.zIndex = this.len + 2
|
||||
wnds[this.wndpos[0]].elem.id = 'active'
|
||||
wnds[this.wndpos[0]].appbox.className = ''
|
||||
this.overlay.style.zIndex = this.len + 1
|
||||
}
|
||||
|
||||
// vis will turn true if any window is visible
|
||||
var vis = false
|
||||
for (i = 0; i < this.len; i++) {
|
||||
if (wnds[i].visible) vis = true
|
||||
}
|
||||
// Only make the current window current if at least one window is visible
|
||||
if (vis) wnds[this.wndpos[0]].appbox.className = 'current'
|
||||
|
||||
// Check if there's enough space for the appboxes
|
||||
navi[posis['appboxes']].check_abs_height(true)
|
||||
}
|
||||
|
||||
screen.prototype.set_overlay = function() {
|
||||
this.overlay.style.display = 'block'
|
||||
}
|
||||
|
||||
screen.prototype.del_overlay = function() {
|
||||
this.overlay.style.display = 'none'
|
||||
}
|
||||
|
||||
screen.prototype.move_start = function(what) {
|
||||
/* "move_start" sets the global value "moving_window" to the active window
|
||||
and thereby makes it recognisable by the set_coor function. */
|
||||
moving_window = what * 1
|
||||
|
||||
/* The overlays are needed to keep the objects/iframes from getting the
|
||||
mouse focus. In theory this should not happen, but as the mouse is often
|
||||
moved faster than the window, this happens.
|
||||
There are two overlays: one that covers the window and on that covers the
|
||||
other windows. */
|
||||
wnds[moving_window].cn('data_overlay').style.display = 'block'
|
||||
this.set_overlay()
|
||||
|
||||
// These are needed later on to determine the position of the window.
|
||||
diff_x = x - wnds[moving_window].elem.offsetLeft
|
||||
diff_y = y - wnds[moving_window].elem.offsetTop
|
||||
}
|
||||
|
||||
screen.prototype.move_end = function() {
|
||||
if (moving_window > -1)
|
||||
wnds[moving_window].cn('data_overlay').style.display = 'none'
|
||||
moving_window = -1
|
||||
this.blurfocus()
|
||||
}
|
||||
|
||||
screen.prototype.adjust_start = function(what, dir) {
|
||||
/* This is the same as "move_start" except that this does not start moving
|
||||
the window, but instead it starts adjusting (resizing) it. */
|
||||
adjusting_window = what * 1
|
||||
adjusting_dir = dir * 1
|
||||
wnds[adjusting_window].cn('data_overlay').style.display = 'block'
|
||||
this.set_overlay()
|
||||
|
||||
// Different variables are set depending on the direction of the adjusting.
|
||||
/*
|
||||
The directions are:
|
||||
0: top-left
|
||||
1: top
|
||||
2: top-right
|
||||
3: right
|
||||
4: bottom-right
|
||||
5: bottom
|
||||
6: bottom-left
|
||||
7: left
|
||||
|
||||
If the resize direction is diagonal, both of the below options are true.
|
||||
*/
|
||||
if (adjusting_dir != 1 && adjusting_dir != 5) {
|
||||
// If vertical
|
||||
start_x = x
|
||||
start_w = wnds[adjusting_window].width
|
||||
diff_x = start_x - wnds[adjusting_window].elem.offsetLeft
|
||||
}
|
||||
if (adjusting_dir != 3 && adjusting_dir != 7) {
|
||||
// If horizontal
|
||||
start_y = y
|
||||
start_h = wnds[adjusting_window].height
|
||||
diff_y = start_y - wnds[adjusting_window].elem.offsetTop
|
||||
}
|
||||
}
|
||||
|
||||
screen.prototype.adjust_end = function() {
|
||||
if (adjusting_window > -1)
|
||||
wnds[adjusting_window].cn('data_overlay').style.display = 'none'
|
||||
adjusting_window = -1
|
||||
adjusting_dir = -1
|
||||
this.blurfocus()
|
||||
}
|
||||
|
||||
screen.prototype.blurfocus = function() {
|
||||
// Hides the overlay and applies the fix
|
||||
this.del_overlay()
|
||||
highlightfix.focus()
|
||||
highlightfix.select()
|
||||
}
|
||||
|
||||
screen.prototype.setwindow = function(a, b, c, d, e, f, g, h, i, j, k, l, m, n) {
|
||||
// This function is the one that must be called when creating a new window.
|
||||
wnds[wnds.length] = new scr_window(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
|
||||
|
||||
// Positions itself at the front
|
||||
this.wndpos.splice(0, 0, this.len)
|
||||
this.len++
|
||||
this.olen++
|
||||
this.setindex()
|
||||
}
|
||||
|
||||
screen.prototype.move_window = function() {
|
||||
// Moves the window based on current and earlier set variables
|
||||
var cx = x - diff_x
|
||||
if (cx < -diff_x) cx = -diff_x
|
||||
else if (cx > w - diff_x) cx = w - diff_x
|
||||
var cy = y - diff_y
|
||||
if (cy < 0) cy = 0
|
||||
else if (cy > sh - scr.hheight) cy = sh - scr.hheight
|
||||
if (scr.len > moving_window) {
|
||||
wnds[moving_window].elem.style.left = cx + 'px'
|
||||
wnds[moving_window].elem.style.top = cy + 'px'
|
||||
}
|
||||
}
|
||||
|
||||
screen.prototype.adjust_window = function() {
|
||||
// Adjusts the window based on current and earlier set variables
|
||||
|
||||
// This function uses the same direction principle as "adjust_start".
|
||||
if (adjusting_dir != 1 && adjusting_dir != 5) {
|
||||
var cx, cw, cxs
|
||||
cxs = false
|
||||
if (adjusting_dir == 0 || adjusting_dir == 6 || adjusting_dir == 7) {
|
||||
// If to the left
|
||||
cx = x - diff_x
|
||||
cw = start_w + start_x - x
|
||||
if (x - diff_x < 0) {
|
||||
cx = 0
|
||||
cxs = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If to the right
|
||||
cx = start_x - start_w + start_w - diff_x
|
||||
cw = start_w + x - start_x
|
||||
if (x + start_w - diff_x > w) cxs = true
|
||||
}
|
||||
|
||||
if (cw < width_min) cxs = true
|
||||
|
||||
if (!cxs && scr.len > adjusting_window) {
|
||||
wnds[adjusting_window].elem.style.left = cx + 'px'
|
||||
wnds[adjusting_window].width = cw
|
||||
}
|
||||
}
|
||||
|
||||
if (adjusting_dir != 3 && adjusting_dir != 7) {
|
||||
var cy, ch, cys
|
||||
cys = false
|
||||
if (adjusting_dir == 0 || adjusting_dir == 1 || adjusting_dir == 2) {
|
||||
// If upwards
|
||||
cy = y - diff_y
|
||||
ch = start_h + start_y - y
|
||||
if (y - diff_y < 0) {
|
||||
cy = 0
|
||||
cys = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If downwards
|
||||
cy = start_y - start_y + start_y - diff_y
|
||||
ch = start_h + y - start_y
|
||||
if (y + start_h - diff_y > sh) cys = true
|
||||
}
|
||||
|
||||
if (ch < height_min) cys = true
|
||||
|
||||
if (!cys && scr.len > adjusting_window) {
|
||||
wnds[adjusting_window].elem.style.top = cy + 'px'
|
||||
wnds[adjusting_window].height = ch
|
||||
}
|
||||
}
|
||||
|
||||
// Update the window position
|
||||
wnds[adjusting_window].update()
|
||||
}
|
||||
|
||||
screen.prototype.set_coor = function(e) {
|
||||
/* This function sets the global coordinates of the screen. If a window
|
||||
is eiher being moved or adjusted, this function calls the "move_window"
|
||||
or "adjust_window" functions */
|
||||
if (!e) var e = window.event
|
||||
if (e.pageX || e.pageY) {
|
||||
x = e.pageX
|
||||
y = e.pageY
|
||||
}
|
||||
else if (e.clientX || e.clientY) {
|
||||
x = e.clientX + document.body.scrollLeft
|
||||
y = e.clientY + document.body.scrollTop
|
||||
}
|
||||
|
||||
if (moving_window != -1)
|
||||
scr.move_window()
|
||||
else if (adjusting_window != -1)
|
||||
scr.adjust_window()
|
||||
}
|
||||
66
subsites/projects/algo/js/themes.js
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Algo: a dekstop environment look-a-like in your web browser
|
||||
Copyright (C) 2009 Niels Serup
|
||||
|
||||
This file is part of Algo.
|
||||
|
||||
Algo 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.
|
||||
|
||||
Algo 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 Algo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is the themes file. The two functions in this file manage loading
|
||||
themes and changing object properties
|
||||
*/
|
||||
function settheme(what) {
|
||||
/* Sets the url of the themes css file. In this case it links to a PHP file
|
||||
that has an index of names and urls. */
|
||||
theme.href = 'themes/links.php?title=' + what + '&type=css' + '&r=' + Math.random()
|
||||
|
||||
var http = new httpobj() // Creates a new httpobj object
|
||||
http.url = 'themes/links.php' // Sets the url
|
||||
http.method = 'get' // Sets the method
|
||||
http.param['title'] = what // Sets the title
|
||||
http.param['type'] = 'js' // Sets the type
|
||||
http.param['r'] = Math.random() // Fix for i.e. IE (maybe other browsers too)
|
||||
http.func = "themevars(text)" // Will pass received text to that function
|
||||
http.send() // Sends it
|
||||
}
|
||||
|
||||
function themevars(vars) {
|
||||
// This function updates everything possible updating.
|
||||
eval(vars) // Execute the string
|
||||
|
||||
for (var i = 0; i < navi.length; i++) {
|
||||
navi[i].update()
|
||||
}
|
||||
|
||||
// Reshow everything
|
||||
scr.rethink()
|
||||
scr.update()
|
||||
|
||||
for (var i = 0; i < scr.len; i++) {
|
||||
wnds[i].update()
|
||||
wnds[i].update_appbox()
|
||||
}
|
||||
|
||||
// Some browsers are a bit slow, so waiting half a second or so is smart.
|
||||
setTimeout("wrapper.style.display = 'block'", 500)
|
||||
setTimeout("navi[posis['appboxes']].check_abs_height(false)", 1000)
|
||||
|
||||
if (!theme_set) {
|
||||
theme_set = true
|
||||
// Open a small welcome window
|
||||
setTimeout("scr.setwindow('Welcome', true, -1, -1, 300, 200)", 1000)
|
||||
}
|
||||
}
|
||||
17
subsites/projects/algo/pages/about.htm
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<title></title>
|
||||
<link href='pages.css' type='text/css' rel='stylesheet' />
|
||||
<script type='text/javascript' src='pages.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<p class='header'>About Algo</p>
|
||||
<p>Algo started development in March 2009 and took about a week to complete. Back then the name of Algo was "Algohol". Algohol was a project that aimed towards making math, physics and chemistry help freely available online in a new and different way. Consisting of a group with four students, we agreed that a desktop environment type website would be the way for us to present our info. The technical part of Algohol went fine, but we never did get to writing the actual content. <a href='http://algohol.org/'>Algohol</a> is still online, but it doesn't serve much purpose.</p>
|
||||
<p>The source code of Algo is <a href='http://www.gnu.org/licenses/gpl.html' target='_parent'>GPLv3'ed</a>.</p>
|
||||
<br />
|
||||
<h3>The action icons</h3>
|
||||
<img src='../themes/img/action_icons.png' />
|
||||
<p>The action icons, as seen above, are made by two of my classmates. I never got to asking them whether they wanted to be credited. Using them should be fine, though. For now I'll just release it under the CC-SA license.</p>
|
||||
</body>
|
||||
</html>
|
||||
382
subsites/projects/algo/pages/calc.htm
Normal file
@@ -0,0 +1,382 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<link href='pages.css' type='text/css' rel='stylesheet' />
|
||||
<style type='text/css'>
|
||||
* {
|
||||
color: #ddd;
|
||||
font: 12px 'dejavu sans mono';
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div {
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.result {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
textarea {
|
||||
float: left;
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript' src='pages.js'></script>
|
||||
|
||||
<script type='text/javascript'>
|
||||
/*
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
*/
|
||||
window.onload = function() {
|
||||
var is_firefox
|
||||
if (navigator.userAgent.indexOf('Firefox') != -1) is_firefox = true
|
||||
else is_firefox = false
|
||||
|
||||
input_margin_top = 0
|
||||
input_margin_right = 0
|
||||
input_margin_bottom = 0
|
||||
if (is_firefox) input_margin_left = -1
|
||||
else input_margin_left = 0
|
||||
|
||||
ans = 0
|
||||
|
||||
curr_input_start = document.createElement('div')
|
||||
curr_input_start.innerHTML = '>'
|
||||
document.body.appendChild(curr_input_start)
|
||||
|
||||
input_start_width = curr_input_start.scrollWidth
|
||||
input_start_height = curr_input_start.scrollHeight
|
||||
|
||||
curr_input = document.createElement('textarea')
|
||||
curr_input.onkeydown = function() {
|
||||
this.style.height = this.scrollHeight + 'px'
|
||||
}
|
||||
curr_input.onkeyup = function() {
|
||||
this.style.height = this.scrollHeight + 'px'
|
||||
}
|
||||
curr_input.style.marginTop = input_margin_top + 'px'
|
||||
curr_input.style.marginRight = input_margin_right + 'px'
|
||||
curr_input.style.marginBottom = input_margin_bottom + 'px'
|
||||
curr_input.style.marginLeft = input_margin_left + 'px'
|
||||
curr_input.style.width = getw() - input_start_width - input_margin_left - input_margin_right + 'px'
|
||||
curr_input.style.height = input_start_height + 'px'
|
||||
document.body.appendChild(curr_input)
|
||||
curr_input.focus()
|
||||
|
||||
continue_ok = true
|
||||
|
||||
window.onresize = function() {
|
||||
curr_input.style.width = getw() - input_start_width - input_margin_left - input_margin_right + 'px'
|
||||
setTimeout("curr_input.style.height = curr_input.scrollHeight + 'px'", 100)
|
||||
}
|
||||
|
||||
document.onkeydown = function(event) {
|
||||
if (!continue_ok) return
|
||||
var code = getcode(event)
|
||||
if (code == 13) {
|
||||
var input_value, caltxt, len, oresult, result, result_elem, nl_elem, replace_elem
|
||||
input_value = curr_input.value
|
||||
caltxt = process_all(input_value)
|
||||
|
||||
if (caltxt != '') {
|
||||
try {
|
||||
oresult = eval(caltxt)
|
||||
//parent.document.title = caltxt
|
||||
if (typeof(oresult) == 'number') result = (oresult + '') //.replace(/\./g, ',')
|
||||
else result = oresult
|
||||
|
||||
if (oresult == 'NaN') result = 'Error: Not a number'
|
||||
else if (oresult == 'Infinity') result = 'Error: Infinity'
|
||||
else ans = oresult
|
||||
}
|
||||
catch(e) {
|
||||
result = 'Error'
|
||||
}
|
||||
if (result.substr(0, 5) == 'Error') result += '<br />Type "help" for help.'
|
||||
}
|
||||
else {
|
||||
result = ''
|
||||
}
|
||||
|
||||
|
||||
nl_elem = document.createElement('br')
|
||||
document.body.appendChild(nl_elem)
|
||||
|
||||
if (result != '' && result != 'undefined') {
|
||||
result_elem = document.createElement('div')
|
||||
result_elem.className = 'result'
|
||||
result_elem.innerHTML = '>>>' + result
|
||||
document.body.appendChild(result_elem)
|
||||
}
|
||||
|
||||
replace_elem = document.createElement('div')
|
||||
replace_elem.innerHTML = '>' + input_value
|
||||
document.body.insertBefore(replace_elem, curr_input)
|
||||
document.body.removeChild(curr_input_start)
|
||||
document.body.removeChild(curr_input)
|
||||
|
||||
curr_input_start = document.createElement('div')
|
||||
curr_input_start.innerHTML = '>'
|
||||
document.body.appendChild(curr_input_start)
|
||||
|
||||
curr_input = document.createElement('textarea')
|
||||
curr_input.onkeydown = function() {
|
||||
this.style.height = this.scrollHeight + 'px'
|
||||
}
|
||||
curr_input.onkeyup = function() {
|
||||
this.style.height = this.scrollHeight + 'px'
|
||||
}
|
||||
curr_input.style.marginTop = input_margin_top + 'px'
|
||||
curr_input.style.marginRight = input_margin_right + 'px'
|
||||
curr_input.style.marginBottom = input_margin_bottom + 'px'
|
||||
curr_input.style.marginLeft = input_margin_left + 'px'
|
||||
curr_input.style.width = getw() - input_start_width - input_margin_left - input_margin_right + 'px'
|
||||
curr_input.style.height = input_start_height + 'px'
|
||||
|
||||
window.scrollBy(0, 100000)
|
||||
}
|
||||
continue_ok = false
|
||||
}
|
||||
|
||||
document.onkeyup = function(event) {
|
||||
var code = getcode(event)
|
||||
if (code == 13) {
|
||||
document.body.appendChild(curr_input)
|
||||
curr_input.focus()
|
||||
curr_input.value = ''
|
||||
}
|
||||
continue_ok = true
|
||||
}
|
||||
|
||||
document.ondblclick = function() {
|
||||
curr_input.focus()
|
||||
}
|
||||
}
|
||||
|
||||
function getcode(event) {
|
||||
var e, code
|
||||
if (window.event) e = window.event
|
||||
else e = event
|
||||
|
||||
if (e.which) code = e.which
|
||||
else if (e.charCode) code = e.charCode
|
||||
else if (e.keyCode) code = e.keyCode
|
||||
else code = 0
|
||||
|
||||
return code
|
||||
}
|
||||
|
||||
function getw() {
|
||||
var w
|
||||
if (self.innerHeight)
|
||||
w = self.innerWidth
|
||||
else if (document.documentElement && document.documentElement.clientHeight)
|
||||
w = document.documentElement.clientWidth
|
||||
else if (document.body)
|
||||
w = document.body.clientWidth
|
||||
return w
|
||||
}
|
||||
|
||||
function process_all(txt) {
|
||||
var newtxt, txtspl, txtsta, replaces, len, i
|
||||
newtxt = txt
|
||||
|
||||
if (newtxt.indexOf('=') != -1) {
|
||||
txtspl = newtxt.split('=')
|
||||
newtxt = txtspl[1]
|
||||
txtsta = txtspl[0] + '='
|
||||
}
|
||||
else
|
||||
txtsta = ''
|
||||
|
||||
replaces = [
|
||||
[/\ /g, ''],
|
||||
//[/\,/g, '.'], // Uncomment to allow "," as "." (used in some countries)
|
||||
[/\'/g, ','],
|
||||
[/\_/g, ','],
|
||||
[/\*\*/g, '^'],
|
||||
[/\&pi/gi, 'Math.PI'],
|
||||
[/\π/gi, 'Math.PI'],
|
||||
[/\&e/gi, 'Math.E'],
|
||||
[/log\(/gi, 'log('],
|
||||
[/ln\(/gi, 'ln('],
|
||||
[/sqrt\(/gi, 'sqrt('],
|
||||
[/r\(/gi, 'sqrt('],
|
||||
[/sin\(/gi, 'sin('],
|
||||
[/sin\^\(-1\)\(/gi, 'asin('],
|
||||
[/sin\^-1\(/gi, 'asin('],
|
||||
[/cos\(/gi, 'cos('],
|
||||
[/cos\^\(-1\)\(/gi, 'acos('],
|
||||
[/cos\^-1\(/gi, 'acos('],
|
||||
[/tan\(/gi, 'tan('],
|
||||
[/tan\^\(-1\)\(/gi, 'atan('],
|
||||
[/tan\^-1\(/gi, 'atan(']
|
||||
]
|
||||
|
||||
len = replaces.length
|
||||
for (i = 0; i < len; i++) {
|
||||
newtxt = newtxt.replace(replaces[i][0], replaces[i][1])
|
||||
}
|
||||
|
||||
if (newtxt == 'help')
|
||||
return "'This is a simple calculator. It is able to put a number in the power of a number and supports functions like sin(), asin(), cos(), acos(), tan(), atan(), log() og ln(). To take the power of a number, write \"x^y\" or \"x**y\". To take the squareroot of a number, write \"r(x)\". To take another root of a number, write \"r(x,y)\". Type \"&pi\" for pi and \"&e\" for e. Trigonometric functions use degrees, not radians. The log() function uses 10 as its base, while the ln() function uses e. To use a previous result, type \"ans\".'"
|
||||
else if (newtxt != '')
|
||||
return txtsta + process_part(newtxt)
|
||||
else
|
||||
return txtsta + newtxt
|
||||
}
|
||||
|
||||
function process_part(txt) {
|
||||
var number_parts, operator_parts, bracket_count, len, i, curr, indexOfBracket, special_characters, newtxt, last, add_operator
|
||||
number_parts = []
|
||||
number_parts[0] = ''
|
||||
operator_parts = []
|
||||
|
||||
bracket_count = 0
|
||||
|
||||
len = txt.length
|
||||
for (i = 0; i < len; i++) {
|
||||
curr = txt.substr(i, 1)
|
||||
|
||||
if (curr == '(') bracket_count++
|
||||
else if (curr == ')') bracket_count--
|
||||
|
||||
if ((curr == '+' || curr == '-' || curr == '*' || curr == '/' || curr == '^') && bracket_count == 0) {
|
||||
number_parts[number_parts.length] = ''
|
||||
operator_parts[operator_parts.length] = txt.substr(i, 1)
|
||||
}
|
||||
else {
|
||||
number_parts[number_parts.length - 1] += txt.substr(i, 1)
|
||||
}
|
||||
}
|
||||
|
||||
len = number_parts.length
|
||||
if (number_parts[0] == '') number_parts[0] = '0'
|
||||
if (number_parts[len - 1] == '') number_parts[len - 1] = '0'
|
||||
for (i = 0; i < bracket_count; i++) {
|
||||
number_parts[len - 1] += ')'
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
if (number_parts[i] != '') {
|
||||
indexOfBracket = number_parts[i].indexOf('(')
|
||||
if (indexOfBracket != -1) number_parts[i] = number_parts[i].substr(0, indexOfBracket) + '(' + process_part(number_parts[i].substr(indexOfBracket + 1, number_parts[i].length - indexOfBracket - 2)) + ')'
|
||||
}
|
||||
}
|
||||
|
||||
special_characters = '^'
|
||||
newtxt = ''
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
last = (i == len - 1) ? true : false
|
||||
add_operator = true
|
||||
|
||||
if (!last && special_characters.indexOf(operator_parts[i]) != -1) {
|
||||
add_operator = false
|
||||
|
||||
if (operator_parts[i] == '^')
|
||||
newtxt += 'pow(' + number_parts[i] + ',' + number_parts[i + 1] + ')'
|
||||
}
|
||||
else if (special_characters.indexOf(operator_parts[i - 1]) == -1) {
|
||||
newtxt += number_parts[i]
|
||||
}
|
||||
|
||||
if (!last && add_operator) newtxt += operator_parts[i]
|
||||
}
|
||||
|
||||
return newtxt
|
||||
}
|
||||
|
||||
|
||||
function sin(num) {
|
||||
return Math.sin(num * Math.PI / 180)
|
||||
}
|
||||
|
||||
function cos(num) {
|
||||
return Math.cos(num * Math.PI / 180)
|
||||
}
|
||||
|
||||
function tan(num) {
|
||||
return Math.tan(num * Math.PI / 180)
|
||||
}
|
||||
|
||||
|
||||
function asin(num) {
|
||||
return (Math.asin(num) / Math.PI) * 180
|
||||
}
|
||||
|
||||
function acos(num) {
|
||||
return (Math.acos(num) / Math.PI) * 180
|
||||
}
|
||||
|
||||
function atan(num) {
|
||||
return (Math.atan(num) / Math.PI) * 180
|
||||
}
|
||||
|
||||
|
||||
function sqrt(num1, num2) {
|
||||
if (num2 == undefined)
|
||||
return Math.sqrt(num1)
|
||||
else return pow(num1, 1 / num2)
|
||||
}
|
||||
|
||||
function pow(num1, num2) {
|
||||
return Math.pow(num1, num2)
|
||||
}
|
||||
|
||||
|
||||
function log(num) {
|
||||
return Math.log(num) / Math.log(10)
|
||||
}
|
||||
|
||||
function ln(num) {
|
||||
return Math.log(num)
|
||||
}
|
||||
|
||||
|
||||
function max(num1, num2) {
|
||||
return Math.max(num1, num2)
|
||||
}
|
||||
|
||||
function min(num1, num2) {
|
||||
return Math.min(num1, num2)
|
||||
}
|
||||
|
||||
function round(num) {
|
||||
return Math.round(num)
|
||||
}
|
||||
|
||||
function floor(num) {
|
||||
return Math.floor(num)
|
||||
}
|
||||
|
||||
function ceil(num) {
|
||||
return Math.ceil(num)
|
||||
}
|
||||
|
||||
function rand() {
|
||||
return Math.random()
|
||||
}
|
||||
|
||||
function randint(num1, num2) {
|
||||
return Math.floor(Math.random() * (num2 - num1 + 1)) + num1
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
1
subsites/projects/algo/pages/dir.txt
Normal file
@@ -0,0 +1 @@
|
||||
This folder holds the pages used by Algohol. They are fetched by the links.php file. In this folder is also the pages.css file and the pages.js file. These two files serve as a default for the pages in general.
|
||||
18
subsites/projects/algo/pages/error.htm
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<title>Error</title>
|
||||
<link href='pages.css' type='text/css' rel='stylesheet' />
|
||||
<script type='text/javascript' src='pages.js'></script>
|
||||
<script type='text/javascript'>
|
||||
window.onload = function() {
|
||||
setTimeout("close()", 3000)
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p class='header'>Error!</p>
|
||||
<p>There's no content!</p>
|
||||
<p style='margin-top: 10px'>Closing...</p>
|
||||
</body>
|
||||
</html>
|
||||
11
subsites/projects/algo/pages/help.htm
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<title></title>
|
||||
<link href='pages.css' type='text/css' rel='stylesheet' />
|
||||
<script type='text/javascript' src='pages.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>Using Algo should be pretty straight forward. If you don't get it, send a e-mail to ns@metanohi.org.</p>
|
||||
</body>
|
||||
</html>
|
||||
BIN
subsites/projects/algo/pages/icons/default.png
Normal file
|
After Width: | Height: | Size: 587 B |
4
subsites/projects/algo/pages/icons/dir.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
This folder holds the icons used by Algohol. The default.png icon is used as a default icon, while the other icons are used for specific pages.
|
||||
|
||||
Example:
|
||||
The calculator is opened in Algohol. The links.php file in the previous folder links to calc.htm. What also happens here is that links.php looks for calc.png in the icons folder. If such a file is not found, it defaults to defult.png.
|
||||
BIN
subsites/projects/algo/pages/icons/help.png
Normal file
|
After Width: | Height: | Size: 895 B |
BIN
subsites/projects/algo/pages/icons/notes.png
Normal file
|
After Width: | Height: | Size: 879 B |
9
subsites/projects/algo/pages/indexes.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/* This file keeps an index of the titles of current pages
|
||||
and gives them to the JavaScript environment when requested */
|
||||
$u['Welcome'] = 'start.htm';
|
||||
$u['Help'] = 'help.htm';
|
||||
$u['Calculator'] = 'calc.htm';
|
||||
$u['Notes'] = 'notes.php';
|
||||
$u['About'] = 'about.htm';
|
||||
?>
|
||||
25
subsites/projects/algo/pages/links.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
include('indexes.php'); // Get the indexes
|
||||
|
||||
$title = $_GET['title'];
|
||||
$type = $_GET['type'];
|
||||
$page = $u[$title];
|
||||
|
||||
if ($type == 'png') {
|
||||
header('Content-type: image/png');
|
||||
$spl = explode('.', $page);
|
||||
$page = 'icons/' . substr($page, 0, strlen($page) - strlen($spl[sizeof($spl) - 1]) - 1) . '.png';
|
||||
if (!is_file($page)) $page = 'icons/default.png';
|
||||
|
||||
$filename = $page;
|
||||
$handle = fopen($filename, "rb"); // Open the icon
|
||||
$contents = fread($handle, filesize($filename));
|
||||
fclose($handle);
|
||||
echo $contents; // Print the icon
|
||||
}
|
||||
else {
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
if (!is_file($page)) $page = 'error.htm';
|
||||
include($page); // Print the page
|
||||
}
|
||||
?>
|
||||
47
subsites/projects/algo/pages/notes.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<link href='pages.css' type='text/css' rel='stylesheet' />
|
||||
<style type='text/css'>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
textarea {
|
||||
font: 14px verdana;
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript' src='pages.js'></script>
|
||||
<script type='text/javascript'>
|
||||
function geth() {
|
||||
var h
|
||||
if (self.innerHeight)
|
||||
h = self.innerHeight
|
||||
else if (document.documentElement && document.documentElement.clientHeight)
|
||||
h = document.documentElement.clientHeight
|
||||
else if (document.body)
|
||||
h = document.body.clientHeight
|
||||
return h
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
tarea = document.getElementsByTagName('textarea')[0]
|
||||
update()
|
||||
window.onresize = update
|
||||
}
|
||||
|
||||
function update() {
|
||||
tarea.style.height = geth() + 'px'
|
||||
tarea.focus()
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<textarea>Notes...</textarea>
|
||||
</body>
|
||||
</html>
|
||||
63
subsites/projects/algo/pages/pages.css
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Algo: a dekstop environment look-a-like in your web browser
|
||||
Copyright (C) 2009 Niels Serup
|
||||
|
||||
This file is part of Algo.
|
||||
|
||||
Algo 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.
|
||||
|
||||
Algo 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 Algo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* This css file includes some basic formatting stuff,
|
||||
which can easily be overridden by internal stylesheets. */
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
font-family: 'dejavu sans' arial;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
text-decoration: none;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: dotted;
|
||||
border-bottom-color: #0033ff;
|
||||
color: #0033ff;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
border-bottom-color: #003399;
|
||||
color: #003399;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
89
subsites/projects/algo/pages/pages.js
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
Algo: a dekstop environment look-a-like in your web browser
|
||||
Copyright (C) 2009 Niels Serup
|
||||
|
||||
This file is part of Algo.
|
||||
|
||||
Algo 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.
|
||||
|
||||
Algo 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 Algo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* This script page must be included by all pages.
|
||||
Without it, clicking on a window will not focus it.
|
||||
See the function below */
|
||||
document.onmousedown = get_focus
|
||||
|
||||
function get_focus() {
|
||||
parent.scr.change_focus(getwnd().num)
|
||||
}
|
||||
|
||||
/* Get the value of the id. There are always two ids and two values.
|
||||
The first one covers the title, while the second one is a unique number. */
|
||||
function getget(id) {
|
||||
var txt, len, ab
|
||||
txt = window.location.search.substring(1).split('&')
|
||||
len = txt.length
|
||||
for (var i = 0; i < len; i++) {
|
||||
ab = txt[i].split('=')
|
||||
if (ab[0] == id) return ab[1]
|
||||
}
|
||||
}
|
||||
|
||||
// Get the window, so to say.
|
||||
function getwnd() {
|
||||
var onum = getget('num') * 1
|
||||
var num = -1
|
||||
for (var i = 0; i < parent.scr.len; i++) {
|
||||
if (parent.wnds[i].onum == onum) {
|
||||
num = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if (num > -1)
|
||||
return parent.wnds[num]
|
||||
}
|
||||
|
||||
function minimize() {
|
||||
getwnd().minimize()
|
||||
}
|
||||
|
||||
function maximize() {
|
||||
getwnd().maximize()
|
||||
}
|
||||
|
||||
function close() {
|
||||
getwnd().close()
|
||||
}
|
||||
|
||||
function setwindow(a, b, c, d, e, f, g, h, i, j, k, l, m, n) {
|
||||
parent.scr.setwindow(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
|
||||
}
|
||||
|
||||
function settitle(title) {
|
||||
getwnd().settitle(title)
|
||||
}
|
||||
|
||||
function getwh() {
|
||||
if (self.innerHeight) {
|
||||
h=self.innerHeight
|
||||
w=self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h=document.documentElement.clientHeight
|
||||
w=document.documentElement.clientWidth
|
||||
}
|
||||
else if (document.body) {
|
||||
h=document.body.clientHeight
|
||||
w=document.body.clientWidth
|
||||
}
|
||||
}
|
||||
14
subsites/projects/algo/pages/start.htm
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<title></title>
|
||||
<link href='pages.css' type='text/css' rel='stylesheet' />
|
||||
<script type='text/javascript' src='pages.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<p class='header'>Welcome to Algo!</p>
|
||||
<p>Algo is a website that imitates the look of a desktop environment. Algo is functional in most browsers and is released under GPLv3. As it is right now, Algo isn't terribly useful, but that might change someday. Navigate by clicking the tabs at the top and the bars at the bottom.</p>
|
||||
<br />
|
||||
<div class='center header'><a href='#' onclick='setwindow("Help", true)'>Help</a></div>
|
||||
</body>
|
||||
</html>
|
||||
10
subsites/projects/algo/pages/template.htm
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<title></title>
|
||||
<link href='pages.css' type='text/css' rel='stylesheet' />
|
||||
<script type='text/javascript' src='pages.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
360
subsites/projects/algo/themes/default.css
Normal file
@@ -0,0 +1,360 @@
|
||||
body {
|
||||
background: #000 url('img/algo-logo.png') center fixed;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.navi0 {
|
||||
background: #bbb;
|
||||
height: 25px;
|
||||
border-color: #fff;
|
||||
border-style: solid;
|
||||
border-width: 0 0 2px 0;
|
||||
}
|
||||
|
||||
.navi1 {
|
||||
background: #ccc;
|
||||
height: 25px;
|
||||
border-color: #fff;
|
||||
border-style: solid;
|
||||
border-width: 2px 0 0 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.dropdown {
|
||||
margin: 2px 5px 0 5px;
|
||||
border-width: 0;
|
||||
border-color: #fff;
|
||||
border-style: solid;
|
||||
width: 125px;
|
||||
}
|
||||
|
||||
.dropdown * {
|
||||
font-size: 14px;
|
||||
background: #444;
|
||||
color: #fff;
|
||||
padding: 3px;
|
||||
display: none;
|
||||
border-color: #bbb;
|
||||
border-style: solid;
|
||||
border-width: 0;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.dropdown .top {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
height: 20px;
|
||||
padding: 3px 0 0 0;
|
||||
width: 125px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.dropdown .group {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dropdown .entries {
|
||||
top: -1px;
|
||||
left: 133px;
|
||||
width: 125px;
|
||||
padding: 0;
|
||||
border-width: 1px 1px 0 1px;
|
||||
}
|
||||
|
||||
.dropdown .entry, .dropdown .header {
|
||||
border-width: 0 0 1px 0;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.dropdown .entry {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown .header {
|
||||
background: #444 url('img/next.png') no-repeat right 4px;
|
||||
padding-right: 15px;
|
||||
width: 107px;
|
||||
}
|
||||
|
||||
.dropdown .side {
|
||||
top: -1px;
|
||||
left: -9px;
|
||||
width: 7px;
|
||||
height: 100%;
|
||||
background: #ddd;
|
||||
padding: 1px 0 0 0;
|
||||
border-width: 0 0 0 1px;
|
||||
}
|
||||
|
||||
.dropdown:hover {
|
||||
border-color: #bbb;
|
||||
margin: 2px 3px 0 5px;
|
||||
border-width: 0 1px;
|
||||
left: -1px;
|
||||
}
|
||||
|
||||
.dropdown:hover .top {
|
||||
height: 26px;
|
||||
color: #222;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.dropdown .group:hover > .header {
|
||||
background: #222 url('img/nexth.png') no-repeat right 4px;
|
||||
}
|
||||
|
||||
.dropdown .entry:hover {
|
||||
background: #777;
|
||||
}
|
||||
|
||||
.dropdown > .drop0 {
|
||||
background: url('img/tab3.png') no-repeat ;
|
||||
}
|
||||
|
||||
.dropdown:hover > .drop0 {
|
||||
background: url('img/tab3.png') no-repeat 0 -30px;
|
||||
}
|
||||
|
||||
.dropdown > .drop1 {
|
||||
background: url('img/tab4.png') no-repeat ;
|
||||
}
|
||||
|
||||
.dropdown:hover > .drop1 {
|
||||
background: url('img/tab4.png') no-repeat 0 -30px;
|
||||
}
|
||||
|
||||
.dropdown > .drop2 {
|
||||
background: url('img/tab5.png') no-repeat ;
|
||||
}
|
||||
|
||||
.dropdown:hover > .drop2 {
|
||||
background: url('img/tab5.png') no-repeat 0 -30px;
|
||||
}
|
||||
|
||||
.dropdown > .drop3 {
|
||||
background: url('img/tab2.png') no-repeat ;
|
||||
}
|
||||
|
||||
.dropdown:hover > .drop3 {
|
||||
background: url('img/tab2.png') no-repeat 0 -30px;
|
||||
}
|
||||
|
||||
.dropdown > .drop4 {
|
||||
background: url('img/tab1.png') no-repeat ;
|
||||
}
|
||||
|
||||
.dropdown:hover > .drop4 {
|
||||
background: url('img/tab1.png') no-repeat 0 -30px;
|
||||
}
|
||||
|
||||
.dropdown > .drop5 {
|
||||
background: url('img/tab6.png') no-repeat ;
|
||||
}
|
||||
|
||||
.dropdown:hover > .drop5 {
|
||||
background: url('img/tab6.png') no-repeat 0 -30px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.abs {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.scrollup {
|
||||
background: url('img/scrollup.png') no-repeat;
|
||||
}
|
||||
|
||||
.scrolldown {
|
||||
background: url('img/scrolldown.png') no-repeat;
|
||||
}
|
||||
|
||||
.scrollup:hover {
|
||||
background: url('img/scrolluph.png') no-repeat;
|
||||
}
|
||||
|
||||
.scrolldown:hover {
|
||||
background: url('img/scrolldownh.png') no-repeat;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The following piece of css, namely the "screen" stuff,
|
||||
is not correctly formatted css, as it is only used by a PHP script
|
||||
that is requested by the JavaScript environment of Algohol.
|
||||
That is the reason why it is commented out.
|
||||
It is kept in the css file for ease of use.
|
||||
All numbers are in the "px" unit and must be written without a unit.
|
||||
screen {
|
||||
hheight: 25; the height of a window header
|
||||
margin_g: 5; the general margin of a window
|
||||
margin_t: 2; the margin at the top of a window
|
||||
bw: 16; box width; includes the window icon and the minimize/maximize/close buttons.
|
||||
bh: 16; box height; includes the window icon and the minimize/maximize/close buttons.
|
||||
}
|
||||
*/
|
||||
|
||||
.window {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.window > .tl {
|
||||
background: url('img/corners.png') no-repeat -20px 0;
|
||||
}
|
||||
|
||||
.window > .t {
|
||||
background: #999;
|
||||
}
|
||||
|
||||
.window > .tr {
|
||||
background: url('img/corners.png') no-repeat -25px 0;
|
||||
}
|
||||
|
||||
.window > .r {
|
||||
background: #999;
|
||||
}
|
||||
|
||||
.window > .br {
|
||||
background: url('img/corners.png') no-repeat -30px 0;
|
||||
}
|
||||
|
||||
.window > .b {
|
||||
background: #999;
|
||||
}
|
||||
|
||||
.window > .bl {
|
||||
background: url('img/corners.png') no-repeat -35px 0;
|
||||
}
|
||||
|
||||
.window > .l {
|
||||
background: #999;
|
||||
}
|
||||
|
||||
.window#active > .tl {
|
||||
background: url('img/corners.png') no-repeat 0 0;
|
||||
}
|
||||
|
||||
.window#active > .t {
|
||||
background: #444;
|
||||
}
|
||||
|
||||
.window#active > .tr {
|
||||
background: url('img/corners.png') no-repeat -5px 0;
|
||||
}
|
||||
|
||||
.window#active > .r {
|
||||
background: #444;
|
||||
}
|
||||
|
||||
.window#active > .br {
|
||||
background: url('img/corners.png') no-repeat -10px 0;
|
||||
}
|
||||
|
||||
.window#active > .b {
|
||||
background: #444;
|
||||
}
|
||||
|
||||
.window#active > .bl {
|
||||
background: url('img/corners.png') no-repeat -15px 0;
|
||||
}
|
||||
|
||||
.window#active > .l {
|
||||
background: #444;
|
||||
}
|
||||
|
||||
.window > .title {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.window > .data {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.window > .icon {
|
||||
background-repeat: no-repeat;
|
||||
background-image: url('../icons/img/default.png');
|
||||
}
|
||||
|
||||
.window > .title {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.window > .options > * {
|
||||
background-image: url('img/action_icons.png');
|
||||
}
|
||||
|
||||
.window > .options > .minimize {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
.window > .options > .minimize:hover {
|
||||
background-position: -16px 0;
|
||||
}
|
||||
|
||||
.window > .options > .maximize {
|
||||
background-position: -32px 0;
|
||||
}
|
||||
|
||||
.window > .options > .maximize:hover {
|
||||
background-position: -48px 0;
|
||||
}
|
||||
|
||||
.window_max > .options > .maximize {
|
||||
background-position: -64px 0;
|
||||
}
|
||||
|
||||
.window_max > .options > .maximize:hover {
|
||||
background-position: -80px 0;
|
||||
}
|
||||
|
||||
.window > .options > .close {
|
||||
background-position: -96px 0;
|
||||
}
|
||||
|
||||
.window > .options > .close:hover {
|
||||
background-position: -112px 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.appboxes * {
|
||||
width: 100px;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
border-color: #fff;
|
||||
border-style: outset;
|
||||
border-width: 1px;
|
||||
float: left;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.appboxes .current {
|
||||
border-style: inset;
|
||||
}
|
||||
|
||||
.appboxes *:hover {
|
||||
background: #e2fbff;
|
||||
}
|
||||
|
||||
.appboxes .current:hover {
|
||||
background: #d1ffea;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.clock {
|
||||
margin: 3px 2px 0 0;
|
||||
padding: 2px;
|
||||
border-left: 1px solid #aaa;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
273
subsites/projects/algo/themes/dev.css
Normal file
@@ -0,0 +1,273 @@
|
||||
body {
|
||||
background: #000 url('img/bg.png') center;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
|
||||
.navi0 {
|
||||
background: #bbb;
|
||||
height: 25px;
|
||||
border-color: #fff;
|
||||
border-style: solid;
|
||||
border-width: 0 0 2px 0;
|
||||
}
|
||||
|
||||
.navi1 {
|
||||
background: #ccc;
|
||||
height: 25px;
|
||||
border-color: #fff;
|
||||
border-style: solid;
|
||||
border-width: 2px 0 0 0;
|
||||
}
|
||||
|
||||
|
||||
.dropdown, .dropdown_h {
|
||||
margin: 2px 5px 0 5px;
|
||||
border-width: 1px;
|
||||
border-color: #fff;
|
||||
border-style: solid;
|
||||
width: 125px;
|
||||
}
|
||||
|
||||
.dropdown *, .dropdown_h * {
|
||||
font-size: 14px;
|
||||
background: #444;
|
||||
color: #fff;
|
||||
padding: 3px;
|
||||
display: none;
|
||||
border-color: #bbb;
|
||||
border-style: solid;
|
||||
border-width: 0;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.dropdown .top, .dropdown_h .top {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
background: #333;
|
||||
color: #fff;
|
||||
padding-top: 0;
|
||||
height: 14px;
|
||||
padding: 1px 0 3px 0;
|
||||
width: 125px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown .group {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dropdown .entries {
|
||||
top: -1px;
|
||||
left: 133px;
|
||||
width: 125px;
|
||||
padding: 0;
|
||||
border-width: 1px 1px 0 1px;
|
||||
}
|
||||
|
||||
.dropdown .entry, .dropdown .header {
|
||||
border-width: 0 0 1px 0;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.dropdown .entry {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown .header {
|
||||
background: #444 url('../img/next.png') no-repeat right 4px;
|
||||
}
|
||||
|
||||
.dropdown .side {
|
||||
top: -1px;
|
||||
left: -9px;
|
||||
width: 7px;
|
||||
height: 100%;
|
||||
background: #ddd;
|
||||
padding: 1px 0 0 0;
|
||||
border-width: 0 0 0 1px;
|
||||
}
|
||||
|
||||
.dropdown:hover {
|
||||
border-color: #bbb;
|
||||
margin:0 5px;
|
||||
border-width: 0 1px;
|
||||
}
|
||||
|
||||
.dropdown:hover .top {
|
||||
height: 28px;
|
||||
color: #333;
|
||||
background: #eee;
|
||||
border-width: 0 1px 1px 1px;
|
||||
border-left-color: #888;
|
||||
border-bottom-color: #bbb;
|
||||
border-right-color: #888;
|
||||
padding-top: 4px;
|
||||
left: -1px;
|
||||
}
|
||||
|
||||
.dropdown .group:hover > .header {
|
||||
background: #222 url('../img/nexth.png') no-repeat right 4px;
|
||||
}
|
||||
|
||||
.dropdown .entry:hover {
|
||||
background: #777;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.abs {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.scrollup {
|
||||
background: url('img/scrollup.png') no-repeat;
|
||||
}
|
||||
|
||||
.scrolldown {
|
||||
background: url('img/scrolldown.png') no-repeat;
|
||||
}
|
||||
|
||||
.scrollup:hover {
|
||||
background: url('img/scrolluph.png') no-repeat;
|
||||
}
|
||||
|
||||
.scrolldown:hover {
|
||||
background: url('img/scrolldownh.png') no-repeat;
|
||||
}
|
||||
|
||||
/*
|
||||
All numbers are in the "px" unit and must be written without a unit.
|
||||
screen {
|
||||
hheight: 25; the height of a window header
|
||||
margin_g: 5; the general margin of a window
|
||||
margin_t: 2; the margin at the top of a window
|
||||
bw: 16; box width; includes the window icon and the minimize/maximize/close buttons.
|
||||
bh: 16; box height; includes the window icon and the minimize/maximize/close buttons.
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
.window {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.window > .tl {
|
||||
background: #111;
|
||||
}
|
||||
|
||||
.window > .t {
|
||||
background: #222;
|
||||
}
|
||||
|
||||
.window#active > .t {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.window > .tr {
|
||||
background: #444;
|
||||
}
|
||||
|
||||
.window > .r {
|
||||
background: #666;
|
||||
}
|
||||
|
||||
.window > .br {
|
||||
background: #888;
|
||||
}
|
||||
|
||||
.window > .b {
|
||||
background: #aaa;
|
||||
}
|
||||
|
||||
.window > .bl {
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
.window > .l {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
.window > .title {
|
||||
color: #fff;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.window#active > .title {
|
||||
background: #aaa;
|
||||
}
|
||||
|
||||
.window > .handle {
|
||||
}
|
||||
|
||||
.window > .resize_handle {
|
||||
}
|
||||
|
||||
.window > .data {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.window > .icon {
|
||||
background-repeat: no-repeat;
|
||||
background-image: url('../icons/default.png');
|
||||
}
|
||||
|
||||
.window > .options {
|
||||
background: #00cc00;
|
||||
}
|
||||
|
||||
.window > .options > .minimize {
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.window > .options > .maximize {
|
||||
background: #555;
|
||||
}
|
||||
|
||||
.window > .options > .close {
|
||||
background: #aaa;
|
||||
}
|
||||
|
||||
.window_max > .options > .maximize {
|
||||
background: blue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.appboxes * {
|
||||
width: 100px;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
border-color: #fff;
|
||||
border-style: outset;
|
||||
border-width: 1px;
|
||||
float: left;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.appboxes .current {
|
||||
border-style: inset;
|
||||
}
|
||||
|
||||
.appboxes *:hover {
|
||||
background: #e2fbff;
|
||||
}
|
||||
|
||||
.appboxes .current:hover {
|
||||
background: #d1ffea;
|
||||
}
|
||||
|
||||
|
||||
.clock {
|
||||
margin: 3px 2px 0 0;
|
||||
padding: 2px;
|
||||
border-left: 1px solid #aaa;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
1
subsites/projects/algo/themes/dir.txt
Normal file
@@ -0,0 +1 @@
|
||||
This folder holds the themes css files. It's css files that holds information on how Algohol looks. Apart from the css files, there's also a php file. The links.php file links a title to a file and fetches that file.
|
||||
BIN
subsites/projects/algo/themes/img/action_icons.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
1
subsites/projects/algo/themes/img/action_icons.png.txt
Normal file
@@ -0,0 +1 @@
|
||||
LICENSE: CC-SA
|
||||
BIN
subsites/projects/algo/themes/img/algo-logo.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
183
subsites/projects/algo/themes/img/algo-logo.svg
Normal file
@@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="300"
|
||||
height="175"
|
||||
id="svg2442"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.46"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
sodipodi:docname="algo-logo.svg"
|
||||
version="1.0"
|
||||
inkscape:export-filename="C:\home\Desktop\algo-logo.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<metadata
|
||||
id="metadata2455">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs2453">
|
||||
<linearGradient
|
||||
id="linearGradient2503">
|
||||
<stop
|
||||
style="stop-color:#5c6800;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2505" />
|
||||
<stop
|
||||
style="stop-color:#003800;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop2507" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 526.18109 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||
id="perspective2457" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2503"
|
||||
id="radialGradient3281"
|
||||
cx="231.97095"
|
||||
cy="213.72478"
|
||||
fx="231.97095"
|
||||
fy="213.72478"
|
||||
r="139.00072"
|
||||
gradientTransform="matrix(1.5049991,-1.6124644e-2,6.7244209e-3,0.6276261,-176.27211,71.250805)"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2503"
|
||||
id="radialGradient3303"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.5049991,-1.6124644e-2,6.7244209e-3,0.6276261,-176.27211,71.250805)"
|
||||
cx="231.97095"
|
||||
cy="213.72478"
|
||||
fx="231.97095"
|
||||
fy="213.72478"
|
||||
r="139.00072" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2503"
|
||||
id="radialGradient3305"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.5049991,-1.6124644e-2,6.7244209e-3,0.6276261,-176.27211,71.250805)"
|
||||
cx="231.97095"
|
||||
cy="213.72478"
|
||||
fx="231.97095"
|
||||
fy="213.72478"
|
||||
r="139.00072" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2503"
|
||||
id="radialGradient3307"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.5049991,-1.6124644e-2,6.7244209e-3,0.6276261,-176.27211,71.250805)"
|
||||
cx="231.97095"
|
||||
cy="213.72478"
|
||||
fx="231.97095"
|
||||
fy="213.72478"
|
||||
r="139.00072" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2503"
|
||||
id="radialGradient3309"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.5049991,-1.6124644e-2,6.7244209e-3,0.6276261,-176.27211,71.250805)"
|
||||
cx="231.97095"
|
||||
cy="213.72478"
|
||||
fx="231.97095"
|
||||
fy="213.72478"
|
||||
r="139.00072" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2503"
|
||||
id="radialGradient3311"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.5049991,-1.6124644e-2,6.7244209e-3,0.6276261,-176.27211,71.250805)"
|
||||
cx="231.97095"
|
||||
cy="213.72478"
|
||||
fx="231.97095"
|
||||
fy="213.72478"
|
||||
r="139.00072" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
inkscape:window-height="938"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
guidetolerance="10.0"
|
||||
gridtolerance="10.0"
|
||||
objecttolerance="10.0"
|
||||
borderopacity="1.0"
|
||||
bordercolor="#666666"
|
||||
pagecolor="#ffffff"
|
||||
id="base"
|
||||
showgrid="false"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:zoom="3.9466667"
|
||||
inkscape:cx="150"
|
||||
inkscape:cy="87.5"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-y="-4"
|
||||
inkscape:current-layer="g2467" />
|
||||
<!-- EMR_SETMAPMODE --><!-- EMR_SETWINDOWEXTEX --><!-- EMR_SETVIEWPORTEXTEX --> <g
|
||||
id="g2459">
|
||||
<g
|
||||
id="g2467"
|
||||
style="display:inline">
|
||||
<g
|
||||
id="g2496"
|
||||
style="fill:url(#radialGradient3281);fill-opacity:1"
|
||||
transform="translate(-66.737885,-114.68104)">
|
||||
<path
|
||||
id="path2444"
|
||||
d="M 110.8941,201.98168 L 142.15748,193.3202 L 119.98867,151.91153 L 110.8941,201.98168 z M 75.472441,243.70866 L 75.472441,235.59449 L 84.472441,235.59449 L 121.0748,129.64961 L 132.62598,129.64961 L 169.29921,235.59449 L 179.3622,235.59449 L 179.3622,243.70866 L 142.01575,243.70866 L 142.01575,235.59449 L 153.46063,235.59449 L 144.85039,210.54331 L 101.65748,210.54331 L 93.11811,235.59449 L 104.35039,235.59449 L 104.35039,243.70866 L 75.472441,243.70866 z"
|
||||
style="fill:url(#radialGradient3303);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
sodipodi:nodetypes="ccccccccccccccccccccc" />
|
||||
<path
|
||||
id="path2446"
|
||||
d="M 206.85827,235.59449 L 218.87008,235.59449 L 218.87008,243.70866 L 182.05512,243.70866 L 182.05512,235.59449 L 194.17323,235.59449 L 194.17323,132.90945 L 135.73501,129.72633 L 206.85827,124.83071 L 206.85827,235.59449 z"
|
||||
style="fill:url(#radialGradient3305);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
sodipodi:nodetypes="cccccccccc" />
|
||||
<path
|
||||
id="path2448"
|
||||
d="M 279.15871,170.6811 L 279.15871,241.93701 C 279.15871,253.59449 276.28863,262.59449 270.51304,268.93701 C 264.70201,275.27953 256.48154,278.4685 245.78075,278.4685 C 240.92642,278.4685 236.32013,277.97244 231.96186,277.01575 C 227.56816,276.05906 223.35162,274.6063 219.27682,272.65748 L 219.27682,255.61417 L 225.9028,255.61417 C 226.71776,260.92913 228.66658,264.79134 231.74926,267.23622 C 234.83194,269.6811 239.22564,264.48386 244.93036,264.48386 C 252.37131,264.48386 257.828,268.58268 261.30044,263.90551 C 264.73745,259.26378 266.47367,251.92913 266.47367,241.93701 L 266.47367,231.02362 C 263.99335,236.12598 260.83981,239.88189 257.01304,242.29134 C 253.18627,244.70079 248.43824,245.90551 242.80438,245.90551 C 233.83981,245.90551 226.50516,241.97244 220.80044,234.03543 C 215.09572,226.13386 212.26107,215.7874 212.26107,203.06693 C 212.26107,190.31102 215.09572,180 220.76501,172.13386 C 226.4343,164.23228 233.80438,160.26378 242.80438,160.26378 C 248.43824,160.26378 253.18627,161.50394 257.01304,163.91339 C 260.83981,166.32283 263.99335,170.07874 266.47367,175.1811 L 266.47367,162.49606 L 314.34352,160.47022 L 302.53897,170.6811 L 279.15871,170.6811 z M 266.47367,199.09843 C 266.47367,189.35433 264.80831,181.91339 261.44217,176.77559 C 258.07603,171.6378 253.18627,169.05118 246.77288,169.05118 C 240.2532,169.05118 229.04102,171.71854 231.99729,177.62598 C 267.45497,248.48014 216.24009,199.72636 227.00123,203.06693 C 264.28327,214.64037 228.66658,222.73228 231.99729,228.50787 C 235.328,234.24803 240.2532,237.11811 246.77288,237.11811 C 253.18627,237.11811 258.07603,234.56693 261.44217,229.46457 C 264.80831,224.32677 266.47367,216.88583 266.47367,207.1063 L 266.47367,199.09843 z"
|
||||
style="fill:url(#radialGradient3307);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
sodipodi:nodetypes="cccsccccsscccsscscssccccccsssscsccc" />
|
||||
<path
|
||||
id="path2450"
|
||||
d="M 317.73507,224.80117 C 324.53822,224.80117 330.08804,235.38189 333.52505,229.42913 C 336.99749,223.44094 328.56588,214.68898 328.56588,203.06693 C 328.56588,191.44488 336.99749,182.65748 333.52505,176.74016 C 330.08804,170.82283 324.91481,184.41626 318.11166,184.41626 C 311.34394,184.41626 306.20615,170.82283 302.73371,176.74016 C 299.2967,182.65748 308.1049,194.08098 308.1049,205.70303 C 308.1049,217.32508 299.2967,223.44094 302.80457,229.42913 C 306.27702,235.38189 311.37938,224.80117 318.11166,224.80117 L 317.73507,224.80117 z M 318.11166,245.90551 C 307.51717,245.90551 298.9778,242.00787 292.52898,234.17717 C 286.04473,226.38189 282.82032,216 282.82032,203.06693 C 282.82032,190.13386 286.04473,179.75197 292.45812,171.95669 C 298.90694,164.16142 307.44631,160.26378 318.11166,160.26378 C 328.81245,160.26378 337.38725,164.16142 343.80064,171.95669 C 350.24946,179.75197 353.47387,190.13386 353.47387,203.06693 C 353.47387,216 350.24946,226.38189 343.80064,234.17717 C 337.38725,242.00787 328.81245,245.90551 318.11166,245.90551 L 318.11166,245.90551 z"
|
||||
style="fill:url(#radialGradient3309);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
sodipodi:nodetypes="ccscscscccccscscsccc" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:url(#radialGradient3311);fill-opacity:1;stroke:none;stroke-width:2.84173226;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
id="path2465"
|
||||
sodipodi:cx="251.18304"
|
||||
sodipodi:cy="183.20105"
|
||||
sodipodi:rx="2.6361039"
|
||||
sodipodi:ry="2.6361039"
|
||||
d="M 253.81915,183.20105 A 2.6361039,2.6361039 0 1 1 248.54694,183.20105 A 2.6361039,2.6361039 0 1 1 253.81915,183.20105 z"
|
||||
transform="matrix(1.2278753,-0.5780649,0.6997627,1.4863754,-183.36446,55.154146)" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.5 KiB |
BIN
subsites/projects/algo/themes/img/corners.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
1
subsites/projects/algo/themes/img/dir.txt
Normal file
@@ -0,0 +1 @@
|
||||
This folder holds the images used by the css themes files.
|
||||
BIN
subsites/projects/algo/themes/img/next.png
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
subsites/projects/algo/themes/img/nexth.png
Normal file
|
After Width: | Height: | Size: 356 B |
BIN
subsites/projects/algo/themes/img/scrolldown.png
Normal file
|
After Width: | Height: | Size: 288 B |
BIN
subsites/projects/algo/themes/img/scrolldownh.png
Normal file
|
After Width: | Height: | Size: 239 B |
BIN
subsites/projects/algo/themes/img/scrollup.png
Normal file
|
After Width: | Height: | Size: 289 B |
BIN
subsites/projects/algo/themes/img/scrolluph.png
Normal file
|
After Width: | Height: | Size: 237 B |
BIN
subsites/projects/algo/themes/img/tab1.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
subsites/projects/algo/themes/img/tab2.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
subsites/projects/algo/themes/img/tab3.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
subsites/projects/algo/themes/img/tab4.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
subsites/projects/algo/themes/img/tab5.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
subsites/projects/algo/themes/img/tab6.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
9
subsites/projects/algo/themes/indexes.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/* This file keeps an index of the titles of current themes
|
||||
and gives them to the JavaScript environment when requested */
|
||||
$title = urldecode($_GET['title']);
|
||||
$type = urldecode($_GET['type']);
|
||||
|
||||
$u['Default'] = 'default.css';
|
||||
$u['Developer'] = 'dev.css';
|
||||
?>
|
||||
61
subsites/projects/algo/themes/links.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
include('indexes.php'); // Get the indexes
|
||||
|
||||
$file = $u[$title];
|
||||
|
||||
if (!is_file($file))
|
||||
$file = 'default.css';
|
||||
|
||||
if ($type == 'css') {
|
||||
// Simply include the css file
|
||||
header('Content-type: text/css');
|
||||
include($file);
|
||||
}
|
||||
elseif ($type == 'js') {
|
||||
// Read the css file for stuff the the JavaScript environment needs
|
||||
header('Content-type: text/javascript');
|
||||
|
||||
header('content-type: text/plain');
|
||||
$f = 'default.css';
|
||||
$file = fopen($f, 'r');
|
||||
$contents = fread($file, filesize($f));
|
||||
fclose($file);
|
||||
|
||||
function get_from_stylesheet($name, $property) {
|
||||
global $contents;
|
||||
|
||||
$block_start = strpos($contents, $name);
|
||||
$property_start = strpos($contents, $property, $block_start);
|
||||
if ($property_start === false) return 0;
|
||||
|
||||
$colon_start = strpos($contents, ':', $property_start);
|
||||
$semicolon_start = strpos($contents, ';', $property_start);
|
||||
|
||||
$property = substr($contents, $colon_start + 1, $semicolon_start - $colon_start - 1);
|
||||
$property = trim($property);
|
||||
|
||||
return $property;
|
||||
}
|
||||
|
||||
function rem_px($value) {
|
||||
return str_replace('px', '', $value);
|
||||
}
|
||||
|
||||
$text = '';
|
||||
$text .= "scr.hheight = " . get_from_stylesheet('screen', 'hheight');
|
||||
$text .= "\nscr.margin_g = " . get_from_stylesheet('screen', 'margin_g');
|
||||
$text .= "\nscr.margin_t = " . get_from_stylesheet('screen', 'margin_t');
|
||||
$text .= "\nscr.bw = " . get_from_stylesheet('screen', 'bw');
|
||||
$text .= "\nscr.bh = " . get_from_stylesheet('screen', 'bh');
|
||||
$text .= "\nabs_scroller_width = " . rem_px(get_from_stylesheet('.abs', 'width'));
|
||||
$text .= "\nnavi[0].height = " . rem_px(get_from_stylesheet('.navi0', 'height'));
|
||||
$text .= "\nnavi[0].border = [" . str_replace(' ', ',', rem_px(get_from_stylesheet('.navi0', 'border-width'))) . ']';
|
||||
$text .= "\nnavi[1].height = " . rem_px(get_from_stylesheet('.navi1', 'height'));
|
||||
$text .= "\nnavi[1].border = [" . str_replace(' ', ',', rem_px(get_from_stylesheet('.navi1', 'border-width'))) . ']';
|
||||
$text .= "\nappbox_margin = " . rem_px(get_from_stylesheet('.appboxes *', 'margin'));
|
||||
$text .= "\nappbox_padding = " . rem_px(get_from_stylesheet('.appboxes *', 'padding'));
|
||||
$text .= "\nappbox_border = " . rem_px(get_from_stylesheet('.appboxes *', 'border-width'));
|
||||
|
||||
echo $text;
|
||||
}
|
||||
?>
|
||||
13
subsites/projects/algo/todo.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
More advanced versions of:
|
||||
appbox_margin = 2
|
||||
appbox_padding = 2
|
||||
appbox_border = 1
|
||||
(Turn into arrays)
|
||||
|
||||
do not maximize window on dblclick if maximize button is nonexistant
|
||||
|
||||
Make the top/bottom attributes of navbars that are not positioned at the very top or bottom recognisable by the screen() class.
|
||||
*/
|
||||
|
||||
cookie functions
|
||||
1
subsites/projects/algo/version.txt
Normal file
@@ -0,0 +1 @@
|
||||
v.0.1
|
||||
BIN
subsites/projects/algo/window_elements.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
1
subsites/projects/bsq/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bak/
|
||||
BIN
subsites/projects/bsq/Cerebral_lobes.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
1
subsites/projects/bsq/Cerebral_lobes.png.txt
Normal file
@@ -0,0 +1 @@
|
||||
Image released under GFDL 1.2 or any later version. Author unknown. See <http://commons.wikimedia.org/wiki/File:Cerebral_lobes.png>.
|
||||
BIN
subsites/projects/bsq/Cerveau_anime.gif
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
1
subsites/projects/bsq/Cerveau_anime.gif.txt
Normal file
@@ -0,0 +1 @@
|
||||
Image released under GFDL 1.2 or any later version. Author: modifié par Azariel. See <http://commons.wikimedia.org/wiki/File:Cerveau_animé.gif>.
|
||||
BIN
subsites/projects/bsq/Friendly_stickman.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
32
subsites/projects/bsq/Friendly_stickman.svg
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="400" height="200" id="svg2" sodipodi:version="0.32" inkscape:version="0.45.1" version="1.0" sodipodi:docbase="F:\DERECKSON" sodipodi:docname="friendly stickman.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
||||
<defs id="defs4"/>
|
||||
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.70710678" inkscape:cx="101.48661" inkscape:cy="201.77156" inkscape:document-units="px" inkscape:current-layer="layer1" width="400px" height="200px" showborder="true" borderlayer="true" inkscape:window-width="748" inkscape:window-height="573" inkscape:window-x="87" inkscape:window-y="87"/>
|
||||
<metadata id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g inkscape:label="Calque 1" inkscape:groupmode="layer" id="layer1" transform="translate(-18.4429, -9.10085)">
|
||||
<path sodipodi:type="arc" style="opacity: 1; fill: none; fill-opacity: 1; stroke: rgb(254, 11, 5); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" id="path2160" sodipodi:cx="114.5" sodipodi:cy="163" sodipodi:rx="23.5" sodipodi:ry="23" d="M 138 163 A 23.5 23 0 1 1 91,163 A 23.5 23 0 1 1 138 163 z" transform="matrix(0.999639, -0.0268772, 0.0268772, 0.999639, 55.8298, -110.206)"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(254, 11, 5); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 175.56475,72.995643 L 177.42691,133.61394 L 142.36329,174.7877" id="path2162" sodipodi:nodetypes="cc"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(254, 11, 5); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 178.02676,133.15548 L 208.7788,171.94094" id="path2168"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(254, 11, 5); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 130.31029,94.826143 L 175.38906,74.515333 L 215.43836,90.768903" id="path2170"/>
|
||||
<path sodipodi:type="arc" style="opacity: 1; fill: none; fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" id="path3143" sodipodi:cx="114.5" sodipodi:cy="163" sodipodi:rx="23.5" sodipodi:ry="23" d="M 138 163 A 23.5 23 0 1 1 91,163 A 23.5 23 0 1 1 138 163 z" transform="matrix(0.9771, -0.212782, 0.212782, 0.9771, -72.5737, -70.8063)"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 79.218526,86.859173 L 92.349913,146.06738 L 65.577685,193.05657" id="path3145" sodipodi:nodetypes="cc"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 92.853773,145.50513 L 130.29788,177.877" id="path3147"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 38.82772,116.74429 L 79.329254,88.384973 L 121.70668,96.886623" id="path3149"/>
|
||||
<path sodipodi:type="arc" style="opacity: 1; fill: none; fill-opacity: 1; stroke: rgb(251, 240, 18); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" id="path3151" sodipodi:cx="114.5" sodipodi:cy="163" sodipodi:rx="23.5" sodipodi:ry="23" d="M 138 163 A 23.5 23 0 1 1 91,163 A 23.5 23 0 1 1 138 163 z" transform="matrix(0.992317, 0.123719, -0.123719, 0.992317, 179.381, -122.482)"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(251, 240, 18); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 270.21176,76.639033 L 262.93908,136.84828 L 222.08373,172.28239" id="path3153" sodipodi:nodetypes="cc"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(251, 240, 18); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 263.60104,136.48522 L 288.17233,179.45325" id="path3155"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(251, 240, 18); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 222.18957,91.417603 L 269.80959,78.115033 L 306.96002,100.20508" id="path3157"/>
|
||||
<path sodipodi:type="arc" style="opacity: 1; fill: none; fill-opacity: 1; stroke: rgb(255, 2, 163); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" id="path3159" sodipodi:cx="114.5" sodipodi:cy="163" sodipodi:rx="23.5" sodipodi:ry="23" d="M 138 163 A 23.5 23 0 1 1 91,163 A 23.5 23 0 1 1 138 163 z" transform="matrix(0.973822, 0.227311, -0.227311, 0.973822, 298.968, -116.645)"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(255, 2, 163); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 368.37124,90.917723 L 354.81181,150.02938 L 310.45911,180.97407" id="path3161" sodipodi:nodetypes="cc"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(255, 2, 163); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 355.50827,149.73789 L 375.42827,195.05007" id="path3163"/>
|
||||
<path style="fill: none; fill-rule: evenodd; stroke: rgb(255, 2, 163); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 319.06194,100.56813 L 367.8162,92.343303 L 402.43964,118.21494" id="path3165"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.7 KiB |
1
subsites/projects/bsq/Friendly_stickman.txt
Normal file
@@ -0,0 +1 @@
|
||||
Image released under WTFPL 2.0.
|
||||
13
subsites/projects/bsq/index.htm
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Brainy Stickman Quiz</title>
|
||||
<link href='style.css' rel='stylesheet' type='text/css' />
|
||||
<script type='text/javascript' src='script.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
<div id='box'></div>
|
||||
<div id='start'></div>
|
||||
</body>
|
||||
</html>
|
||||
548
subsites/projects/bsq/script.js
Normal file
@@ -0,0 +1,548 @@
|
||||
/*
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
Questions and obstacles are defined in the end of this file.
|
||||
*/
|
||||
function ld(num,d) {
|
||||
if (d==0) num=Math.floor(num/30)
|
||||
else num=Math.ceil(num/30)
|
||||
return num
|
||||
}
|
||||
|
||||
function calc(dn) {
|
||||
if (!clcn) {
|
||||
clcn=true
|
||||
var pstr
|
||||
if (dn==star[num][3]) {
|
||||
pstr="class='green'>CORRECT!"
|
||||
saa[num]=3
|
||||
corrects++
|
||||
}
|
||||
else {
|
||||
pstr="class='red'>WRONG! ("+abc.substr(star[num][3]-1,1)+" was correct)"
|
||||
saa[num]=1
|
||||
}
|
||||
starstaken++
|
||||
bxd.innerHTML+="<p onclick='bhidequestion()' "+pstr+"</p>"
|
||||
}
|
||||
}
|
||||
|
||||
function showquestion() {
|
||||
bxd.style.display="block"
|
||||
bxd.style.width=(sqp*6.4-10)+"px"
|
||||
bxd.style.height=(sqp*4-10)+"px"
|
||||
bxd.style.marginLeft=(sqp*-3.2)+"px"
|
||||
bxd.style.marginTop=(sqp*-2)+"px"
|
||||
if (sqp<75) {
|
||||
sqp+=3
|
||||
setTimeout("showquestion()",10)
|
||||
}
|
||||
else {
|
||||
clcn=false
|
||||
rsqw=true
|
||||
bxd.innerHTML="<h1>"+star[num][1]+"</h1>"
|
||||
for (var i=0;i<star[num][2].length;i++) {
|
||||
bxd.innerHTML+="<p onclick='calc("+(i+1)+")'>"+abc.substr(i,1)+": "+star[num][2][i]+"</p>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bhidequestion() {
|
||||
bxd.innerHTML=""
|
||||
rsqw=false
|
||||
hidequestion()
|
||||
}
|
||||
|
||||
function hidequestion() {
|
||||
bxd.style.width=(sqp*6.4-10)+"px"
|
||||
bxd.style.height=(sqp*4-10)+"px"
|
||||
bxd.style.marginLeft=(sqp*-3.2)+"px"
|
||||
bxd.style.marginTop=(sqp*-2)+"px"
|
||||
if (sqp>0) {
|
||||
sqp-=3
|
||||
setTimeout("hidequestion()",10)
|
||||
}
|
||||
else {
|
||||
bxd.style.display="none"
|
||||
sqp=1
|
||||
qs=false
|
||||
}
|
||||
}
|
||||
|
||||
function nrmlclr() {
|
||||
if (ncc) {
|
||||
qe=true
|
||||
hclr="#ff0000"
|
||||
ctxo.style.backgroundColor="#ff0000"
|
||||
ncc=false
|
||||
setTimeout("nrmlclr()",500)
|
||||
}
|
||||
else {
|
||||
ncc=true
|
||||
hclr="#000"
|
||||
ctxo.style.backgroundColor="#000"
|
||||
qe=false
|
||||
}
|
||||
}
|
||||
|
||||
function motion() {
|
||||
var i,pi
|
||||
ctx.clearRect(0,0,640,400)
|
||||
if (p>305 && p<end-290) pp=305
|
||||
else if (p>end-291) pp=305+p-end+291
|
||||
else pp=p
|
||||
|
||||
if (!rsqw) {
|
||||
if (j<0) {
|
||||
jumping=false
|
||||
j=0
|
||||
jc=5
|
||||
l=41
|
||||
a=21
|
||||
}
|
||||
if (jumping) {
|
||||
if (j>200) jc=-6
|
||||
if (jc>=0) j+=jc-j/100
|
||||
else j+=jc+j/100
|
||||
}
|
||||
}
|
||||
|
||||
if (!walkingr && !walkingl) {
|
||||
cutd=0
|
||||
ta=1
|
||||
}
|
||||
if (cutd<10) speed=ospeed+cutd/3
|
||||
|
||||
ctx.strokeStyle="#fff"
|
||||
ctx.lineWidth=2
|
||||
|
||||
// BACKGROUND
|
||||
for (pi=0;pi<bgl;pi++) {
|
||||
ci=Math.floor((p-pp+bg[pi][1]*p/ospeed)*bg[pi][1]/bg[pi][3])
|
||||
for (i=ci;i<bg[pi][4]+ci;i++) ctx.drawImage(bg[pi][0],i*bg[pi][3]+(pp-p-bg[pi][1]*p/ospeed)*bg[pi][1],bg[pi][2])
|
||||
}
|
||||
|
||||
// STARS
|
||||
if (stad) {
|
||||
for (i=0;i<starl;i++) {
|
||||
x=star[i][0][0]-(p-pp)
|
||||
y=400-star[i][0][1]-starh
|
||||
//document.title=ld(x,0)+" "+ld(pp-starw/2+30,0)+" "+y+" "+(y+starh)+" "+(400-j-130)+" "+(400-j)
|
||||
if ((ld(x,0)==ld(pp-starw/2+30,0) || ld(x,1)==ld(pp-starw/2+30,1)) && 400-j-130<y+starh && 400-j>y && saa[i]==2 && !qs) {
|
||||
qs=true
|
||||
num=i
|
||||
sqp=1
|
||||
showquestion()
|
||||
}
|
||||
if (x+starw>0 && x<640) {
|
||||
if (saa[i]==2) ctx.drawImage(starimg,x,y)
|
||||
else if (saa[i]==1 && stadu) ctx.drawImage(starimgu,x,y)
|
||||
else if (saa[i]==3 && stadk) ctx.drawImage(starimgk,x,y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TRAPS
|
||||
if (trapd) {
|
||||
for (i=0;i<trapl;i++) {
|
||||
x=trap[i][0]-(p-pp)
|
||||
y=400-trap[i][1]-traph
|
||||
if (pp+20>x && pp+40<x+trapw && 400-j-130<y+traph && 400-j>y && !qs && !qe) {
|
||||
timeshurt++
|
||||
nrmlclr()
|
||||
}
|
||||
if (x+trapw>0 && x<640) ctx.drawImage(trapimg,x,y)
|
||||
}
|
||||
}
|
||||
|
||||
// STICK FIGURE START
|
||||
|
||||
// LEGS
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(pp+l,400-j)
|
||||
ctx.lineTo(pp+20,350-j)
|
||||
ctx.lineTo(pp+40-l,400-j)
|
||||
|
||||
// BODY
|
||||
ctx.moveTo(pp+20,350-j)
|
||||
ctx.lineTo(pp+20,300-j)
|
||||
|
||||
// ARMS
|
||||
ctx.moveTo(pp+20,320-j)
|
||||
ctx.lineTo(pp+10+a,350-j)
|
||||
ctx.moveTo(pp+20,320-j)
|
||||
ctx.lineTo(pp+30-a,350-j)
|
||||
ctx.stroke()
|
||||
|
||||
// HEAD
|
||||
ctx.fillStyle=hclr
|
||||
ctx.beginPath()
|
||||
ctx.arc(pp+20,285-j,15,0,Math.PI*2,true)
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
|
||||
// EYE
|
||||
ctx.fillStyle="#fff"
|
||||
ctx.beginPath()
|
||||
ctx.arc(pp+eyex,eyey-j,3,0,Math.PI*2,true)
|
||||
ctx.fill()
|
||||
|
||||
// MOUTH
|
||||
ctx.beginPath()
|
||||
ctx.lineCap="round"
|
||||
ctx.moveTo(pp+mouthax,mouthay-j)
|
||||
ctx.lineTo(pp+mouthbx,mouthby-j)
|
||||
ctx.stroke()
|
||||
|
||||
// STICK FIGURE END
|
||||
|
||||
if (!rsqw) {
|
||||
if (p>=end) p=end-1
|
||||
else if (p<0) p=0
|
||||
if (p<end && p>-1 && (walkingr || walkingl)) {
|
||||
if (!jumping) {
|
||||
if (l>40) lc=-1
|
||||
else if (l<1) lc=1
|
||||
if (a>20) ac=-.5
|
||||
else if (a<1) ac=.5
|
||||
l+=lc*speed
|
||||
a+=ac*speed
|
||||
}
|
||||
if (walkingr) p+=speed
|
||||
else p-=speed
|
||||
}
|
||||
|
||||
if (jumping) {
|
||||
l=60
|
||||
a=40
|
||||
}
|
||||
if (p>end || p<0) {
|
||||
a=20
|
||||
l=40
|
||||
}
|
||||
}
|
||||
|
||||
if (p>=end) endgame()
|
||||
|
||||
cht=setTimeout("motion()",20)
|
||||
}
|
||||
|
||||
function endgame() {
|
||||
if (starstaken<starl) return
|
||||
bxd.style.display="block"
|
||||
qs=true
|
||||
|
||||
if (self.innerHeight) {
|
||||
h=self.innerHeight
|
||||
w=self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h=document.documentElement.clientHeight
|
||||
w=document.documentElement.clientHeight
|
||||
}
|
||||
else if (document.body) {
|
||||
h=document.body.clientHeight
|
||||
w=document.body.clientWidth
|
||||
}
|
||||
|
||||
openend()
|
||||
}
|
||||
|
||||
function openend() {
|
||||
bxd.style.width=(sqp*w/100-10)+"px"
|
||||
bxd.style.height=(sqp*h/100-10)+"px"
|
||||
bxd.style.marginLeft=(sqp*-w/200)+"px"
|
||||
bxd.style.marginTop=(sqp*-h/200)+"px"
|
||||
if (sqp<97) {
|
||||
sqp++
|
||||
setTimeout("openend()",10)
|
||||
}
|
||||
else {
|
||||
rsqw=true
|
||||
corrects==1 ? ife="" : ife="s"
|
||||
timeshurt==1 ? ifeb="" : ifeb="s"
|
||||
prc=Math.round(corrects/starl*100)
|
||||
hurtpoints=Math.round(timeshurt/trapl*100)
|
||||
fpc=prc-hurtpoints
|
||||
if (fpc<10) grade="F"
|
||||
else if (fpc<20) grade="E"
|
||||
else if (fpc<30) grade="C"
|
||||
else if (fpc<55) grade="D"
|
||||
else if (fpc<85) grade="B"
|
||||
else if (fpc<95) grade="A"
|
||||
else grade="A+"
|
||||
clearTimeout(cht)
|
||||
bxd.innerHTML="<h2>The quiz is over!</h2><h3>You managed to get "+corrects+" right answer"+ife+" out of "+starl+" possible, i.e. "+prc+"%. You were wounded "+timeshurt+" time"+ifeb+", deducting "+hurtpoints+"%.</h3><h3>Your grade is... <div>"+grade+"</div></h3><h4 onclick='endall()'>OK</h4>"
|
||||
}
|
||||
}
|
||||
|
||||
function endall() {
|
||||
document.body.removeChild(bxd)
|
||||
document.body.removeChild(ctxo)
|
||||
}
|
||||
|
||||
function md(e) {
|
||||
if (window.event) kc=window.event.keyCode
|
||||
else if (e) kc=e.which
|
||||
|
||||
if (!walkingr && kc==39) {
|
||||
walkingr=true
|
||||
walkingl=false
|
||||
cutd=0
|
||||
}
|
||||
if (!walkingl && kc==37) {
|
||||
walkingr=false
|
||||
walkingl=true
|
||||
cutd=0
|
||||
}
|
||||
else if (!jumping && kc==38) jumping=true
|
||||
|
||||
if (walkingl) {
|
||||
eyex=12
|
||||
eyey=283
|
||||
mouthax=20
|
||||
mouthay=293
|
||||
mouthbx=10
|
||||
mouthby=295
|
||||
}
|
||||
else if (walkingr) {
|
||||
eyex=28
|
||||
eyey=283
|
||||
mouthax=30
|
||||
mouthay=295
|
||||
mouthbx=20
|
||||
mouthby=293
|
||||
}
|
||||
}
|
||||
|
||||
function mu(e) {
|
||||
if (window.event) kc=window.event.keyCode
|
||||
else if (e) kc=e.which
|
||||
|
||||
if (walkingr && kc==39) walkingr=false
|
||||
if (walkingl && kc==37) walkingl=false
|
||||
}
|
||||
|
||||
function time() {
|
||||
if (cutd==0) ta=1
|
||||
cutd+=ta
|
||||
}
|
||||
|
||||
function load() {
|
||||
var i
|
||||
fdng=100
|
||||
ospeed=3
|
||||
speed=ospeed
|
||||
p=0
|
||||
l=0
|
||||
a=0
|
||||
walkingr=false
|
||||
walkingl=false
|
||||
jumping=false
|
||||
jc=5
|
||||
j=0
|
||||
qs=false
|
||||
qe=false
|
||||
rsqw=false
|
||||
corrects=0
|
||||
starstaken=0
|
||||
abc="ABCDEFGH"
|
||||
cutd=0
|
||||
ta=1
|
||||
ncc=true
|
||||
hclr="#000"
|
||||
timeshurt=0
|
||||
|
||||
// BACKGROUNDS
|
||||
bg=new Array()
|
||||
bg[0]=new Array()
|
||||
bg[0][0]=new Image()
|
||||
bg[0][0].src="Cerebral_lobes.png"
|
||||
bg[0][1]=.5
|
||||
bg[0][2]=20
|
||||
bg[1]=new Array()
|
||||
bg[1][0]=new Image()
|
||||
bg[1][0].src="Cerveau_anime.gif"
|
||||
bg[1][1]=1
|
||||
bg[1][2]=90
|
||||
bg[2]=new Array()
|
||||
bg[2][0]=new Image()
|
||||
bg[2][0].src="Friendly_stickman.png"
|
||||
bg[2][1]=1.5
|
||||
bg[2][2]=170
|
||||
bgl=bg.length
|
||||
|
||||
// STARS
|
||||
star=new Array()
|
||||
star[0]=new Array()
|
||||
star[0][0]=[200,3]
|
||||
star[0][1]="To what extent does bicycles apply to world economics?"
|
||||
star[0][2]=["A great extent","A noticable extent","Nothing at all","I don't know"]
|
||||
star[0][3]=4
|
||||
star[1]=new Array()
|
||||
star[1][0]=[650,80]
|
||||
star[1][1]="What is a chocobo?"
|
||||
star[1][2]=["A fictional bird","A fictional frog","A real bird","A real frog"]
|
||||
star[1][3]=1
|
||||
star[2]=new Array()
|
||||
star[2][0]=[850,100]
|
||||
star[2][1]="What is the size of an average male human brain?"
|
||||
star[2][2]=["1200-1300cm<sup>3</sup>","1100-1200cm<sup>3</sup>","1300-1400cm<sup>3</sup>","1000-1100cm<sup>3</sup>"]
|
||||
star[2][3]=2
|
||||
star[3]=new Array()
|
||||
star[3][0]=[1200,23]
|
||||
star[3][1]="What is 2 * 8^(1/3) + 4?"
|
||||
star[3][2]=["2","4","6","8"]
|
||||
star[3][3]=4
|
||||
star[4]=new Array()
|
||||
star[4][0]=[1577,150]
|
||||
star[4][1]="What colour is the beak of a male blackbird?"
|
||||
star[4][2]=["Grey","Black","Brown","Orange"]
|
||||
star[4][3]=4
|
||||
star[5]=new Array()
|
||||
star[5][0]=[1700,10]
|
||||
star[5][1]="Do you like this quiz?"
|
||||
star[5][2]=["Yes","No","Perhaps","Eventually","Maybe","Depends"]
|
||||
star[5][3]=1
|
||||
star[6]=new Array()
|
||||
star[6][0]=[1900,20]
|
||||
star[6][1]="Who is Horacio Pe<50>a?"
|
||||
star[6][2]=["An actor","A writer"]
|
||||
star[6][3]=2
|
||||
star[7]=new Array()
|
||||
star[7][0]=[2222,111]
|
||||
star[7][1]="When did Monkey Island reveal its truth?"
|
||||
star[7][2]=["1990","1991","1992","Hasn't happened yet"]
|
||||
star[7][3]=4
|
||||
star[8]=new Array()
|
||||
star[8][0]=[2500,23]
|
||||
star[8][1]="Do you gimp?"
|
||||
star[8][2]=["No, I photoshop.","Yes."]
|
||||
star[8][3]=2
|
||||
starl=star.length
|
||||
|
||||
Array.prototype.add=function(x,y){this[this.length]=[x,y]}
|
||||
|
||||
// TRAPS
|
||||
trap=new Array()
|
||||
trap.add(100,5)
|
||||
trap.add(300,60)
|
||||
trap.add(350,43)
|
||||
trap.add(660,20)
|
||||
trap.add(700,250)
|
||||
trap.add(750,250)
|
||||
trap.add(800,250)
|
||||
trap.add(860,2)
|
||||
trap.add(920,30)
|
||||
trap.add(930,40)
|
||||
trap.add(940,50)
|
||||
trap.add(1250,40)
|
||||
trap.add(1400,68)
|
||||
trap.add(1537,10)
|
||||
trap.add(1567,10)
|
||||
trap.add(1597,10)
|
||||
trap.add(1700,170)
|
||||
trap.add(1800,64)
|
||||
trap.add(1950,3)
|
||||
trap.add(1950,23)
|
||||
trap.add(1950,43)
|
||||
trap.add(1950,63)
|
||||
trap.add(1950,203)
|
||||
trap.add(2200,10)
|
||||
trap.add(2375,10)
|
||||
trap.add(2435,10)
|
||||
trapl=trap.length
|
||||
|
||||
saa=new Array()
|
||||
for (i=0;i<starl;i++) {
|
||||
saa[i]=2
|
||||
}
|
||||
|
||||
end=star[starl-1][0][0]+350
|
||||
|
||||
starimg=new Image()
|
||||
starimg.src="star.png"
|
||||
starimgu=new Image()
|
||||
starimgu.src="staru.png"
|
||||
starimgk=new Image()
|
||||
starimgk.src="stark.png"
|
||||
|
||||
trapimg=new Image()
|
||||
trapimg.src="trap.png"
|
||||
|
||||
eyex=28
|
||||
eyey=283
|
||||
mouthax=30
|
||||
mouthay=295
|
||||
mouthbx=20
|
||||
mouthby=293
|
||||
|
||||
ctxo=document.getElementById("canvas")
|
||||
ctx=ctxo.getContext("2d")
|
||||
bxd=document.getElementById("box")
|
||||
strt=document.getElementById("start")
|
||||
|
||||
stad=false
|
||||
starimg.onload=function(){
|
||||
starh=starimg.height
|
||||
starw=starimg.width
|
||||
stad=true
|
||||
}
|
||||
stadu=false
|
||||
starimgu.onload=function(){
|
||||
stadu=true
|
||||
}
|
||||
stadk=false
|
||||
starimgk.onload=function(){
|
||||
stadk=true
|
||||
}
|
||||
|
||||
trapd=false
|
||||
trapimg.onload=function(){
|
||||
traph=trapimg.height
|
||||
trapw=trapimg.width
|
||||
trapd=true
|
||||
}
|
||||
|
||||
bg[0][0].onload=function(){
|
||||
bg[0][3]=bg[0][0].width
|
||||
bg[0][4]=Math.ceil(640/bg[0][3])+1
|
||||
}
|
||||
bg[1][0].onload=function(){
|
||||
bg[1][3]=bg[1][0].width
|
||||
bg[1][4]=Math.ceil(640/bg[1][3])+1
|
||||
}
|
||||
bg[2][0].onload=function(){
|
||||
bg[2][3]=bg[2][0].width
|
||||
bg[2][4]=Math.ceil(640/bg[2][3])+1
|
||||
}
|
||||
|
||||
document.onkeydown=startgame
|
||||
document.onclick=startgame
|
||||
}
|
||||
|
||||
function startgame() {
|
||||
document.onclick=null
|
||||
strt.style.mozOpacity=fdng/100
|
||||
strt.style.opacity=fdng/100
|
||||
strt.style.filter="alpha(opacity="+fdng+")"
|
||||
if (fdng>0) {
|
||||
fdng-=8
|
||||
setTimeout("startgame()",10)
|
||||
}
|
||||
else {
|
||||
document.onkeydown=md
|
||||
document.onkeyup=mu
|
||||
strt.style.display="none"
|
||||
motion()
|
||||
setInterval("time()",500)
|
||||
}
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
BIN
subsites/projects/bsq/star.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
subsites/projects/bsq/stark.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
subsites/projects/bsq/start.png
Normal file
|
After Width: | Height: | Size: 143 KiB |
BIN
subsites/projects/bsq/start.xcf
Normal file
BIN
subsites/projects/bsq/staru.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
106
subsites/projects/bsq/style.css
Normal file
@@ -0,0 +1,106 @@
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
body {
|
||||
background:#000;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-202px;
|
||||
margin-left:-322px;
|
||||
background:#000;
|
||||
border:2px solid #aaa;
|
||||
}
|
||||
|
||||
#box {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
border:2px solid #ccc;
|
||||
padding:5px;
|
||||
background:#000;
|
||||
opacity:.9;
|
||||
filter:alpha(opacity=90);
|
||||
-moz-opacity:.9;
|
||||
color:#fff;
|
||||
display:none;
|
||||
z-index:2;
|
||||
}
|
||||
|
||||
#start {
|
||||
background:#000 url(start.png) no-repeat;
|
||||
width:640px;
|
||||
height:480px;
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-242px;
|
||||
margin-left:-322px;
|
||||
z-index:3;
|
||||
border:2px solid #fff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font:normal 26px georgia;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font:normal 76px georgia;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font:normal 46px arial;
|
||||
}
|
||||
|
||||
h3 div {
|
||||
display:inline;
|
||||
color:#ff0000;
|
||||
font:bold 50px 'trebuchet ms';
|
||||
}
|
||||
|
||||
h4 {
|
||||
width:100px;
|
||||
margin:0 auto;
|
||||
text-align:center;
|
||||
cursor:pointer;
|
||||
font:normal 60px 'lucida console';
|
||||
padding:3px;
|
||||
border:5px dotted #aaa;
|
||||
}
|
||||
|
||||
h4:hover {
|
||||
background:#444;
|
||||
border:5px dotted #777;
|
||||
}
|
||||
|
||||
h4:active {
|
||||
background:#777;
|
||||
border:5px dotted #999;
|
||||
}
|
||||
|
||||
p {
|
||||
font:18px arial;
|
||||
padding:3px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
p:hover {
|
||||
background:#666;
|
||||
}
|
||||
|
||||
p.green, p.red {
|
||||
margin-top:10px;
|
||||
font:26px 'trebuchet ms';
|
||||
}
|
||||
|
||||
p.green {
|
||||
color:#00ff00;
|
||||
}
|
||||
p.red {
|
||||
color:#ff0000;
|
||||
}
|
||||
BIN
subsites/projects/bsq/trap.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
1
subsites/projects/canvas/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bak/
|
||||
117
subsites/projects/canvas/box.htm
Normal file
@@ -0,0 +1,117 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Canvas box</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function box() {
|
||||
var ctx=document.getElementById('canvas').getContext('2d')
|
||||
var i
|
||||
if (x<0 || x>639 || y<0 || y>399) end=[320,-100]
|
||||
else {
|
||||
for (i=0;i<pl;i++) {
|
||||
if (p[i][0]==x) x++
|
||||
if (p[i][1]==y) y++
|
||||
}
|
||||
end=[x,y]
|
||||
}
|
||||
|
||||
if (end[1]>p[0][1]) l*=-1
|
||||
var ep=new Array()
|
||||
for (i=0;i<pl;i++) ep[i]=[p[i][0]-l/((end[1]-p[i][1])/(end[0]-p[i][0])),p[i][1]-l]
|
||||
ctx.clearRect(0,0,640,400)
|
||||
ctx.beginPath()
|
||||
for (i=0;i<pl;i++) {
|
||||
ni=i+1-Math.floor((i+1)/pl)*pl
|
||||
ctx.moveTo(p[i][0],p[i][1])
|
||||
ctx.lineTo(p[ni][0],p[ni][1])
|
||||
ctx.moveTo(p[i][0],p[i][1])
|
||||
ctx.lineTo(ep[i][0],ep[i][1])
|
||||
ctx.lineTo(ep[ni][0],ep[ni][1])
|
||||
}
|
||||
ctx.stroke()
|
||||
|
||||
if (p[2][0]>637) a=-1
|
||||
else if (p[0][0]<3) a=1
|
||||
for (i=0;i<pl;i++) p[i][0]+=a
|
||||
|
||||
if (p[2][0]-p[1][0]==75) z=-1
|
||||
else if (p[2][0]-p[1][0]==25) z=1
|
||||
p[2][0]+=z
|
||||
p[3][0]+=z
|
||||
|
||||
if (p[1][1]>397) b=-.5
|
||||
else if (p[0][1]<3) b=.5
|
||||
for (i=0;i<pl;i++) p[i][1]+=b
|
||||
|
||||
if (p[1][1]-p[0][1]==75) z=-1
|
||||
else if (p[1][1]-p[0][1]==25) z=1
|
||||
p[1][1]+=z
|
||||
p[2][1]+=z
|
||||
|
||||
if (l==-10) c=.5
|
||||
else if (l==40) c=-.5
|
||||
l+=c
|
||||
|
||||
setTimeout("box()",10)
|
||||
}
|
||||
|
||||
function load() {
|
||||
p=new Array()
|
||||
p[0]=[2,348]
|
||||
p[1]=[2,398]
|
||||
p[2]=[52,398]
|
||||
p[3]=[52,348]
|
||||
pl=p.length
|
||||
l=10
|
||||
c=.5
|
||||
z=-1
|
||||
x=-1
|
||||
y=-1
|
||||
|
||||
box()
|
||||
}
|
||||
|
||||
function getwh() {
|
||||
if (self.innerHeight) {
|
||||
h=self.innerHeight
|
||||
w=self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h=document.documentElement.clientHeight
|
||||
w=document.documentElement.clientHeight
|
||||
}
|
||||
else if (document.body) {
|
||||
h=document.body.clientHeight
|
||||
w=document.body.clientWidth
|
||||
}
|
||||
}
|
||||
|
||||
function mm(e) {
|
||||
getwh()
|
||||
x=Math.floor(e.pageX-(w-642)/2-2)
|
||||
y=Math.floor(e.pageY-(h-402)/2-2)
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
document.onmousemove=mm
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
78
subsites/projects/canvas/cb.htm
Normal file
@@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Circles in boxes</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
|
||||
function getwh() {
|
||||
if (self.innerHeight) {
|
||||
h=self.innerHeight
|
||||
w=self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h=document.documentElement.clientHeight
|
||||
w=document.documentElement.clientHeight
|
||||
}
|
||||
else if (document.body) {
|
||||
h=document.body.clientHeight
|
||||
w=document.body.clientWidth
|
||||
}
|
||||
}
|
||||
|
||||
function mm(e) {
|
||||
getwh()
|
||||
x=Math.floor(e.pageX-(w-642)/2-2)
|
||||
y=Math.floor(e.pageY-(h-402)/2-2)
|
||||
if (x<0) x=0
|
||||
if (x>639) x=639
|
||||
if (y<0) y=0
|
||||
if (y>399) y=399
|
||||
x=(x-320)*(-1)+160
|
||||
if (x>320) x=320
|
||||
if (x<160) lx=160
|
||||
else lx=x
|
||||
if (x<0) x=0
|
||||
if (x>160) rx=150
|
||||
else rx=x*(-1)+310
|
||||
lw=x-10
|
||||
if (lw<150) lw=150
|
||||
rw=310-x
|
||||
if (rw<150) rw=150
|
||||
lh=lw*390/310
|
||||
rh=rw*390/310
|
||||
|
||||
var ctx=document.getElementById('canvas').getContext('2d')
|
||||
ctx.lineWidth=2
|
||||
ctx.clearRect(0,0,640,400)
|
||||
ctx.strokeRect(320-lx+5,(390-lh)/2+5,lx-10,lh)
|
||||
ctx.strokeRect(325,(390-rh)/2+5,rx,rh)
|
||||
ctx.beginPath()
|
||||
ctx.arc(lw/2-lx+325,lh/2+(390-lh)/2+5,lw/4,0,Math.PI*2,true)
|
||||
ctx.stroke()
|
||||
ctx.beginPath()
|
||||
ctx.arc(rw/2+rw-rx+325,rh/2+(390-rh)/2+5,rw/4,0,Math.PI*2,true)
|
||||
ctx.stroke()
|
||||
}
|
||||
|
||||
document.onmousemove=mm
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
482
subsites/projects/canvas/cc.htm
Normal file
@@ -0,0 +1,482 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Circle Class</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
/*
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
This JS class attempts to make an interactive site with the canvas element.
|
||||
In time this will not only be a cirlce class, but more like an object class.
|
||||
The fun stuff happens at the end of this file.
|
||||
*/
|
||||
|
||||
function Circle(posX, posY, radius, fillColor, borderWidth, borderColor, visible) {
|
||||
// Default to defaults if nothing is specified
|
||||
if (posX == undefined) var posX = 0
|
||||
if (posY == undefined) var posY = 0
|
||||
if (radius == undefined) var radius = 50
|
||||
if (fillColor == undefined) var fillColor = '#ddd'
|
||||
if (borderWidth == undefined) var borderWidth = 2
|
||||
if (borderColor == undefined) var borderColor = '#444'
|
||||
if (visible == undefined) var visible = true
|
||||
this.visible = visible
|
||||
|
||||
// Get number in order of creation
|
||||
this.num = objects.length
|
||||
|
||||
// Create canvas element
|
||||
this.element = document.createElement('canvas')
|
||||
if (!this.visible) this.hide()
|
||||
this.element.style.zIndex = this.num + 2
|
||||
wrapper.appendChild(this.element)
|
||||
this.context = this.element.getContext('2d')
|
||||
|
||||
// Append to global objects
|
||||
objects.splice(objects.length, objects.length, this)
|
||||
|
||||
this.state = 'normal'
|
||||
this.globalstate = 'normal'
|
||||
this.savedstate = 'hover'
|
||||
|
||||
this.x = posX
|
||||
this.y = posY
|
||||
this.radius = radius
|
||||
this.fillColor = fillColor
|
||||
this.borderWidth = borderWidth
|
||||
this.borderColor = borderColor
|
||||
|
||||
var i
|
||||
|
||||
for (i in style_states) {
|
||||
this[style_states[i]] = {}
|
||||
this[style_states[i]].x = false
|
||||
this[style_states[i]].y = false
|
||||
this[style_states[i]].radius = false
|
||||
this[style_states[i]].fillColor = false
|
||||
this[style_states[i]].borderWidth = false
|
||||
this[style_states[i]].borderColor = false
|
||||
}
|
||||
|
||||
for (i in event_states) {
|
||||
this[event_states[i]] = '' //'dbg.innerHTML+=" '+event_states[i]+'"'
|
||||
}
|
||||
|
||||
// Keep track of mousedown events
|
||||
this.mousedown_done = false
|
||||
|
||||
// Keep track of hovering
|
||||
this.hovering = false
|
||||
|
||||
this.create()
|
||||
}
|
||||
|
||||
Circle.prototype.create = function() {
|
||||
var posX, posY, radius, fillColor, borderWidth, borderColor, i
|
||||
|
||||
posX = this.get('x')
|
||||
posY = this.get('y')
|
||||
radius = this.get('radius')
|
||||
fillColor = this.get('fillColor')
|
||||
borderWidth = this.get('borderWidth')
|
||||
borderColor = this.get('borderColor')
|
||||
|
||||
var mn = radius * 2 + borderWidth
|
||||
var mnh = mn / 2
|
||||
|
||||
this.element.width = mn
|
||||
this.element.height = mn
|
||||
this.element.style.width = mn + 'px'
|
||||
this.element.style.height = mn + 'px'
|
||||
this.element.style.left = posX - mnh + 'px'
|
||||
this.element.style.top = posY - mnh + 'px'
|
||||
|
||||
// Create the circle
|
||||
this.context.beginPath()
|
||||
this.context.arc(mnh, mnh, radius, 0, Math.PI*2, true)
|
||||
|
||||
if (typeof(fillColor) == 'string')
|
||||
this.context.fillStyle = fillColor
|
||||
else {
|
||||
if (fillColor[0] == 'linear') {
|
||||
var x1, y1, x2, y2
|
||||
if (fillColor.length > 2) {
|
||||
var angle = (fillColor[2] + 45) % 360 // Center it
|
||||
|
||||
if (angle >= 0 && angle < 90) {
|
||||
x1 = (angle / 90) * mn
|
||||
y1 = 0
|
||||
x2 = ((90 - angle) / 90) * mn
|
||||
y2 = mn
|
||||
}
|
||||
else if (angle >= 90 && angle < 180) {
|
||||
x1 = mn
|
||||
y1 = ((angle - 90) / 90) * mn
|
||||
x2 = 0
|
||||
y2 = ((90 - (angle - 90)) / 90) * mn
|
||||
}
|
||||
else if (angle >= 180 && angle < 270) {
|
||||
x1 = ((90 - (angle - 180)) / 90) * mn
|
||||
y1 = mn
|
||||
x2 = ((angle - 180) / 90) * mn
|
||||
y2 = 0
|
||||
}
|
||||
else if (angle >= 270 && angle < 360) {
|
||||
x1 = 0
|
||||
y1 = ((90 - (angle - 270)) / 90) * mn
|
||||
x2 = mn
|
||||
y2 = ((angle - 270) / 90) * mn
|
||||
}
|
||||
}
|
||||
else {
|
||||
x1 = mnh
|
||||
y1 = 0
|
||||
x2 = mnh
|
||||
y2 = mn
|
||||
}
|
||||
var grad = this.context.createLinearGradient(x1, y1, x2, y2)
|
||||
}
|
||||
else {
|
||||
var lenpos, reallen, angle, x1, y1
|
||||
if (fillColor.length > 2) {
|
||||
lenpos = (fillColor[2])
|
||||
if (fillColor.length > 3) {
|
||||
angle = (fillColor[3] + 45)
|
||||
while (angle < 0) {
|
||||
angle += 360
|
||||
}
|
||||
angle = angle % 360
|
||||
}
|
||||
else angle = 0
|
||||
}
|
||||
else {
|
||||
lenpos = 0
|
||||
angle = 0
|
||||
}
|
||||
|
||||
reallen = lenpos * radius
|
||||
|
||||
if (angle >= 0 && angle < 90) {
|
||||
x1 = mnh + Math.sin((angle - 45) * Math.PI / 180) * reallen
|
||||
y1 = mnh - Math.cos((angle - 45) * Math.PI / 180) * reallen
|
||||
}
|
||||
else if (angle >= 90 && angle < 180) {
|
||||
x1 = mnh + Math.cos((angle - 135) * Math.PI / 180) * reallen
|
||||
y1 = mnh + Math.sin((angle - 135) * Math.PI / 180) * reallen
|
||||
}
|
||||
else if (angle >= 180 && angle < 270) {
|
||||
x1 = mnh - Math.sin((angle - 225) * Math.PI / 180) * reallen
|
||||
y1 = mnh + Math.cos((angle - 225) * Math.PI / 180) * reallen
|
||||
}
|
||||
else if (angle >= 270 && angle < 360) {
|
||||
x1 = mnh - Math.cos((angle - 315) * Math.PI / 180) * reallen
|
||||
y1 = mnh - Math.sin((angle - 315) * Math.PI / 180) * reallen
|
||||
}
|
||||
|
||||
var grad = this.context.createRadialGradient(x1, y1, 0, mnh, mnh, radius)
|
||||
}
|
||||
|
||||
for (i in fillColor[1]) {
|
||||
grad.addColorStop(i / (fillColor[1].length - 1), fillColor[1][i])
|
||||
}
|
||||
|
||||
this.context.fillStyle = grad
|
||||
}
|
||||
this.context.lineWidth = borderWidth
|
||||
this.context.strokeStyle = borderColor
|
||||
|
||||
// Clear the screen
|
||||
this.context.clearRect(0, 0, mn, mn)
|
||||
this.context.stroke()
|
||||
this.context.fill()
|
||||
}
|
||||
|
||||
Circle.prototype.standby = function() {
|
||||
if (!this.visible) return false
|
||||
|
||||
var posX, posY, radius, borderWidth
|
||||
|
||||
posX = this.get('x')
|
||||
posY = this.get('y')
|
||||
radius = this.get('radius')
|
||||
borderWidth = this.get('borderWidth')
|
||||
|
||||
if (!object_hover && Math.sqrt(Math.pow((x - posX), 2) + Math.pow((y - posY), 2)) < radius + borderWidth / 2) {
|
||||
// If the cursor is inside the circle
|
||||
|
||||
// No more objects may react
|
||||
object_hover = true
|
||||
|
||||
if (!this.hovering)
|
||||
this.eval(this.onmouseover)
|
||||
else if (x != ox || y != oy)
|
||||
this.eval(this.onmousemove)
|
||||
|
||||
// We're hovering!
|
||||
this.hovering = true
|
||||
|
||||
if (this.globalstate == 'onmousedown') {
|
||||
this.state = 'active'
|
||||
this.savedstate = 'active'
|
||||
if (!this.onmousedown_done) {
|
||||
this.onmousedown_done = true
|
||||
this.eval(this.onmousedown)
|
||||
}
|
||||
}
|
||||
else if (this.globalstate == 'onmouseup') {
|
||||
this.state = 'hover'
|
||||
this.savedstate = 'hover'
|
||||
this.eval(this.onmouseup)
|
||||
if (this.onmousedown_done)
|
||||
this.eval(this.onclick)
|
||||
|
||||
this.onmousedown_done = false
|
||||
}
|
||||
else {
|
||||
// Last resort
|
||||
this.state = this.savedstate
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the cursor is outside the circle
|
||||
|
||||
if (this.hovering) {
|
||||
// No more hovering..
|
||||
this.hovering = false
|
||||
this.eval(this.onmouseout)
|
||||
}
|
||||
// Reset everything
|
||||
this.state = 'normal'
|
||||
|
||||
if (this.globalstate == 'onmouseup') {
|
||||
this.savedstate = 'hover'
|
||||
this.onmousedown_done = false
|
||||
}
|
||||
}
|
||||
|
||||
this.globalstate = 'normal'
|
||||
|
||||
// Create it and draw it to the screen
|
||||
this.create()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Circle.prototype.eval = function(code) {
|
||||
var codetype = typeof(code)
|
||||
if (codetype == 'function')
|
||||
code = (code + '').split('function ')[1].split('{')[0]
|
||||
try {
|
||||
eval(code)
|
||||
return true
|
||||
}
|
||||
catch(e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Circle.prototype.getobj = function() {
|
||||
if (this.state == 'normal')
|
||||
return this
|
||||
else
|
||||
return this[this.state]
|
||||
}
|
||||
|
||||
Circle.prototype.get = function(circlevar) {
|
||||
var cobj = this.getobj()
|
||||
if (cobj[circlevar] === false) {
|
||||
if (this.state == 'active' && this.hover[circlevar] !== false)
|
||||
return this.hover[circlevar]
|
||||
else return this[circlevar]
|
||||
}
|
||||
else return cobj[circlevar]
|
||||
}
|
||||
|
||||
Circle.prototype.set = function(circle_var, value) {
|
||||
this[circle_var] = value
|
||||
for (var i in event_states) {
|
||||
this[event_states[i]][circle_var] = value
|
||||
}
|
||||
}
|
||||
|
||||
Circle.prototype.hide = function() {
|
||||
this.element.style.display = 'none'
|
||||
this.visible = false
|
||||
}
|
||||
|
||||
Circle.prototype.show = function() {
|
||||
this.element.style.display = 'block'
|
||||
this.visible = true
|
||||
}
|
||||
|
||||
|
||||
Circle.prototype.raiseIndex = function(amount) {
|
||||
if (amount == undefined) var amount = 1
|
||||
return this.changeIndex(amount)
|
||||
}
|
||||
|
||||
Circle.prototype.lowerIndex = function(amount) {
|
||||
if (amount == undefined) var amount = 1
|
||||
return this.changeIndex(-amount)
|
||||
}
|
||||
|
||||
Circle.prototype.toTop = function() {
|
||||
return this.changeIndex(objects.length - this.num - 1)
|
||||
}
|
||||
|
||||
Circle.prototype.toBottom = function() {
|
||||
return this.changeIndex(-this.num)
|
||||
}
|
||||
|
||||
Circle.prototype.changeIndex = function(crement) {
|
||||
if (objects.length > this.num + crement && 0 <= this.num + crement) {
|
||||
objects.splice(this.num, 1)
|
||||
objects.splice(this.num + crement, 0, this)
|
||||
this.update_indexes()
|
||||
return true
|
||||
}
|
||||
else
|
||||
return false
|
||||
}
|
||||
|
||||
Circle.prototype.remove = function() {
|
||||
objects.splice(this.num, 1)
|
||||
this.update_indexes()
|
||||
wrapper.removeChild(this.element)
|
||||
delete this
|
||||
}
|
||||
|
||||
Circle.prototype.update_indexes = function() {
|
||||
for (var i in objects) {
|
||||
objects[i].num = i * 1
|
||||
objects[i].element.style.zIndex = i * 1 + 2
|
||||
}
|
||||
}
|
||||
|
||||
function standby() {
|
||||
for (var i = objects.length - 1; i > -1; i--) {
|
||||
objects[i].standby()
|
||||
}
|
||||
object_hover = false
|
||||
ox = x
|
||||
oy = y
|
||||
timer = setTimeout('standby()')
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
// Globals
|
||||
x = 0
|
||||
y = 0
|
||||
ox = 0
|
||||
oy = 0
|
||||
objects = new Array()
|
||||
object_hover = false
|
||||
getwh()
|
||||
event_states = ['onmouseover', 'onmouseout', 'onmousemove', 'onmousedown', 'onmouseup', 'onclick']
|
||||
style_states = ['hover', 'active']
|
||||
globalstate = 'normal'
|
||||
|
||||
// Creating the wrapper
|
||||
wrapper = document.createElement('div')
|
||||
wrapper.style.position = 'absolute'
|
||||
document.body.appendChild(wrapper)
|
||||
/*dbg = document.createElement('div')
|
||||
dbg.style.position = 'absolute'
|
||||
document.body.appendChild(dbg)*/
|
||||
|
||||
// Adjust on resize
|
||||
window.onresize = function() {
|
||||
getwh()
|
||||
}
|
||||
|
||||
window.onmousedown = function() {
|
||||
for (var i in objects) {
|
||||
objects[i].globalstate = 'onmousedown'
|
||||
}
|
||||
}
|
||||
|
||||
window.onmouseup = function() {
|
||||
for (var i in objects) {
|
||||
objects[i].globalstate = 'onmouseup'
|
||||
}
|
||||
}
|
||||
|
||||
standby()
|
||||
|
||||
loadobjects()
|
||||
}
|
||||
|
||||
window.onmousemove = function(e) {
|
||||
if (!e) var e = window.event
|
||||
if (e.pageX || e.pageY) {
|
||||
x = e.pageX
|
||||
y = e.pageY
|
||||
}
|
||||
else if (e.clientX || e.clientY) {
|
||||
x = e.clientX + document.body.scrollLeft
|
||||
y = e.clientY + document.body.scrollTop
|
||||
}
|
||||
}
|
||||
|
||||
function getwh() {
|
||||
if (self.innerHeight) {
|
||||
h = self.innerHeight
|
||||
w = self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h = document.documentElement.clientHeight
|
||||
w = document.documentElement.clientHeight
|
||||
}
|
||||
else if (document.body) {
|
||||
h = document.body.clientHeight
|
||||
w = document.body.clientWidth
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function loadobjects() {
|
||||
circ = new Circle(250, 250, 50, ['radial', ['#00ff00', '#dd33ee', '#888', '#00ffff']], 0, '#000')
|
||||
circ.hover.fillColor = ['radial', ['#0000ff', '#dd33ee', '#333', '#00ffff']]
|
||||
circ.active.fillColor = ['linear', ['#fff', '#000'], -45]
|
||||
|
||||
circ2 = new Circle(270, 280, 30, '#eee', 5, '#333')
|
||||
circ2.hover.fillColor = '#ff00ff'
|
||||
circ2.active.fillColor = '#ff0000'
|
||||
|
||||
circ3 = new Circle(260, 220, 25, ['radial', ['#fff', '#000']], 7, '#333')
|
||||
circ3.hover.fillColor = ['radial', ['#000', '#fff']]
|
||||
|
||||
circ4 = new Circle(340, 290, 60, ['radial', ['rgb(221, 87, 42)', 'rgb(155, 60, 28)'], .6, -10], 0, '#333')
|
||||
circ4.hover.fillColor = ['radial', ['#fff', '#000'], .4, 40]
|
||||
|
||||
// Below is a list of functions that can be used on a circle.
|
||||
/*
|
||||
changeIndex
|
||||
raiseIndex
|
||||
lowerIndex
|
||||
toTop
|
||||
toBottom
|
||||
hide
|
||||
show
|
||||
remove
|
||||
*/
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
97
subsites/projects/canvas/cursor.htm
Normal file
@@ -0,0 +1,97 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Cursor-following canvas circles</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function getwh() {
|
||||
if (self.innerHeight) {
|
||||
h=self.innerHeight
|
||||
w=self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h=document.documentElement.clientHeight
|
||||
w=document.documentElement.clientHeight
|
||||
}
|
||||
else if (document.body) {
|
||||
h=document.body.clientHeight
|
||||
w=document.body.clientWidth
|
||||
}
|
||||
}
|
||||
|
||||
function ani() {
|
||||
var ctx = document.getElementById('canvas').getContext('2d');
|
||||
|
||||
ctx.clearRect(0,0,640,400);
|
||||
|
||||
for (var i=0;i<num;i++) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(a[i],b[i],c[i],0,Math.PI*2,true);
|
||||
ctx.stroke();
|
||||
nc=c[i]+Math.floor(Math.random()*3)-1
|
||||
if (nc<minr) nc=minr
|
||||
else if (nc>maxr) nc=maxr
|
||||
c[i]=nc
|
||||
|
||||
|
||||
nb=Math.floor(Math.random()*(diff*2+1))-diff+y
|
||||
if (nb<c[i]) nb=c[i]
|
||||
else if (nb>400-c[i]) nb=400-c[i]
|
||||
b[i]=nb
|
||||
na=Math.floor(Math.random()*(diff*2+1))-diff+x
|
||||
if (na<c[i]) na=c[i]
|
||||
else if (na>640-c[i]) na=640-c[i]
|
||||
a[i]=na
|
||||
}
|
||||
|
||||
setTimeout("ani()",40)
|
||||
}
|
||||
|
||||
function load() {
|
||||
x=320
|
||||
y=200
|
||||
maxr=75
|
||||
minr=25
|
||||
diff=10
|
||||
num=10
|
||||
|
||||
a=new Array()
|
||||
b=new Array()
|
||||
c=new Array()
|
||||
for (var i=0;i<num;i++) {
|
||||
c[i]=Math.floor(Math.random()*50)+25
|
||||
b[i]=Math.floor(Math.random()*(400-c[i]*2))+c[i]
|
||||
a[i]=Math.floor(Math.random()*(640-c[i]*2))+c[i]
|
||||
}
|
||||
|
||||
ani()
|
||||
}
|
||||
|
||||
function mc(e) {
|
||||
getwh()
|
||||
x=Math.floor(e.pageX-(w-642)/2-2)
|
||||
y=Math.floor(e.pageY-(h-402)/2-2)
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
document.onmousemove=mc
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
76
subsites/projects/canvas/df.htm
Normal file
@@ -0,0 +1,76 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CanvasDraw :: Paintbrush</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function getwh() {
|
||||
if (self.innerHeight) {
|
||||
h=self.innerHeight
|
||||
w=self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h=document.documentElement.clientHeight
|
||||
w=document.documentElement.clientHeight
|
||||
}
|
||||
else if (document.body) {
|
||||
h=document.body.clientHeight
|
||||
w=document.body.clientWidth
|
||||
}
|
||||
}
|
||||
|
||||
function ani() {
|
||||
var ctx = document.getElementById('canvas').getContext('2d');
|
||||
|
||||
if (click) {
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(ox,oy)
|
||||
ctx.lineTo(x,y)
|
||||
ctx.stroke()
|
||||
}
|
||||
ox=x
|
||||
oy=y
|
||||
|
||||
setTimeout("ani()",1)
|
||||
}
|
||||
|
||||
function load() {
|
||||
x=0
|
||||
y=0
|
||||
ox=0
|
||||
oy=0
|
||||
click=false
|
||||
|
||||
ani()
|
||||
}
|
||||
|
||||
function mm(e) {
|
||||
getwh()
|
||||
x=Math.floor(e.pageX-(w-642)/2-2)
|
||||
y=Math.floor(e.pageY-(h-402)/2-2)
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
document.onmousemove=mm
|
||||
document.onmousedown=function(){click=true}
|
||||
document.onmouseup=function(){click=false}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
106
subsites/projects/canvas/dl.htm
Normal file
@@ -0,0 +1,106 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CanvasDraw :: Lines</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
click=false
|
||||
coor=false
|
||||
|
||||
function getwh() {
|
||||
if (self.innerHeight) {
|
||||
h=self.innerHeight
|
||||
w=self.innerWidth
|
||||
}
|
||||
else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
h=document.documentElement.clientHeight
|
||||
w=document.documentElement.clientHeight
|
||||
}
|
||||
else if (document.body) {
|
||||
h=document.body.clientHeight
|
||||
w=document.body.clientWidth
|
||||
}
|
||||
}
|
||||
|
||||
function ld(num,d) {
|
||||
if (d==0) num=Math.floor(num/10)
|
||||
else num=Math.ceil(num/10)
|
||||
return num
|
||||
}
|
||||
|
||||
function load() {
|
||||
l=new Array()
|
||||
ctx=document.getElementById('canvas').getContext('2d')
|
||||
}
|
||||
|
||||
function mm(e) {
|
||||
getwh()
|
||||
x=Math.floor(e.pageX-(w-642)/2-2)
|
||||
y=Math.floor(e.pageY-(h-402)/2-2)
|
||||
|
||||
if (click) {
|
||||
ctx.clearRect(0,0,640,400)
|
||||
ctx.beginPath()
|
||||
for (var i=0;i<l.length;i++) {
|
||||
ctx.moveTo(l[i][0][0],l[i][0][1])
|
||||
ctx.lineTo(l[i][1][0],l[i][1][1])
|
||||
}
|
||||
ctx.moveTo(ox,oy)
|
||||
ctx.lineTo(x,y)
|
||||
ctx.stroke()
|
||||
}
|
||||
coor=true
|
||||
}
|
||||
|
||||
function mc() {
|
||||
if (coor) {
|
||||
if (click) {
|
||||
if (ld(x,0)==ld(sx,0) && ld(y,0)==ld(sy,0) || ld(x,1)==ld(sx,1) && ld(y,1)==ld(sy,1)) {
|
||||
click=false
|
||||
l[l.length]=[[ox,oy],[sx,sy]]
|
||||
|
||||
ctx.clearRect(0,0,640,400)
|
||||
ctx.beginPath()
|
||||
for (var i=0;i<l.length;i++) {
|
||||
ctx.moveTo(l[i][0][0],l[i][0][1])
|
||||
ctx.lineTo(l[i][1][0],l[i][1][1])
|
||||
}
|
||||
ctx.stroke()
|
||||
|
||||
|
||||
}
|
||||
else l[l.length]=[[ox,oy],[x,y]]
|
||||
}
|
||||
else {
|
||||
sx=x
|
||||
sy=y
|
||||
click=true
|
||||
}
|
||||
ox=x
|
||||
oy=y
|
||||
}
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
document.onmousemove=mm
|
||||
document.onclick=mc
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
BIN
subsites/projects/canvas/img/box.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
subsites/projects/canvas/img/cb.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
subsites/projects/canvas/img/cc.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
subsites/projects/canvas/img/cursor.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
subsites/projects/canvas/img/df.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
subsites/projects/canvas/img/dl.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
subsites/projects/canvas/img/header.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
subsites/projects/canvas/img/kr.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
subsites/projects/canvas/img/poly.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
subsites/projects/canvas/img/pr.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
subsites/projects/canvas/img/rc.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
subsites/projects/canvas/img/vc.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
149
subsites/projects/canvas/index.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
$files=scandir(".");
|
||||
$fn=sizeof($files);
|
||||
for ($i=0;$i<$fn;$i++) {
|
||||
$link=$files[$i];
|
||||
$imglink=explode(".",$link);
|
||||
$imglink=$imglink[0].".png";
|
||||
if (!is_dir($link) && $link!="." && $link!=".." && $link!="index.php") {
|
||||
$fo=fopen($link,"r");
|
||||
$fr=fread($fo,filesize($link));
|
||||
fclose($fo);
|
||||
$fr=explode("<title>",$fr);
|
||||
$fr=explode("</title>",$fr[1]);
|
||||
$title=$fr[0];
|
||||
$sites.="<a href='".$link."' style='background-image:url(img/".$imglink.")'>".$title."</a>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Experimenting with canvas</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
width:700px;
|
||||
margin:0 auto;
|
||||
}
|
||||
|
||||
#header {
|
||||
width:700px;
|
||||
height:100px;
|
||||
margin-bottom:5px;
|
||||
background:#eee url(img/header.png) no-repeat;
|
||||
}
|
||||
|
||||
#content {
|
||||
width:690px;
|
||||
padding:5px 5px 20px 5px;
|
||||
background:#eee;
|
||||
font:14px arial;
|
||||
float:left;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
#experiments {
|
||||
width:690px;
|
||||
float:left;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
|
||||
#experiments a:link, #experiments a:visited {
|
||||
width:211px;
|
||||
height:144px;
|
||||
margin:0 0 10px 10px;
|
||||
padding:3px;
|
||||
float:left;
|
||||
background:#ddd;
|
||||
opacity:.7;
|
||||
filter:alpha(opacity=70);
|
||||
-moz-opacity:.7;
|
||||
display:block;
|
||||
color:#0000ff;
|
||||
text-decoration:none;
|
||||
position:relative;
|
||||
z-index:2;
|
||||
}
|
||||
|
||||
#experiments a:hover {
|
||||
background:#ccc;
|
||||
opacity:1;
|
||||
filter:alpha(opacity=100);
|
||||
-moz-opacity:1;
|
||||
color:#0000aa;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font:normal 24px georgia;
|
||||
margin:15px 0 10px 0;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
position:absolute;
|
||||
right:0;
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
#error {
|
||||
display:none;
|
||||
font:16px arial;
|
||||
color:#ff0000
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function ani() {
|
||||
if (x==0) {
|
||||
x=700
|
||||
y=Math.floor(Math.random()*200)
|
||||
ctx.strokeStyle="rgb("+(Math.floor(Math.random()*128)+50)+","+(Math.floor(Math.random()*128)+50)+","+(Math.floor(Math.random()*128)+50)+")"
|
||||
}
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x,y)
|
||||
if (x<11) {
|
||||
x=0
|
||||
}
|
||||
else {
|
||||
x-=Math.floor(Math.random()*10)+1
|
||||
do {
|
||||
ny=y-(Math.floor(Math.random()*11)-5)
|
||||
} while (ny<2 || ny>197)
|
||||
y=ny
|
||||
}
|
||||
ctx.lineTo(x,y)
|
||||
ctx.stroke()
|
||||
setTimeout("ani()",40)
|
||||
}
|
||||
|
||||
window.onload=function(){
|
||||
ctx=document.getElementById("canvas")
|
||||
if (!ctx.getContext) {
|
||||
document.getElementById("error").style.display="block"
|
||||
return
|
||||
}
|
||||
ctx=ctx.getContext("2d")
|
||||
x=0
|
||||
ani()
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='wrapper'>
|
||||
<div id='header'></div>
|
||||
<div id='content'>
|
||||
<canvas id='canvas' width='700' height='200'></canvas>
|
||||
A new tag has entered the realms of internet browsing: CANVAS! With the canvas tag, people are now able to generate images in HTML! Not all browsers support it, but they probably will at some point. The point is, I've been experimenting a little with it, and to my delight it's actually pretty easy to work with. If you see something in one of my experiments that you like, feel free to copy-paste. Consider it free software.
|
||||
<div id='error'>Your browser doesn't support use of the canvas tag. I haven't included error detection in my experiments, so your browser is likely to show an error. Browsers that support canvas include Firefox, Opera and Safari.</div>
|
||||
<h1>Here it is:</h1>
|
||||
<div id='experiments'>
|
||||
<?php echo $sites; ?>
|
||||
</div>
|
||||
Hopefully your browser won't crash..
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
98
subsites/projects/canvas/poly.htm
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Polygons</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function drawpoly(x,y,angles,radius,rotate) {
|
||||
var x,y,angles,radius,rotate,angdif,cang,cx,xy,i
|
||||
if (!x) x=320
|
||||
if (!y) y=200
|
||||
if (!angles) angles=5
|
||||
if (!radius) radius=50
|
||||
if (!rotate) rotate=0
|
||||
angdif=360/angles
|
||||
cang=90-rotate
|
||||
cx=Math.cos(cang*Math.PI/180)*radius
|
||||
cy=-Math.sin(cang*Math.PI/180)*radius
|
||||
for (i=1;i<angles+1;i++) {
|
||||
cang=i*angdif+90-rotate
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x+cx,y+cy)
|
||||
cx=Math.cos(cang*Math.PI/180)*radius
|
||||
cy=-Math.sin(cang*Math.PI/180)*radius
|
||||
ctx.lineTo(x+cx,y+cy)
|
||||
ctx.stroke()
|
||||
}
|
||||
}
|
||||
|
||||
function dps() {
|
||||
ctx.clearRect(0,0,640,400)
|
||||
for (var i=0;i<num;i++) {
|
||||
drawpoly(gx[i],gy[i],gang[i],grad[i],grot[i])
|
||||
grad[i]+=mrad[i]*Math.floor(Math.random()*3)
|
||||
if (grad[i]<10) mrad[i]=1
|
||||
else if (grad[i]>100) mrad[i]=-1
|
||||
|
||||
grot[i]+=mrot[i]*Math.floor(Math.random()*3)
|
||||
if (grot[i]<0) mrot[i]=1
|
||||
else if (grot[i]>360) mrot[i]=-1
|
||||
|
||||
gx[i]+=mdirx[i]*(Math.floor(Math.random()*5)+1)
|
||||
gy[i]+=mdiry[i]*(Math.floor(Math.random()*5)+1)
|
||||
if (gx[i]<grad[i]+5) mdirx[i]=1
|
||||
else if (gx[i]>640-grad[i]-5) mdirx[i]=-1
|
||||
if (gy[i]<grad[i]+5) mdiry[i]=1
|
||||
else if (gy[i]>400-grad[i]-5) mdiry[i]=-1
|
||||
}
|
||||
setTimeout("dps()",40)
|
||||
}
|
||||
|
||||
function load() {
|
||||
ctx=document.getElementById('canvas').getContext('2d')
|
||||
gang=new Array()
|
||||
grad=new Array()
|
||||
grot=new Array()
|
||||
gx=new Array()
|
||||
gy=new Array()
|
||||
mdirx=new Array()
|
||||
mdiry=new Array()
|
||||
mrad=new Array()
|
||||
mrot=new Array()
|
||||
num=10
|
||||
for (var i=0;i<num;i++) {
|
||||
gang[i]=Math.floor(Math.random()*8)+3
|
||||
grad[i]=Math.floor(Math.random()*26)+25
|
||||
grot[i]=Math.floor(Math.random()*360)
|
||||
gx[i]=Math.floor(Math.random()*(640-grad[i]*2))+grad[i]
|
||||
gy[i]=Math.floor(Math.random()*(400-grad[i]*2))+grad[i]
|
||||
|
||||
mdirx[i]=Math.floor(Math.random()*2)*2-1
|
||||
mdiry[i]=Math.floor(Math.random()*2)*2-1
|
||||
mrad[i]=Math.floor(Math.random()*2)*2-1
|
||||
mrot[i]=Math.floor(Math.random()*2)*2-1
|
||||
}
|
||||
dps()
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
43
subsites/projects/canvas/pr.htm
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Canvas picture rotating</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function ani() {
|
||||
ctx.rotate((Math.PI/180)*21)
|
||||
ctx.drawImage(img,-150,-84)
|
||||
setTimeout("ani()",40)
|
||||
}
|
||||
|
||||
function load() {
|
||||
img=new Image()
|
||||
img.onload=function(){
|
||||
ctx=document.getElementById('canvas').getContext('2d')
|
||||
ctx.translate(320,200)
|
||||
ani()
|
||||
}
|
||||
img.src="img/kr.jpg"
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
66
subsites/projects/canvas/rc.htm
Normal file
@@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Random canvas circles</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function ani() {
|
||||
var ctx = document.getElementById('canvas').getContext('2d');
|
||||
|
||||
ctx.clearRect(0,0,640,400);
|
||||
|
||||
for (var i=0;i<num;i++) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(a[i],b[i],c[i],0,Math.PI*2,true);
|
||||
ctx.stroke();
|
||||
nc=c[i]+Math.floor(Math.random()*3)-1
|
||||
if (nc<25) nc=25
|
||||
else if (nc>75) nc=75
|
||||
c[i]=nc
|
||||
nb=b[i]+Math.floor(Math.random()*3)-1
|
||||
if (nb<c[i]) nb=c[i]
|
||||
else if (nb>400-c[i]) nb=400-c[i]
|
||||
b[i]=nb
|
||||
na=a[i]+Math.floor(Math.random()*3)-1
|
||||
if (na<c[i]) na=c[i]
|
||||
else if (na>640-c[i]) na=640-c[i]
|
||||
a[i]=na
|
||||
}
|
||||
|
||||
setTimeout("ani()",40)
|
||||
}
|
||||
|
||||
function load() {
|
||||
a=new Array()
|
||||
b=new Array()
|
||||
c=new Array()
|
||||
num=10
|
||||
for (var i=0;i<num;i++) {
|
||||
c[i]=Math.floor(Math.random()*50)+25
|
||||
b[i]=Math.floor(Math.random()*(400-c[i]*2))+c[i]
|
||||
a[i]=Math.floor(Math.random()*(640-c[i]*2))+c[i]
|
||||
}
|
||||
ani()
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
59
subsites/projects/canvas/vc.htm
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3c.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Vortex of canvas circles</title>
|
||||
<style type='text/css'>
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position:absolute;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-top:-200px;
|
||||
margin-left:-320px;
|
||||
border:1px solid #000;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function ani() {
|
||||
var ctx=document.getElementById('canvas').getContext('2d')
|
||||
c++
|
||||
cd=Math.round((t-c)/d)
|
||||
ctx.strokeStyle="rgb("+cd+","+cd+","+cd+")"
|
||||
ctx.beginPath()
|
||||
ctx.arc(x,y,rr,0,Math.PI*2,true)
|
||||
ctx.stroke()
|
||||
|
||||
rr+=p
|
||||
do {
|
||||
nx=x+(Math.floor(Math.random()*11)-5)
|
||||
ny=y+(Math.floor(Math.random()*11)-5)
|
||||
} while (nx-rr<2 || nx+rr>637 || ny-rr<2 || ny+rr>397)
|
||||
x=nx
|
||||
y=ny
|
||||
|
||||
if (rr<r) setTimeout("ani()",40)
|
||||
}
|
||||
|
||||
function load() {
|
||||
x=320
|
||||
y=200
|
||||
r=180
|
||||
rr=0
|
||||
p=.5
|
||||
t=r/p
|
||||
d=t/255
|
||||
c=0
|
||||
ani()
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas' width='640' height='400'></canvas>
|
||||
</body>
|
||||
</html>
|
||||
1
subsites/projects/dsktp/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bak/
|
||||