files
This commit is contained in:
675
LICENSE.md
Normal file
675
LICENSE.md
Normal file
@@ -0,0 +1,675 @@
|
||||
### GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
<https://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 <https://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 <https://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 <https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
13
README.md
Normal file
13
README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Spatial Scaffolding for Future of Text / Sloan grant on auhoring in XR, Quarter 4
|
||||
|
||||
- code related to small explorations during this quarter is in `data/index.html` with `username=q4_`
|
||||
|
||||
Building on https://git.benetou.fr/utopiah/text-code-xr-engine this environment aims at authoring academic text in XR, specifically VR first.
|
||||
|
||||
You can setup the backend via the Dockerfile. It will spawn a NodeJS server. Note that a working WebDAV server is required and for that https://github.com/bfren/docker-nginx-webdav is recommended.
|
||||
|
||||
The data directory includes the frontend with its `filters/`.
|
||||
|
||||
The core XR interactions are done via `jxr-core.js`
|
||||
|
||||
See https://futuretextlab.info for discussions, including videos, on the motivation behind this work.
|
||||
24
backend/Dockerfile
Normal file
24
backend/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
FROM node:20-alpine
|
||||
# probably a bad start here as a lot of packages are large so no benefit
|
||||
# could restart from Debian instead
|
||||
|
||||
RUN apk add ghostscript # tested for .pdf via convert
|
||||
RUN apk add qpdf # to save as new PDF
|
||||
RUN apk add font-noto # montage from imagemagick requires some fonts
|
||||
RUN apk add imagemagick # tested for .jpg and .pdf
|
||||
RUN apk add ffmpeg # for ogg tts (could probably find smaller...)
|
||||
RUN apk add poppler-utils # for pdftohtml getting XML and images out with positions
|
||||
|
||||
RUN apk add wget curl jq bash # for ifixit cachers
|
||||
|
||||
WORKDIR /usr/app
|
||||
COPY ./stt/whisper.cpp/ /usr/app
|
||||
COPY ./ /usr/app
|
||||
|
||||
RUN npm install
|
||||
# for now cheating with ./node_modules already there
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
# Set up a default command
|
||||
CMD [ "node","." ]
|
||||
1
backend/assets.mapped.layout.json
Normal file
1
backend/assets.mapped.layout.json
Normal file
@@ -0,0 +1 @@
|
||||
[ {"filename":"console.aframe.component","position":"0 0 0","rotation":"0 0 0"}, {"filename":"hello_world.json","position":"0 0 0","rotation":"0 0 0"}, {"filename":"hello_world.txt","position":"1 1 -1.2","rotation":"0 -50 0"}, {"filename":"index.html","position":"0 0 0","rotation":"0 0 0"}, {"filename":"index.html.png","position":"0 0 0","rotation":"0 0 0"}, {"filename":"sloan_test.txt","position":"1.4 1.5 -1","rotation":"0 -80 0"}, {"filename":"SpaSca_JSONCanvas_export.canvas","position":"0 0 0","rotation":"0 0 0"} ]
|
||||
20
backend/assets.names
Normal file
20
backend/assets.names
Normal file
@@ -0,0 +1,20 @@
|
||||
kenney_supermarket_assets/bottle-return.glb
|
||||
kenney_supermarket_assets/cash-register.glb
|
||||
kenney_supermarket_assets/character-employee.glb
|
||||
kenney_supermarket_assets/column.glb
|
||||
kenney_supermarket_assets/display-bread.glb
|
||||
kenney_supermarket_assets/display-fruit.glb
|
||||
kenney_supermarket_assets/fence-door-rotate.glb
|
||||
kenney_supermarket_assets/fence.glb
|
||||
kenney_supermarket_assets/floor.glb
|
||||
kenney_supermarket_assets/freezer.glb
|
||||
kenney_supermarket_assets/freezers-standing.glb
|
||||
kenney_supermarket_assets/shelf-bags.glb
|
||||
kenney_supermarket_assets/shelf-boxes.glb
|
||||
kenney_supermarket_assets/shelf-end.glb
|
||||
kenney_supermarket_assets/shopping-basket.glb
|
||||
kenney_supermarket_assets/shopping-cart.glb
|
||||
kenney_supermarket_assets/wall-corner.glb
|
||||
kenney_supermarket_assets/wall-door-rotate.glb
|
||||
kenney_supermarket_assets/wall.glb
|
||||
kenney_supermarket_assets/wall-window.glb
|
||||
13
backend/cachers/ifixit_images
Executable file
13
backend/cachers/ifixit_images
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
ID=$1 #CLI parameter e.g 139627
|
||||
# should fail if no ID is provided or is not a number
|
||||
quality=medium
|
||||
cd ../public #becomes accessible via WebDAV
|
||||
cachepath=cached/ifixit_images/$ID/images/${quality}
|
||||
mkdir -p $cachepath
|
||||
curl https://www.ifixit.com/api/2.0/guides/$ID | jq ".steps[] | .media.data[] | .$quality" -r > ${cachepath}/${ID}_images${quality}
|
||||
wget -i ${cachepath}/${ID}_images${quality}
|
||||
mv *.medium $cachepath
|
||||
cd $cachepath
|
||||
for X in *medium; do mv $X $X.jpg; done
|
||||
curl -d "$ID $quality" https://ntfy.benetou.fr/ifixit_images
|
||||
14
backend/converters/epub.js
Normal file
14
backend/converters/epub.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const fs = require('fs');
|
||||
|
||||
function convert( filename, pages ){
|
||||
console.log(pages)
|
||||
if (filename.endsWith('.epub')) {
|
||||
let data = pages.map( p => "<img src='/"+filename+'-'+p+".jpg'/>").join('<br>')
|
||||
// could have a richer datastructure with e.g. p.number for the page number and p.x and p.y for CSS absolute positioning
|
||||
// probably need to apk add zip then zip the result
|
||||
const outputFile = './public/saved/epub/'+filename+'.epub'
|
||||
fs.writeFileSync(outputFile, data);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
13
backend/converters/html_from_pdf_with_image_urls.js
Normal file
13
backend/converters/html_from_pdf_with_image_urls.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const fs = require('fs');
|
||||
|
||||
function convert( filename, pages ){
|
||||
console.log(pages)
|
||||
if (filename.endsWith('.pdf')) {
|
||||
let data = pages.map( p => "<img src='/"+filename+'-'+p+".jpg'/>").join('<br>')
|
||||
// could have a richer datastructure with e.g. p.number for the page number and p.x and p.y for CSS absolute positioning
|
||||
const outputFile = './public/saved/html/'+filename+'.html'
|
||||
fs.writeFileSync(outputFile, data);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
10
backend/converters/montage.js
Normal file
10
backend/converters/montage.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const {execSync} = require('child_process')
|
||||
|
||||
function convert( filename, pages ){
|
||||
console.log(pages)
|
||||
if (filename.endsWith('.pdf')) {
|
||||
execSync( 'montage -font /usr/share/fonts/noto/NotoSansSymbols-Regular.ttf -geometry +0+0 -tile 5x '+pages.map( p => filename+'-'+p+'.jpg').join(' ')+' ./saved/montages/'+filename+'montage.jpg', {cwd:'public'})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
12
backend/converters/ogg_tts.js
Normal file
12
backend/converters/ogg_tts.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const {execSync} = require('child_process')
|
||||
|
||||
function convert( filename ){
|
||||
if (filename.endsWith('.ogg')) {
|
||||
//execSync( 'convert '+filename+' '+filename+'.jpg', {cwd:'public'})
|
||||
execSync( 'ffmpeg -i '+filename+' -ar 16000 -y /tmp/audio_for_tts.wav; LD_LIBRARY_PATH=/usr/app/stt/whisper.cpp/build/bin/ /usr/app/stt/whisper.cpp/build/bin/whisper-cli -f /tmp/audio_for_tts.wav -osrt -m /usr/app/stt/whisper.cpp/models/ggml-base.en.bin; mv /tmp/audio_for_tts.wav.srt '+filename+'.srt', {cwd:'public'})
|
||||
fetch('https://ntfy.benetou.fr/convertedwebdav', { method: 'POST', body: JSON.stringify({source: filename, extension: '.srt' }) })
|
||||
// could also update a file of conversions to keep track of provenance
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
11
backend/converters/pdf.js
Normal file
11
backend/converters/pdf.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const {execSync} = require('child_process')
|
||||
|
||||
function convert( filename ){
|
||||
if (filename.endsWith('.pdf')) {
|
||||
execSync( 'convert "'+filename+'" "'+filename+'.jpg"', {cwd:'public'})
|
||||
fetch('https://ntfy.benetou.fr/convertedwebdav', { method: 'POST', body: JSON.stringify({source: filename, extension: '.jpg' }) })
|
||||
// could also update a file of conversions to keep track of provenance
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
11
backend/converters/pdf_json.js
Normal file
11
backend/converters/pdf_json.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const {execSync} = require('child_process')
|
||||
|
||||
function convert( filename ){
|
||||
if (filename.endsWith('.pdf')) {
|
||||
execSync( 'node ../extract_as_json.js "public/'+filename+'"',{cwd:'public'})
|
||||
fetch('https://ntfy.benetou.fr/convertedwebdav', { method: 'POST', body: JSON.stringify({source: filename, extension: '.json' }) })
|
||||
// could also update a file of conversions to keep track of provenance
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
11
backend/converters/pdf_xml.js
Normal file
11
backend/converters/pdf_xml.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const {execSync} = require('child_process')
|
||||
|
||||
function convert( filename ){
|
||||
if (filename.endsWith('.pdf')) {
|
||||
execSync( 'cp "../../'+filename+'" . && pdftohtml -xml "'+filename+'"',{cwd:'public/saved/pdfxml'})
|
||||
fetch('https://ntfy.benetou.fr/convertedwebdav', { method: 'POST', body: JSON.stringify({source: filename, extension: '.xml' }) })
|
||||
// could also update a file of conversions to keep track of provenance
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
11
backend/converters/ppt.js
Normal file
11
backend/converters/ppt.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const {execSync} = require('child_process')
|
||||
|
||||
function convert( filename ){
|
||||
if (filename.endsWith('.ppt')) {
|
||||
execSync( 'soffice '+filename+' '+filename+'.jpg', {cwd:'public'})
|
||||
fetch('https://ntfy.benetou.fr/convertedwebdav', { method: 'POST', body: JSON.stringify({source: filename, extension: '.jpg' }) })
|
||||
// could also update a file of conversions to keep track of provenance
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
10
backend/converters/resortedpdf.js
Normal file
10
backend/converters/resortedpdf.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const {execSync} = require('child_process')
|
||||
|
||||
function convert( filename, pages ){
|
||||
console.log(pages)
|
||||
if (filename.endsWith('.pdf')) {
|
||||
execSync( 'qpdf '+filename+' --pages '+filename+' '+pages.join(',')+' -- ./saved/pdf/'+filename, {cwd:'public'})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.convert = convert
|
||||
31
backend/custom-mime-example.xml
Normal file
31
backend/custom-mime-example.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
from /usr/share/mime/packages/
|
||||
once modified should run update-mime-database
|
||||
or probably sufficient thus better, in user mode
|
||||
~/.local/share/mime/ then namely update-mime-database ~/.local/share/mime/
|
||||
https://unix.stackexchange.com/a/564888/486198
|
||||
|
||||
could be done for
|
||||
.images.json
|
||||
.aframe.component
|
||||
.extractedpdf.json
|
||||
.exported_author.json
|
||||
.layout.json
|
||||
.layout.json
|
||||
.packeddirectory.json
|
||||
.jxrstyles.json
|
||||
.aframe.entity
|
||||
.canvas
|
||||
.2dmap.png
|
||||
.webannotation.json
|
||||
|
||||
.pmwiki
|
||||
.glb
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-jxr">
|
||||
<comment>jxr Model</comment>
|
||||
<glob pattern="*.jxr"/>
|
||||
<icon name="jxr"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
16
backend/extract_as_json.js
Normal file
16
backend/extract_as_json.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const PDFExtract = require('pdf.js-extract').PDFExtract;
|
||||
const pdfExtract = new PDFExtract();
|
||||
const options = {};
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
var args = process.argv.slice(2)
|
||||
//console.log(args)
|
||||
if (args.length < 1) return console.log('missing input pdf filename');
|
||||
|
||||
const filename = args[0]
|
||||
const output = filename+'_text.json'
|
||||
pdfExtract.extract(filename, options, (err, data) => {
|
||||
if (err) return console.log(err);
|
||||
fs.writeFileSync(output, JSON.stringify(data) )
|
||||
});
|
||||
136
backend/index.js
Normal file
136
backend/index.js
Normal file
@@ -0,0 +1,136 @@
|
||||
const express = require('express')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const app = express()
|
||||
const port = 3000
|
||||
|
||||
const converters = ['convert' ]
|
||||
|
||||
app.get('/fileswithmetadata', (req, res) => {
|
||||
// should be sorted by modified date, see mtimeMs from fs.statSync(path)
|
||||
let files = []
|
||||
let raw = fs.readdirSync('public')
|
||||
raw.map( f => files.push( {name: f, metadata: fs.statSync(path.join('public',f)) }) )
|
||||
res.json( files )
|
||||
// consider also https://github.com/LinusU/fs-xattr
|
||||
})
|
||||
|
||||
app.get('/files', (req, res) => {
|
||||
res.json( fs.readdirSync('public') )
|
||||
// should be sorted by modified date, see mtimeMs from fs.statSync(path)
|
||||
})
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.redirect('/index.html')
|
||||
})
|
||||
|
||||
app.use(express.static('public'))
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`open https://companion.benetou.fr on your WebXR device`)
|
||||
});
|
||||
|
||||
app.get('/cachers/ifixit_images/:id', (req, res) => {
|
||||
let id = Number(req.params.id)
|
||||
if (!id && id<100) return
|
||||
const {execSync} = require('child_process') // might already be available via converters
|
||||
execSync( './ifixit_images '+id, {cwd:'cachers'})
|
||||
res.json('done') // also available via SSE
|
||||
})
|
||||
|
||||
app.get('/save-as-new-html/:filename/:pages', (req, res) => {
|
||||
pages = req.params.pages
|
||||
filename = req.params.filename // unsafe, can rewrite other files
|
||||
if (filename.startsWith('/') || filename.includes('..') || !filename.endsWith('.pdf')) return
|
||||
try{ JSON.parse(pages) } catch { console.log('not json, file NOT saved!'); res.json('failed saved, not proper JSON!'); return }
|
||||
pages = JSON.parse(pages)
|
||||
console.log('savedLayout', pages)
|
||||
//let savedFilename = Date.now()+'.resorted.pdf'
|
||||
require('./converters/html_from_pdf_with_image_urls.js').convert(filename, pages)
|
||||
res.json('saved/html/'+filename+'montage.jpg')
|
||||
//res.json(savedFilename)
|
||||
})
|
||||
|
||||
app.get('/save-as-new-montage/:filename/:pages', (req, res) => {
|
||||
pages = req.params.pages
|
||||
filename = req.params.filename // unsafe, can rewrite other files
|
||||
if (filename.startsWith('/') || filename.includes('..') || !filename.endsWith('.pdf')) return
|
||||
try{ JSON.parse(pages) } catch { console.log('not json, file NOT saved!'); res.json('failed saved, not proper JSON!'); return }
|
||||
pages = JSON.parse(pages)
|
||||
console.log('savedLayout', pages)
|
||||
//let savedFilename = Date.now()+'.resorted.pdf'
|
||||
require('./converters/montage.js').convert(filename, pages)
|
||||
res.json('saved/montage/'+filename+'montage.jpg')
|
||||
//res.json(savedFilename)
|
||||
})
|
||||
|
||||
app.get('/save-as-new-pdf/:filename/:pages', (req, res) => {
|
||||
pages = req.params.pages
|
||||
filename = req.params.filename // unsafe, can rewrite other files
|
||||
if (filename.startsWith('/') || filename.includes('..') || !filename.endsWith('.pdf')) return
|
||||
try{ JSON.parse(pages) } catch { console.log('not json, file NOT saved!'); res.json('failed saved, not proper JSON!'); return }
|
||||
pages = JSON.parse(pages)
|
||||
console.log('savedLayout', pages)
|
||||
//let savedFilename = Date.now()+'.resorted.pdf'
|
||||
require('./converters/resortedpdf.js').convert(filename, pages)
|
||||
res.json('saved/pdf/'+filename)
|
||||
//res.json(savedFilename)
|
||||
})
|
||||
|
||||
let savedLayout
|
||||
|
||||
app.get('/save-layout/:layout', (req, res) => {
|
||||
savedLayout = req.params.layout
|
||||
// unsafe, assume JSON but could be anything
|
||||
try{ JSON.parse(savedLayout) } catch { console.log('not json, file NOT saved!'); res.json('failed saved, not proper JSON!'); return }
|
||||
console.log('savedLayout', savedLayout)
|
||||
// could be saved to disk, thus to file, too
|
||||
let savedFilename = Date.now()+'.layout.json'
|
||||
fs.writeFileSync('./public/'+savedFilename, savedLayout)
|
||||
// might be better to save in a dedicated directory in ./public
|
||||
res.json(savedFilename)
|
||||
})
|
||||
|
||||
let newFiles = []
|
||||
fs.watch('public', (eventType, filename) => {
|
||||
console.log(`event type is: ${eventType}`); // rename can also be deleting...
|
||||
// could consequently check if the file still exists, if not, had been deleted
|
||||
if (filename) {
|
||||
|
||||
console.log(`filename provided: ${filename}`)
|
||||
if (eventType == "rename"){
|
||||
console.log("fs exists?", fs.existsSync('./public/'+filename)) // false despite existing
|
||||
if (!fs.existsSync('./public/'+filename)) {
|
||||
console.log(`${filename} deleted`)
|
||||
} else {
|
||||
// done on uploads because there might be temporary files that "accumuldates" until done then renamed
|
||||
sequentialConverters( filename )
|
||||
}
|
||||
}
|
||||
if (eventType == "change"){
|
||||
if (newFiles.includes(filename)){
|
||||
console.log( 'skip, not a new file')
|
||||
} else {
|
||||
// sendEventsToAll({filename,eventType}) former SSE way
|
||||
// fetch('https://ntfy.benetou.fr/fswatch', { method: 'POST', body: JSON.stringify({filename, eventType}) })
|
||||
console.log('new file', filename, '_________________________________________')
|
||||
if ( !filename.includes('.live') ) {
|
||||
newFiles.push(filename)
|
||||
// bypass on convention, e.g. live in the filename
|
||||
// alternatively could be a dedicated subdirectory
|
||||
} else { console.log('live file, no future ignoring') }
|
||||
sequentialConverters( filename )
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('filename not provided');
|
||||
}
|
||||
});
|
||||
|
||||
function sequentialConverters( filename ){
|
||||
require('./converters/pdf.js').convert(filename)
|
||||
require('./converters/pdf_json.js').convert(filename)
|
||||
require('./converters/ogg_tts.js').convert(filename)
|
||||
require('./converters/pdf_xml.js').convert(filename)
|
||||
}
|
||||
|
||||
28
backend/mapping
Normal file
28
backend/mapping
Normal file
@@ -0,0 +1,28 @@
|
||||
7 7 2 # 7 width, 7 high, 2 layers
|
||||
layer 0
|
||||
19 19 19 19 18 19 19
|
||||
19 09 09 09 09 09 20
|
||||
20 09 09 09 09 09 19
|
||||
19 09 09 09 09 09 19
|
||||
19 09 09 09 09 09 20
|
||||
20 09 09 09 09 09 19
|
||||
20 09 09 09 09 09 19
|
||||
19 19 20 19 19 20 19
|
||||
layer 0.1
|
||||
00 00 00 00 00 00 00
|
||||
00 10 10 10 10 10 00
|
||||
00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00
|
||||
00 13 13 00 13 13 00
|
||||
00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00
|
||||
00 10 10 10 10 10 00
|
||||
00 00 00 00 00 00 00
|
||||
rotations layer 0
|
||||
00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00
|
||||
3045
backend/package-lock.json
generated
Normal file
3045
backend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
6
backend/package.json
Normal file
6
backend/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"express": "^4.21.1",
|
||||
"pdf.js-extract": ""
|
||||
}
|
||||
}
|
||||
14
backend/packing_directory_script
Executable file
14
backend/packing_directory_script
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd public
|
||||
echo -n '[' > ../pack.json; for X in *;
|
||||
do
|
||||
echo -n "{\"filename\":\"$X\", \"content\":\"$(base64 -w0 $X)\"" >> ../pack.json;
|
||||
# curl --insecure -I https://192.168.0.129:3000/$X | grep "Content-Type" | sed 's/;.*//' | sed 's/\(.*\): \(.*\)/,"\1":"\2"/' #>> ../pack.json;
|
||||
echo -n ",\"contenttype\":\"" >> ../pack.json;
|
||||
curl --insecure -I -s -o /dev/null -w '%header{Content-Type}' https://192.168.0.129:3000/$X | sed 's/;.*//' >> ../pack.json;
|
||||
echo -n "\"}," >> ../pack.json;
|
||||
done;
|
||||
|
||||
sed -i "s/.$//" ../pack.json;
|
||||
echo -n "]" >> ../pack.json
|
||||
0
backend/pdf_xml.js
Normal file
0
backend/pdf_xml.js
Normal file
194
backend/pmwiki_reader.lua
Normal file
194
backend/pmwiki_reader.lua
Normal file
@@ -0,0 +1,194 @@
|
||||
-- Pandoc reader for PMWiki format: https://www.pmwiki.org/wiki/PmWiki/MarkupMasterIndex
|
||||
-- Using LPeg: https://www.inf.puc-rio.br/~roberto/lpeg/
|
||||
-- Inspired by https://pandoc.org/custom-readers.html
|
||||
local P, S, R, Cf, Cc, Ct, V, Cs, Cg, Cb, B, C, Cmt =
|
||||
lpeg.P, lpeg.S, lpeg.R, lpeg.Cf, lpeg.Cc, lpeg.Ct, lpeg.V,
|
||||
lpeg.Cs, lpeg.Cg, lpeg.Cb, lpeg.B, lpeg.C, lpeg.Cmt
|
||||
|
||||
local whitespacechar = S(" \t\r\n")
|
||||
local specialchar = S("/*~[]\\{}|")
|
||||
local wordchar = (1 - (whitespacechar + specialchar))
|
||||
local spacechar = S(" \t")
|
||||
local newline = P"\r"^-1 * P"\n"
|
||||
local blankline = spacechar^0 * newline
|
||||
local endline = newline * #-blankline
|
||||
local endequals = spacechar^0 * P"="^0 * spacechar^0 * newline
|
||||
local cellsep = spacechar^0 * P"|"
|
||||
local apostrophe = string.char(39)
|
||||
local doubleApo = P(apostrophe) * P(apostrophe)
|
||||
local fenced = '```\n%s\n```\n'
|
||||
local cellsep = spacechar^0 * P"||"
|
||||
|
||||
local function trim(s)
|
||||
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
|
||||
local function ListItem(lev, ch)
|
||||
local start
|
||||
if ch == nil then
|
||||
start = S"*#"
|
||||
else
|
||||
start = P(ch)
|
||||
end
|
||||
local subitem = function(c)
|
||||
if lev < 6 then
|
||||
return ListItem(lev + 1, c)
|
||||
else
|
||||
return (1 - 1) -- fails
|
||||
end
|
||||
end
|
||||
local parser = spacechar^0
|
||||
* start^lev
|
||||
* #(- start)
|
||||
* spacechar^0
|
||||
* Ct((V"Inline" - (newline * spacechar^0 * S"*#"))^0)
|
||||
* newline
|
||||
* (Ct(subitem("*")^1) / pandoc.BulletList
|
||||
+
|
||||
Ct(subitem("#")^1) / pandoc.OrderedList
|
||||
+
|
||||
Cc(nil))
|
||||
/ function (ils, sublist)
|
||||
return { pandoc.Plain(ils), sublist }
|
||||
end
|
||||
return parser
|
||||
end
|
||||
|
||||
-- Grammar
|
||||
G = P{ "Doc",
|
||||
Doc = Ct(V"Block"^0)
|
||||
/ pandoc.Pandoc ;
|
||||
Block = blankline^0
|
||||
* ( V"IndentedBlock"
|
||||
+ V"Header"
|
||||
+ V"HorizontalRule"
|
||||
+ V"CodeBlock"
|
||||
+ V"List"
|
||||
+ V"Table"
|
||||
+ V"Para"
|
||||
) ;
|
||||
IndentedBlock = C((spacechar^1
|
||||
* (1 - newline)^1
|
||||
* newline)^1
|
||||
)
|
||||
/ function(text)
|
||||
block = pandoc.RawBlock('markdown', fenced:format(text))
|
||||
return block
|
||||
end;
|
||||
CodeBlock = P"[@"
|
||||
* blankline
|
||||
* C((1 - (newline * P"@]"))^0)
|
||||
* newline
|
||||
* P"@]"
|
||||
/ function(text)
|
||||
block = pandoc.RawBlock('markdown', fenced:format(text))
|
||||
return block
|
||||
end;
|
||||
List = V"BulletList"
|
||||
+ V"OrderedList" ;
|
||||
BulletList = Ct(ListItem(1,'*')^1)
|
||||
/ pandoc.BulletList ;
|
||||
OrderedList = Ct(ListItem(1,'#')^1)
|
||||
/ pandoc.OrderedList ;
|
||||
Table = V"TableProperties"
|
||||
* (V"TableHeader" + Cc{})
|
||||
* Ct(V"TableRow"^1)
|
||||
/ function(headrow, bodyrows)
|
||||
local numcolumns = #(bodyrows[1])
|
||||
local aligns = {}
|
||||
local widths = {}
|
||||
for i = 1,numcolumns do
|
||||
aligns[i] = pandoc.AlignDefault
|
||||
widths[i] = 0
|
||||
end
|
||||
return pandoc.utils.from_simple_table(
|
||||
pandoc.SimpleTable({}, aligns, widths, headrow, bodyrows))
|
||||
end ;
|
||||
TableProperties = cellsep
|
||||
* spacechar^0
|
||||
* P("border=")
|
||||
* (1 - newline)^1
|
||||
* newline;
|
||||
TableHeader = Ct(V"HeaderCell"^1)
|
||||
* cellsep^-1
|
||||
* spacechar^0
|
||||
* newline ;
|
||||
TableRow = Ct(V"BodyCell"^1)
|
||||
* cellsep^-1
|
||||
* spacechar^0
|
||||
* newline ;
|
||||
HeaderCell = cellsep
|
||||
* P"!"^-1
|
||||
* spacechar^0
|
||||
* Ct((V"Inline" - (newline + cellsep))^0)
|
||||
/ function(ils) return { pandoc.Plain(ils) } end ;
|
||||
BodyCell = cellsep
|
||||
* spacechar^0
|
||||
* Ct((V"Inline" - (newline + cellsep))^0)
|
||||
/ function(ils) return { pandoc.Plain(ils) } end ;
|
||||
Para = Ct(V"Inline"^1)
|
||||
* newline
|
||||
/ pandoc.Para ;
|
||||
HorizontalRule = spacechar^0
|
||||
* P"----"
|
||||
* spacechar^0
|
||||
* newline
|
||||
/ pandoc.HorizontalRule;
|
||||
Header = (P("!")^1 / string.len)
|
||||
* spacechar^0
|
||||
* Ct((V"Inline" - endequals)^1)
|
||||
* endequals
|
||||
/ pandoc.Header;
|
||||
Inline = V"Link"
|
||||
+ V"Url"
|
||||
+ V"Code"
|
||||
+ V"Bold"
|
||||
+ V"Emph"
|
||||
+ V"Strikeout"
|
||||
+ V"Str"
|
||||
+ V"Space"
|
||||
+ V"Special";
|
||||
Link = P"[["
|
||||
* C((1 - (P"]]" + P"|"))^0)
|
||||
* (P"|" * Ct((V"Inline" - P"]]")^1))^-1
|
||||
* P"]]"
|
||||
/ function(url, desc)
|
||||
local txt = desc or {pandoc.Str(url)}
|
||||
return pandoc.Link(txt, url)
|
||||
end;
|
||||
Url = C(
|
||||
P"http"
|
||||
* P"s"^-1
|
||||
* P"://"
|
||||
* (1 - whitespacechar)^1
|
||||
)
|
||||
/ function(url)
|
||||
return pandoc.Link(url, url)
|
||||
end;
|
||||
Code = P'@@'
|
||||
* C((1 - P'@@')^0)
|
||||
* P'@@'
|
||||
/ trim / pandoc.Code;
|
||||
Emph = P"''"
|
||||
* C(((wordchar + whitespacechar) - P"''")^1)
|
||||
* P"''"
|
||||
/ pandoc.Emph;
|
||||
Bold = P"'''"
|
||||
* C(((wordchar + whitespacechar) - P"'''")^1)
|
||||
* P"'''"
|
||||
/ pandoc.Strong;
|
||||
Strikeout = P"{-"
|
||||
* C(((wordchar + whitespacechar) - P"-}")^1)
|
||||
* P"-}"
|
||||
/ pandoc.Strikeout;
|
||||
Str = wordchar^1
|
||||
/ pandoc.Str;
|
||||
Special = specialchar
|
||||
/ pandoc.Str;
|
||||
Space = spacechar^1
|
||||
/ pandoc.Space ;
|
||||
}
|
||||
|
||||
function Reader(input, reader_options)
|
||||
return lpeg.match(G, tostring(input))
|
||||
end
|
||||
2
backend/stt/whisper_setup.txt
Normal file
2
backend/stt/whisper_setup.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
ffmpeg -i public/poweruser_audiofile.ogg -ar 16000 -y terst.wav
|
||||
LD_LIBRARY_PATH=/usr/app/whisper.cpp/build/bin/ /usr/app/whisper.cpp/build/bin/whisper-cli -f terst.wav -m /usr/app/whisper.cpp/models/ggml-base.en.bin
|
||||
26
backend/withdefault.jxrstyles.json
Normal file
26
backend/withdefault.jxrstyles.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"default" : [
|
||||
{"selector":"#start_file_sloan_testtxt_end_file_hello_worldtxt", "attribute":"line", "value": "color:blue"},
|
||||
{"selector":"a-sky", "attribute":"color", "value": "lightblue"},
|
||||
{"selector":".notes", "attribute":"color", "value": "purple"},
|
||||
{"selector":".notes", "attribute":"outline-color", "value": "darkblue"},
|
||||
{"selector":"a-troika-text a-plane", "attribute":"color", "value": "white"},
|
||||
{"selector":"a-troika-text a-triangle", "attribute":"color", "value": "gray"}
|
||||
],
|
||||
"light" : [
|
||||
{"selector":"#start_file_sloan_testtxt_end_file_hello_worldtxt", "attribute":"line", "value": "color:blue"},
|
||||
{"selector":"a-sky", "attribute":"color", "value": "gray"},
|
||||
{"selector":".notes", "attribute":"color", "value": "black"},
|
||||
{"selector":".notes", "attribute":"outline-color", "value": "white"},
|
||||
{"selector":"a-troika-text a-plane", "attribute":"color", "value": "red"},
|
||||
{"selector":"a-troika-text a-triangle", "attribute":"color", "value": "darkred"}
|
||||
],
|
||||
"print" : [
|
||||
{"selector":"#start_file_sloan_testtxt_end_file_hello_worldtxt", "attribute":"line", "value": "color:brown"},
|
||||
{"selector":"a-sky", "attribute":"color", "value": "#EEE"},
|
||||
{"selector":".notes", "attribute":"color", "value": "black"},
|
||||
{"selector":".notes", "attribute":"outline-color", "value": "white"},
|
||||
{"selector":"a-troika-text a-plane", "attribute":"color", "value": "lightyellow"},
|
||||
{"selector":"a-troika-text a-triangle", "attribute":"color", "value": "orange"}
|
||||
]
|
||||
}
|
||||
50
data/Horn.svg_sidecar_filter.js
Normal file
50
data/Horn.svg_sidecar_filter.js
Normal file
@@ -0,0 +1,50 @@
|
||||
function filterTemplateExample( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentType.includes("svg") && contentFilename.includes("svg") ) {
|
||||
console.log('it is a SVG sidecar file filter example', contentFilename)
|
||||
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
|
||||
console.log( "mereology", openingOptions.mereology )
|
||||
switch( openingOptions.mereology ) {
|
||||
case "whole":
|
||||
addNewNote(txt, "0 1.4 -.8")
|
||||
break;
|
||||
case "listonly":
|
||||
default:
|
||||
txt.replaceAll('* ','').split('\n').map( (c,i) => addNewNote(c, "0 "+(1+i/10)+" -.8") )
|
||||
// could had here
|
||||
}
|
||||
|
||||
const rootEl = document.createElement("a-entity")
|
||||
// having a root element to attach on makes manipulation later on easier and safer, bringing a context for later modifications
|
||||
rootEl.fromfile = txt
|
||||
// to make the data usable, better with JSON or per element but still potentially useful by other elements
|
||||
file.filteredEl = rootEl
|
||||
rootEl.test = _ => console.log( 'test' )
|
||||
// function that can then be called on the created element later on
|
||||
// e.g. filesWithMetadata["https://companion.benetou.fr/saved/pdfxml/3209542.3209570.xml"].filteredEl.nextPage('ok')
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
|
||||
AFRAME.scenes[0].emit('templatesidecarexampleloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("templateexampleloaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterTemplateExample )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
842
data/colors.json
Normal file
842
data/colors.json
Normal file
@@ -0,0 +1,842 @@
|
||||
[
|
||||
{
|
||||
"name": "INDIANRED",
|
||||
"hex": "#CD5C5C",
|
||||
"rgb": "RGB(205, 92, 92)",
|
||||
"families": ["red", "brown"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTCORAL",
|
||||
"hex": "#F08080",
|
||||
"rgb": "RGB(240, 128, 128)",
|
||||
"families": ["red", "pink", "coral", "light"]
|
||||
},
|
||||
{
|
||||
"name": "SALMON",
|
||||
"hex": "#FA8072",
|
||||
"rgb": "RGB(250, 128, 114)",
|
||||
"families": ["red", "pink", "orange", "salmon"]
|
||||
},
|
||||
{
|
||||
"name": "DARKSALMON",
|
||||
"hex": "#E9967A",
|
||||
"rgb": "RGB(233, 150, 122)",
|
||||
"families": ["red", "pink", "orange", "salmon", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTSALMON",
|
||||
"hex": "#FFA07A",
|
||||
"rgb": "RGB(255, 160, 122)",
|
||||
"families": ["red", "pink", "orange", "salmon", "light"]
|
||||
},
|
||||
{
|
||||
"name": "CRIMSON",
|
||||
"hex": "#DC143C",
|
||||
"rgb": "RGB(220, 20, 60)",
|
||||
"families": ["red"]
|
||||
},
|
||||
{
|
||||
"name": "RED",
|
||||
"hex": "#FF0000",
|
||||
"rgb": "RGB(255, 0, 0)",
|
||||
"families": ["red"]
|
||||
},
|
||||
{
|
||||
"name": "DARKRED",
|
||||
"hex": "#8B0000",
|
||||
"rgb": "RGB(139, 0, 0)",
|
||||
"families": ["red", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "PINK",
|
||||
"hex": "#FFC0CB",
|
||||
"rgb": "RGB(255, 192, 203)",
|
||||
"families": ["pink"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTPINK",
|
||||
"hex": "#FFB6C1",
|
||||
"rgb": "RGB(255, 182, 193)",
|
||||
"families": ["pink", "light"]
|
||||
},
|
||||
{
|
||||
"name": "HOTPINK",
|
||||
"hex": "#FF69B4",
|
||||
"rgb": "RGB(255, 105, 180)",
|
||||
"families": ["pink", "hot"]
|
||||
},
|
||||
{
|
||||
"name": "DEEPPINK",
|
||||
"hex": "#FF1493",
|
||||
"rgb": "RGB(255, 20, 147)",
|
||||
"families": ["pink", "deep"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMVIOLETRED",
|
||||
"hex": "#C71585",
|
||||
"rgb": "RGB(199, 21, 133)",
|
||||
"families": ["pink", "purple", "violet", "medium"]
|
||||
},
|
||||
{
|
||||
"name": "PALEVIOLETRED",
|
||||
"hex": "#DB7093",
|
||||
"rgb": "RGB(219, 112, 147)",
|
||||
"families": ["pink", "pale", "violet"]
|
||||
},
|
||||
{
|
||||
"name": "CORAL",
|
||||
"hex": "#FF7F50",
|
||||
"rgb": "RGB(255, 127, 80)",
|
||||
"families": ["orange", "coral"]
|
||||
},
|
||||
{
|
||||
"name": "TOMATO",
|
||||
"hex": "#FF6347",
|
||||
"rgb": "RGB(255, 99, 71",
|
||||
"families": ["orange", "red"]
|
||||
},
|
||||
{
|
||||
"name": "ORANGERED",
|
||||
"hex": "#FF4500",
|
||||
"rgb": "RGB(255, 69, 0)",
|
||||
"families": ["orange", "red"]
|
||||
},
|
||||
{
|
||||
"name": "DARKORANGE",
|
||||
"hex": "#FF8C00",
|
||||
"rgb": "RGB(255, 140, 0)",
|
||||
"families": ["orange", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "ORANGE",
|
||||
"hex": "#FFA500",
|
||||
"rgb": "RGB(255, 165, 0)",
|
||||
"families": ["orange"]
|
||||
},
|
||||
{
|
||||
"name": "GOLD",
|
||||
"hex": "#FFD700",
|
||||
"rgb": "RGB(255, 215, 0)",
|
||||
"families": ["yellow"]
|
||||
},
|
||||
{
|
||||
"name": "YELLOW",
|
||||
"hex": "#FFFF00",
|
||||
"rgb": "RGB(255, 255, 0)",
|
||||
"families": ["yellow"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTYELLOW",
|
||||
"hex": "#FFFFE0",
|
||||
"rgb": "RGB(255, 255, 224)",
|
||||
"families": ["yellow", "light"]
|
||||
},
|
||||
{
|
||||
"name": "LEMONCHIFFON",
|
||||
"hex": "#FFFACD",
|
||||
"rgb": "RGB(255, 250, 205)",
|
||||
"families": ["yellow", "lemon"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTGOLDENRODYELLOW",
|
||||
"hex": "#FAFAD2",
|
||||
"rgb": "RGB(250, 250, 210)",
|
||||
"families": ["yellow", "light", "goldenrod", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "PAPAYAWHIP",
|
||||
"hex": "#FFEFD5",
|
||||
"rgb": "RGB(255, 239, 213)",
|
||||
"families": ["pink", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "MOCCASIN",
|
||||
"hex": "#FFE4B5",
|
||||
"rgb": "RGB(255, 228, 181)",
|
||||
"families": ["pink", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "PEACHPUFF",
|
||||
"hex": "#FFDAB9",
|
||||
"rgb": "RGB(255, 218, 185)",
|
||||
"families": ["pink", "orange", "peach"]
|
||||
},
|
||||
{
|
||||
"name": "PALEGOLDENROD",
|
||||
"hex": "#EEE8AA",
|
||||
"rgb": "RGB(238, 232, 170)",
|
||||
"families": ["yellow", "tan", "pale", "goldenrod"]
|
||||
},
|
||||
{
|
||||
"name": "KHAKI",
|
||||
"hex": "#F0E68C",
|
||||
"rgb": "RGB(240, 230, 140)",
|
||||
"families": ["yellow", "tan", "khaki"]
|
||||
},
|
||||
{
|
||||
"name": "DARKKHAKI",
|
||||
"hex": "#BDB76B",
|
||||
"rgb": "RGB(189, 183, 107)",
|
||||
"families": ["yellow", "tan", "khaki", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "LAVENDER",
|
||||
"hex": "#E6E6FA",
|
||||
"rgb": "RGB(230, 230, 250)",
|
||||
"families": ["purple"]
|
||||
},
|
||||
{
|
||||
"name": "THISTLE",
|
||||
"hex": "#D8BFD8",
|
||||
"rgb": "RGB(216, 191, 216)",
|
||||
"families": ["purple"]
|
||||
},
|
||||
{
|
||||
"name": "PLUM",
|
||||
"hex": "#DDA0DD",
|
||||
"rgb": "RGB(221, 160, 221)",
|
||||
"families": ["purple"]
|
||||
},
|
||||
{
|
||||
"name": "VIOLET",
|
||||
"hex": "#EE82EE",
|
||||
"rgb": "RGB(238, 130, 238)",
|
||||
"families": ["purple", "violet", "pink"]
|
||||
},
|
||||
{
|
||||
"name": "ORCHID",
|
||||
"hex": "#DA70D6",
|
||||
"rgb": "RGB(218, 112, 214)",
|
||||
"families": ["purple", "orchid"]
|
||||
},
|
||||
{
|
||||
"name": "FUCHSIA",
|
||||
"hex": "#FF00FF",
|
||||
"rgb": "RGB(255, 0, 255)",
|
||||
"families": ["purple", "pink"]
|
||||
},
|
||||
{
|
||||
"name": "MAGENTA",
|
||||
"hex": "#FF00FF",
|
||||
"rgb": "RGB(255, 0, 255)",
|
||||
"families": ["purple", "pink", "magenta"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMORCHID",
|
||||
"hex": "#BA55D3",
|
||||
"rgb": "RGB(186, 85, 211)",
|
||||
"families": ["purple", "orchid", "medium"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMPURPLE",
|
||||
"hex": "#9370DB",
|
||||
"rgb": "RGB(147, 112, 219)",
|
||||
"families": ["purple", "medium"]
|
||||
},
|
||||
{
|
||||
"name": "REBECCAPURPLE",
|
||||
"hex": "#663399",
|
||||
"rgb": "RGB(102, 51, 153)",
|
||||
"families": ["purple", "blue"]
|
||||
},
|
||||
{
|
||||
"name": "BLUEVIOLET",
|
||||
"hex": "#8A2BE2",
|
||||
"rgb": "RGB(138, 43, 226)",
|
||||
"families": ["purple", "blue", "violet"]
|
||||
},
|
||||
{
|
||||
"name": "DARKVIOLET",
|
||||
"hex": "#9400D3",
|
||||
"rgb": "RGB(148, 0, 211)",
|
||||
"families": ["purple", "dark", "violet"]
|
||||
},
|
||||
{
|
||||
"name": "DARKORCHID",
|
||||
"hex": "#9932CC",
|
||||
"rgb": "RGB(153, 50, 204)",
|
||||
"families": ["purple", "dark", "orchid"]
|
||||
},
|
||||
{
|
||||
"name": "DARKMAGENTA",
|
||||
"hex": "#8B008B",
|
||||
"rgb": "RGB(139, 0, 139)",
|
||||
"families": ["purple", "dark", "magenta"]
|
||||
},
|
||||
{
|
||||
"name": "PURPLE",
|
||||
"hex": "#800080",
|
||||
"rgb": "RGB(128, 0, 128)",
|
||||
"families": ["purple"]
|
||||
},
|
||||
{
|
||||
"name": "INDIGO",
|
||||
"hex": "#4B0082",
|
||||
"rgb": "RGB(75, 0, 130)",
|
||||
"families": ["purple", "blue"]
|
||||
},
|
||||
{
|
||||
"name": "SLATEBLUE",
|
||||
"hex": "#6A5ACD",
|
||||
"rgb": "RGB(106, 90, 205)",
|
||||
"families": ["purple", "blue", "slate"]
|
||||
},
|
||||
{
|
||||
"name": "DARKSLATEBLUE",
|
||||
"hex": "#483D8B",
|
||||
"rgb": "RGB(72, 61, 139)",
|
||||
"families": ["purple", "blue", "slate", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMSLATEBLUE",
|
||||
"hex": "#7B68EE",
|
||||
"rgb": "RGB(123, 104, 238)",
|
||||
"families": ["purple", "blue", "slate", "medium"]
|
||||
},
|
||||
{
|
||||
"name": "GREENYELLOW",
|
||||
"hex": "#ADFF2F",
|
||||
"rgb": "RGB(173, 255, 47)",
|
||||
"families": ["green", "yellow"]
|
||||
},
|
||||
{
|
||||
"name": "CHARTREUSE",
|
||||
"hex": "#7FFF00",
|
||||
"rgb": "RGB(127, 255, 0)",
|
||||
"families": ["green"]
|
||||
},
|
||||
{
|
||||
"name": "LAWNGREEN",
|
||||
"hex": "#7CFC00",
|
||||
"rgb": "RGB(124, 252, 0)",
|
||||
"families": ["green"]
|
||||
},
|
||||
{
|
||||
"name": "LIME",
|
||||
"hex": "#00FF00",
|
||||
"rgb": "RGB(0, 255, 0)",
|
||||
"families": ["green"]
|
||||
},
|
||||
{
|
||||
"name": "LIMEGREEN",
|
||||
"hex": "#32CD32",
|
||||
"rgb": "RGB(50, 205, 50)",
|
||||
"families": ["green"]
|
||||
},
|
||||
{
|
||||
"name": "PALEGREEN",
|
||||
"hex": "#98FB98",
|
||||
"rgb": "RGB(152, 251, 152)",
|
||||
"families": ["green", "pale"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTGREEN",
|
||||
"hex": "#90EE90",
|
||||
"rgb": "RGB(144, 238, 144)",
|
||||
"families": ["green", "light"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMSPRINGGREEN",
|
||||
"hex": "#00FA9A",
|
||||
"rgb": "RGB(0, 250, 154)",
|
||||
"families": ["green", "medium", "spring"]
|
||||
},
|
||||
{
|
||||
"name": "SPRINGGREEN",
|
||||
"hex": "#00FF7F",
|
||||
"rgb": "RGB(0, 255, 127)",
|
||||
"families": ["green", "spring"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMSEAGREEN",
|
||||
"hex": "#3CB371",
|
||||
"rgb": "RGB(60, 179, 113)",
|
||||
"families": ["green", "sea", "medium"]
|
||||
},
|
||||
{
|
||||
"name": "SEAGREEN",
|
||||
"hex": "#2E8B57",
|
||||
"rgb": "RGB(46, 139, 87)",
|
||||
"families": ["green", "sea"]
|
||||
},
|
||||
{
|
||||
"name": "FORESTGREEN",
|
||||
"hex": "#228B22",
|
||||
"rgb": "RGB(34, 139, 34)",
|
||||
"families": ["green", "forest"]
|
||||
},
|
||||
{
|
||||
"name": "GREEN",
|
||||
"hex": "#008000",
|
||||
"rgb": "RGB(0, 128, 0)",
|
||||
"families": ["green"]
|
||||
},
|
||||
{
|
||||
"name": "DARKGREEN",
|
||||
"hex": "#006400",
|
||||
"rgb": "RGB(0, 100, 0)",
|
||||
"families": ["green", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "YELLOWGREEN",
|
||||
"hex": "#9ACD32",
|
||||
"rgb": "RGB(154, 205, 50)",
|
||||
"families": ["green", "yellow"]
|
||||
},
|
||||
{
|
||||
"name": "OLIVEDRAB",
|
||||
"hex": "#6B8E23",
|
||||
"rgb": "RGB(107, 142, 35)",
|
||||
"families": ["green", "olive"]
|
||||
},
|
||||
{
|
||||
"name": "OLIVE",
|
||||
"hex": "#6B8E23",
|
||||
"rgb": "RGB(128, 128, 0)",
|
||||
"families": ["green", "olive"]
|
||||
},
|
||||
{
|
||||
"name": "DARKOLIVEGREEN",
|
||||
"hex": "#556B2F",
|
||||
"rgb": "RGB(85, 107, 47)",
|
||||
"families": ["green", "olive", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMAQUAMARINE",
|
||||
"hex": "#66CDAA",
|
||||
"rgb": "RGB(102, 205, 170)",
|
||||
"families": ["green", "blue", "aquamarine", "medium"]
|
||||
},
|
||||
{
|
||||
"name": "DARKSEAGREEN",
|
||||
"hex": "#8FBC8B",
|
||||
"rgb": "RGB(143, 188, 139)",
|
||||
"families": ["green", "sea", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTSEAGREEN",
|
||||
"hex": "#20B2AA",
|
||||
"rgb": "RGB(32, 178, 170)",
|
||||
"families": ["green", "blue", "sea", "light"]
|
||||
},
|
||||
{
|
||||
"name": "DARKCYAN",
|
||||
"hex": "#008B8B",
|
||||
"rgb": "RGB(0, 139, 139)",
|
||||
"families": ["green", "blue", "cyan", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "TEAL",
|
||||
"hex": "#008080",
|
||||
"rgb": "RGB(0, 128, 128)",
|
||||
"families": ["green", "blue"]
|
||||
},
|
||||
{
|
||||
"name": "AQUA",
|
||||
"hex": "#00FFFF",
|
||||
"rgb": "RGB(0, 255, 255)",
|
||||
"families": ["blue", "aqua"]
|
||||
},
|
||||
{
|
||||
"name": "CYAN",
|
||||
"hex": "#00FFFF",
|
||||
"rgb": "RGB(0, 255, 255)",
|
||||
"families": ["blue", "cyan"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTCYAN",
|
||||
"hex": "#E0FFFF",
|
||||
"rgb": "RGB(224, 255, 255)",
|
||||
"families": ["blue", "cyan", "light"]
|
||||
},
|
||||
{
|
||||
"name": "PALETURQUOISE",
|
||||
"hex": "#AFEEEE",
|
||||
"rgb": "RGB(175, 238, 238)",
|
||||
"families": ["blue", "turquoise", "pale"]
|
||||
},
|
||||
{
|
||||
"name": "AQUAMARINE",
|
||||
"hex": "#7FFFD4",
|
||||
"rgb": "RGB(127, 255, 212)",
|
||||
"families": ["blue", "aquamarine"]
|
||||
},
|
||||
{
|
||||
"name": "TURQUOISE",
|
||||
"hex": "#40E0D0",
|
||||
"rgb": "RGB(64, 224, 208)",
|
||||
"families": ["blue", "turquoise"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMTURQUOISE",
|
||||
"hex": "#48D1CC",
|
||||
"rgb": "RGB(72, 209, 204)",
|
||||
"families": ["blue", "turquoise", "medium"]
|
||||
},
|
||||
{
|
||||
"name": "DARKTURQUOISE",
|
||||
"hex": "#00CED1",
|
||||
"rgb": "RGB(0, 206, 209)",
|
||||
"families": ["blue", "turquoise", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "CADETBLUE",
|
||||
"hex": "#5F9EA0",
|
||||
"rgb": "RGB(95, 158, 160)",
|
||||
"families": ["blue", "gray"]
|
||||
},
|
||||
{
|
||||
"name": "STEELBLUE",
|
||||
"hex": "#4682B4",
|
||||
"rgb": "RGB(70, 130, 180)",
|
||||
"families": ["blue", "steel"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTSTEELBLUE",
|
||||
"hex": "#B0C4DE",
|
||||
"rgb": "RGB(176, 196, 222)",
|
||||
"families": ["blue", "steel", "light"]
|
||||
},
|
||||
{
|
||||
"name": "POWDERBLUE",
|
||||
"hex": "#B0E0E6",
|
||||
"rgb": "RGB(176, 224, 230)",
|
||||
"families": ["blue"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTBLUE",
|
||||
"hex": "#ADD8E6",
|
||||
"rgb": "RGB(173, 216, 230)",
|
||||
"families": ["blue", "light"]
|
||||
},
|
||||
{
|
||||
"name": "SKYBLUE",
|
||||
"hex": "#87CEEB",
|
||||
"rgb": "RGB(135, 206, 235)",
|
||||
"families": ["blue", "sky"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTSKYBLUE",
|
||||
"hex": "#87CEFA",
|
||||
"rgb": "RGB(135, 206, 250)",
|
||||
"families": ["blue", "sky", "light"]
|
||||
},
|
||||
{
|
||||
"name": "DEEPSKYBLUE",
|
||||
"hex": "#00BFFF",
|
||||
"rgb": "RGB(0, 191, 255)",
|
||||
"families": ["blue", "sky", "deep"]
|
||||
},
|
||||
{
|
||||
"name": "DODGERBLUE",
|
||||
"hex": "#1E90FF",
|
||||
"rgb": "RGB(30, 144, 255)",
|
||||
"families": ["blue"]
|
||||
},
|
||||
{
|
||||
"name": "CORNFLOWERBLUE",
|
||||
"hex": "#6495ED",
|
||||
"rgb": "RGB(100, 149, 237)",
|
||||
"families": ["blue"]
|
||||
},
|
||||
{
|
||||
"name": "ROYALBLUE",
|
||||
"hex": "#4169E1",
|
||||
"rgb": "RGB(65, 105, 225)",
|
||||
"families": ["blue"]
|
||||
},
|
||||
{
|
||||
"name": "BLUE",
|
||||
"hex": "#0000FF",
|
||||
"rgb": "RGB(0, 0, 255)",
|
||||
"families": ["blue"]
|
||||
},
|
||||
{
|
||||
"name": "MEDIUMBLUE",
|
||||
"hex": "#0000CD",
|
||||
"rgb": "RGB(0, 0, 205)",
|
||||
"families": ["blue", "medium"]
|
||||
},
|
||||
{
|
||||
"name": "DARKBLUE",
|
||||
"hex": "#00008B",
|
||||
"rgb": "RGB(0, 0, 139)",
|
||||
"families": ["blue", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "NAVY",
|
||||
"hex": "#00008B",
|
||||
"rgb": "RGB(0, 0, 128)",
|
||||
"families": ["blue", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "MIDNIGHTBLUE",
|
||||
"hex": "#191970",
|
||||
"rgb": "RGB(25, 25, 112))",
|
||||
"families": ["blue", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "CORNSILK",
|
||||
"hex": "#FFF8DC",
|
||||
"rgb": "RGB(255, 248, 220)",
|
||||
"families": ["brown", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "BLANCHEDALMOND",
|
||||
"hex": "#FFEBCD",
|
||||
"rgb": "RGB(255, 235, 205)",
|
||||
"families": ["brown", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "BISQUE",
|
||||
"hex": "#FFE4C4",
|
||||
"rgb": "RGB(255, 228, 196)",
|
||||
"families": ["brown", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "NAVAJOWHITE",
|
||||
"hex": "#FFDEAD",
|
||||
"rgb": "RGB(255, 222, 173)",
|
||||
"families": ["brown", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "WHEAT",
|
||||
"hex": "#F5DEB3",
|
||||
"rgb": "RGB(245, 222, 179)",
|
||||
"families": ["brown", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "BURLYWOOD",
|
||||
"hex": "#DEB887",
|
||||
"rgb": "RGB(222, 184, 135)",
|
||||
"families": ["brown", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "TAN",
|
||||
"hex": "#D2B48C",
|
||||
"rgb": "RGB(210, 180, 140)",
|
||||
"families": ["brown", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "ROSYBROWN",
|
||||
"hex": "#BC8F8F",
|
||||
"rgb": "RGB(188, 143, 143)",
|
||||
"families": ["brown", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "SANDYBROWN",
|
||||
"hex": "#F4A460",
|
||||
"rgb": "RGB(244, 164, 96)",
|
||||
"families": ["brown", "orange"]
|
||||
},
|
||||
{
|
||||
"name": "GOLDENROD",
|
||||
"hex": "#DAA520",
|
||||
"rgb": "RGB(218, 165, 32)",
|
||||
"families": ["brown", "goldenrod", "orange"]
|
||||
},
|
||||
{
|
||||
"name": "DARKGOLDENROD",
|
||||
"hex": "#B8860B",
|
||||
"rgb": "RGB(184, 134, 11)",
|
||||
"families": ["brown", "orange", "goldenrod", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "PERU",
|
||||
"hex": "#CD853F",
|
||||
"rgb": "RGB(205, 133, 63)",
|
||||
"families": ["brown", "orange"]
|
||||
},
|
||||
{
|
||||
"name": "CHOCOLATE",
|
||||
"hex": "#D2691E",
|
||||
"rgb": "RGB(210, 105, 30)",
|
||||
"families": ["brown", "orange"]
|
||||
},
|
||||
{
|
||||
"name": "SADDLEBROWN",
|
||||
"hex": "#8B4513",
|
||||
"rgb": "RGB(139, 69, 19)",
|
||||
"families": ["brown"]
|
||||
},
|
||||
{
|
||||
"name": "SIENNA",
|
||||
"hex": "#A0522D",
|
||||
"rgb": "RGB(160, 82, 45)",
|
||||
"families": ["brown"]
|
||||
},
|
||||
{
|
||||
"name": "BROWN",
|
||||
"hex": "#A52A2A",
|
||||
"rgb": "RGB(165, 42, 42)",
|
||||
"families": ["brown", "red"]
|
||||
},
|
||||
{
|
||||
"name": "MAROON",
|
||||
"hex": "#800000",
|
||||
"rgb": "RGB(128, 0, 0)",
|
||||
"families": ["brown", "red"]
|
||||
},
|
||||
{
|
||||
"name": "WHITE",
|
||||
"hex": "#FFFFFF",
|
||||
"rgb": "RGB(255, 255, 255)",
|
||||
"families": ["white"]
|
||||
},
|
||||
{
|
||||
"name": "SNOW",
|
||||
"hex": "#FFFAFA",
|
||||
"rgb": "RGB(255, 250, 250)",
|
||||
"families": ["white"]
|
||||
},
|
||||
{
|
||||
"name": "HONEYDEW",
|
||||
"hex": "#F0FFF0",
|
||||
"rgb": "RGB(240, 255, 240)",
|
||||
"families": ["white"]
|
||||
},
|
||||
{
|
||||
"name": "MINTCREAM",
|
||||
"hex": "#F5FFFA",
|
||||
"rgb": "RGB(245, 255, 250)",
|
||||
"families": ["white"]
|
||||
},
|
||||
{
|
||||
"name": "AZURE",
|
||||
"hex": "#F0FFFF",
|
||||
"rgb": "RGB(240, 255, 255)",
|
||||
"families": ["white"]
|
||||
},
|
||||
{
|
||||
"name": "ALICEBLUE",
|
||||
"hex": "#F0F8FF",
|
||||
"rgb": "RGB(240, 248, 255)",
|
||||
"families": ["white"]
|
||||
},
|
||||
{
|
||||
"name": "GHOSTWHITE",
|
||||
"hex": "#F8F8FF",
|
||||
"rgb": "RGB(248, 248, 255)",
|
||||
"families": ["white"]
|
||||
},
|
||||
{
|
||||
"name": "WHITESMOKE",
|
||||
"hex": "#F5F5F5",
|
||||
"rgb": "RGB(245, 245, 245)",
|
||||
"families": ["white"]
|
||||
},
|
||||
{
|
||||
"name": "SEASHELL",
|
||||
"hex": "#FFF5EE",
|
||||
"rgb": "RGB(255, 245, 238)",
|
||||
"families": ["white", "pink"]
|
||||
},
|
||||
{
|
||||
"name": "BEIGE",
|
||||
"hex": "#F5F5DC",
|
||||
"rgb": "RGB(245, 245, 220)",
|
||||
"families": ["white", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "OLDLACE",
|
||||
"hex": "#FDF5E6",
|
||||
"rgb": "RGB(253, 245, 230)",
|
||||
"families": ["white", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "FLORALWHITE",
|
||||
"hex": "#FDF5E6",
|
||||
"rgb": "RGB(253, 245, 230)",
|
||||
"families": ["white", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "IVORY",
|
||||
"hex": "#FFFFF0",
|
||||
"rgb": "RGB(255, 255, 240)",
|
||||
"families": ["white", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "ANTIQUEWHITE",
|
||||
"hex": "#FAEBD7",
|
||||
"rgb": "RGB(250, 235, 215)",
|
||||
"families": ["white", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "LINEN",
|
||||
"hex": "#FAF0E6",
|
||||
"rgb": "RGB(250, 240, 230)",
|
||||
"families": ["white", "tan"]
|
||||
},
|
||||
{
|
||||
"name": "LAVENDERBLUSH",
|
||||
"hex": "#FFF0F5",
|
||||
"rgb": "RGB(255, 240, 245)",
|
||||
"families": ["white", "lavender", "pink"]
|
||||
},
|
||||
{
|
||||
"name": "MISTYROSE",
|
||||
"hex": "#FFE4E1",
|
||||
"rgb": "RGB(255, 228, 225)",
|
||||
"families": ["white", "pink"]
|
||||
},
|
||||
{
|
||||
"name": "GAINSBORO",
|
||||
"hex": "#DCDCDC",
|
||||
"rgb": "RGB(220, 220, 220)",
|
||||
"families": ["gray"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTGRAY",
|
||||
"hex": "#D3D3D3",
|
||||
"rgb": "RGB(211, 211, 211)",
|
||||
"families": ["gray", "light"]
|
||||
},
|
||||
{
|
||||
"name": "SILVER",
|
||||
"hex": "#C0C0C0",
|
||||
"rgb": "RGB(192, 192, 192)",
|
||||
"families": ["gray"]
|
||||
},
|
||||
{
|
||||
"name": "DARKGRAY",
|
||||
"hex": "#A9A9A9",
|
||||
"rgb": "RGB(169, 169, 169)",
|
||||
"families": ["gray", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "GRAY",
|
||||
"hex": "#808080",
|
||||
"rgb": "RGB(128, 128, 128)",
|
||||
"families": ["gray"]
|
||||
},
|
||||
{
|
||||
"name": "DIMGRAY",
|
||||
"hex": "#696969",
|
||||
"rgb": "RGB(105, 105, 105)",
|
||||
"families": ["gray"]
|
||||
},
|
||||
{
|
||||
"name": "LIGHTSLATEGRAY",
|
||||
"hex": "#778899",
|
||||
"rgb": "RGB(119, 136, 153)",
|
||||
"families": ["gray", "light", "slate"]
|
||||
},
|
||||
{
|
||||
"name": "SLATEGRAY",
|
||||
"hex": "#708090",
|
||||
"rgb": "RGB(112, 128, 144)",
|
||||
"families": ["gray", "slate"]
|
||||
},
|
||||
{
|
||||
"name": "DARKSLATEGRAY",
|
||||
"hex": "#2F4F4F",
|
||||
"rgb": "RGB(47, 79, 79)",
|
||||
"families": ["gray", "slate", "dark"]
|
||||
},
|
||||
{
|
||||
"name": "BLACK",
|
||||
"hex": "#000000",
|
||||
"rgb": "RGB(0, 0, 0)",
|
||||
"families": ["black"]
|
||||
}
|
||||
]
|
||||
1
data/console.aframe.component
Normal file
1
data/console.aframe.component
Normal file
@@ -0,0 +1 @@
|
||||
console.log('test')
|
||||
1
data/default.layout.json
Normal file
1
data/default.layout.json
Normal file
@@ -0,0 +1 @@
|
||||
[]
|
||||
Binary file not shown.
BIN
data/demo_directory_browser/Hamburger.glb
Normal file
BIN
data/demo_directory_browser/Hamburger.glb
Normal file
Binary file not shown.
55
data/demo_directory_browser/directoryA/.fileposes.svg
Normal file
55
data/demo_directory_browser/directoryA/.fileposes.svg
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="210mm"
|
||||
height="297mm"
|
||||
viewBox="0 0 210 297"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname=".fileposes.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="3.6596241"
|
||||
inkscape:cx="241.55486"
|
||||
inkscape:cy="299.75756"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2075"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583;stroke-opacity:0.9"
|
||||
id="rect234"
|
||||
width="7.3140693"
|
||||
height="45.559532"
|
||||
x="37.100391"
|
||||
y="37.221756"
|
||||
inkscape:label=".fileposes.svg">
|
||||
<desc
|
||||
id="desc239">position.y:1
|
||||
rotation:0 0 0</desc>
|
||||
</rect>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
1
data/demo_directory_browser/directoryA/otherfile.txt
Normal file
1
data/demo_directory_browser/directoryA/otherfile.txt
Normal file
@@ -0,0 +1 @@
|
||||
hello XR world
|
||||
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{"filename":"demo_directory_browser/q1_step_highlights.png","position":"-1 1 -1", "rotation":"45 45 45"},
|
||||
{"filename":"demo_directory_browser/q1_step_highlights.png","position":"-1 2 -1", "rotation":"45 0 45"},
|
||||
{"filename":"demo_directory_browser/q1_step_highlights.png","position":"-1 3 -1", "rotation":"45 0 0"},
|
||||
{"filename":"demo_directory_browser/Hamburger.glb","position":"1 1 -1", "rotation":"45 45 45","scale": ".1 .1 .1"}
|
||||
]
|
||||
1
data/demo_directory_browser/fileA.txt
Normal file
1
data/demo_directory_browser/fileA.txt
Normal file
@@ -0,0 +1 @@
|
||||
another hello world file.
|
||||
0
data/demo_directory_browser/fileB.desktop
Normal file
0
data/demo_directory_browser/fileB.desktop
Normal file
BIN
data/demo_directory_browser/q1_step_highlights.png
Normal file
BIN
data/demo_directory_browser/q1_step_highlights.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
876
data/demo_hypertext2025.js
Normal file
876
data/demo_hypertext2025.js
Normal file
@@ -0,0 +1,876 @@
|
||||
// testing
|
||||
// mobile https://companion.benetou.fr/index.html?username=q3_demo_ht25_annotatedbibliography_spatial&emulatexr=true
|
||||
// HMD https://companion.benetou.fr/index.html?username=q3_demo_ht25_annotatedbibliography_spatial
|
||||
|
||||
// specifying IDs by URL https://companion.benetou.fr/index.html?username=q3_demo_ht25_annotatedbibliography_spatial&ids=3154184711,%201531052856,%201569268719
|
||||
let ids = urlParams.get('ids');
|
||||
if (!ids) ids = '1694952728, 1724963600, 1569268719'
|
||||
|
||||
let wristSteps = 0
|
||||
let wristStepShortcuts = [
|
||||
//'jxr AFRAME.scenes[0].querySelector("a-sky").setAttribute("color", "gray"); showFile("references_HT_Conf_Items.json"); wristShortcutNextStep();',
|
||||
//'jxr AFRAME.scenes[0].querySelector("a-sky").setAttribute("color", "gray"); showFile("references_manual_v04.json"); wristShortcutNextStep();',
|
||||
'jxr AFRAME.scenes[0].querySelector("a-sky").setAttribute("color", "gray"); showFile("references_HT_Conf_Items.json", {ids:[ '+ids+'] }); wristShortcutNextStep();', // using IDs rather than titles
|
||||
//'jxr AFRAME.scenes[0].querySelector("a-sky").setAttribute("color", "gray"); showFile("references_HT_Conf_Items.json", {ids:[ 1694952728, 1724963600, 1569268719 ] }); wristShortcutNextStep();', // using IDs rather than titles
|
||||
//'jxr AFRAME.scenes[0].querySelector("a-sky").setAttribute("color", "gray"); showFile("references_HT_Conf_Items.json", {ids:[ 3154184711, 1531052856, 1569268719 ] }); wristShortcutNextStep();', // using IDs rather than titles
|
||||
'jxr wristShortcutNextStep();',
|
||||
// consider AFRAME.scenes[0].exitVR() to leave after step
|
||||
// should hide/delete previous if alraedy there
|
||||
]
|
||||
|
||||
console.warn( wristStepShortcuts )
|
||||
|
||||
highlightColor = 'yellow'
|
||||
let highlights = []
|
||||
|
||||
let keyboardAdded = false
|
||||
const classNameToBeSaved = "tobesaved"
|
||||
const saveBucketName = "savingDataDemo_q3_annotatedbibliography_spatial_ht25"
|
||||
let toSave = {}
|
||||
toSave.highlights = []
|
||||
toSave.notes = []
|
||||
const remote_storage_url = urlParams.get('remoteStorageURL');
|
||||
const shorterManaLabels = urlParams.get('shortermanalabels');
|
||||
let savedURL = ''
|
||||
|
||||
/* other options
|
||||
showFile("references_HT_Conf_Items.json", {year:2025})
|
||||
showFile("references_HT_Conf_Items.json", {year:2024, articletype:"Full paper"})
|
||||
showFile("references_HT_Conf_Items.json", {ids:[ 3154184711, 1531052856, 1569268719 ] })
|
||||
note that ids could be used to prepare a selection via a mobile browser Web Extension, stack IDs on a JSON file that is then used for filtering
|
||||
*/
|
||||
|
||||
// anchors for steps
|
||||
// must still bring the right state
|
||||
|
||||
// write on curve idea
|
||||
// consider adding new note (with annotation) to start the drawing of a curve made of of points per second
|
||||
// jxr startsDroppingPoints
|
||||
// ends when 2 points are less than 5cm appart
|
||||
// each new point gets linked to the previous one with a line
|
||||
|
||||
// new text and then be dropped nearby the first point and will put characters of that note on points
|
||||
|
||||
// transform executeRing() to event, e.g. onthroughring="" that would execute like jxr onreleased/onpicked
|
||||
if (username && username == "q3_demo_ht25_annotatedbibliography_spatial") {
|
||||
setTimeout( _ => {
|
||||
AFRAME.scenes[0].querySelector("a-sky").setAttribute("color", "black")
|
||||
branding_title.setAttribute("value", "The Future of Text in XR")
|
||||
branding_subtitle.setAttribute("value", "by the Future Text Lab Team")
|
||||
branding_title.setAttribute("troika-text", "outlineWidth", 0)
|
||||
branding_subtitle.setAttribute("troika-text", "outlineWidth", 0)
|
||||
// remove material="flatShading: true; blending: additive; emissive: #c061cb
|
||||
branding_title.setAttribute("material", "emissive", "white" )
|
||||
branding_subtitle.setAttribute("material", "emissive", "white" )
|
||||
flatuifeatures.style["background-color"] = "#ccc"
|
||||
}, 500 )
|
||||
audio.src = "Keyboard_Clicky_8.mp3" // works on desktop on Chromium desktop and Quest Browser at least
|
||||
|
||||
//Steps for Reading and Authoring in XR for the Production of an Annotated Bibliography (AB)
|
||||
|
||||
// TODO
|
||||
// what causes performance hit on full page text
|
||||
// potential optimizations
|
||||
// limit to 2 pages open only
|
||||
// when further than e.g. 1m show only image
|
||||
// only 4 files to convert
|
||||
// should try without interactions first
|
||||
|
||||
// to test on mobile or desktop, without VR HMD
|
||||
if (emulatexr && emulatexr=="true"){
|
||||
mobileTest()
|
||||
}
|
||||
|
||||
cleanSlateUI() // hides a bunch of stuff
|
||||
applyToClass("flatuioptions", el => el.style.display = "none" )
|
||||
|
||||
manuscript.setAttribute("visible", false)
|
||||
// can flip dominant/non-dominant hand based on wristShortcut/otherWristShortcut
|
||||
// currently
|
||||
// right hand = wristShortcut
|
||||
// left hand = otherWristShortcut
|
||||
// could be switched as query parameter
|
||||
setTimeout( _ => {
|
||||
let exitEl = addNewNote( 'jxr AFRAME.scenes[0].exitVR()' , "0 1.5 1" )
|
||||
//let exitEl = addNewNote( 'jxr AFRAME.scenes[0].exitVR()' , "0 1.5 1", "0.1 0.1 0.1", "exitnote", "uidemo", "true", "90 180 0")
|
||||
exitEl.setAttribute("rotation", "90 180 0")
|
||||
exitEl.setAttribute("annotation", "content:exit VR")
|
||||
|
||||
let debugEl = addNewNote( 'jxr saveToRemoteStorage();' , "0 1.3 1" )
|
||||
debugEl.setAttribute("rotation", "90 180 0")
|
||||
debugEl.setAttribute("annotation", "content:saving test")
|
||||
// could bind to finger instead, or while exiting VR
|
||||
|
||||
debugEl = addNewNote( 'jxr loadFromRemoteStorage();' , "0 1.1 1" )
|
||||
debugEl.setAttribute("rotation", "90 180 0")
|
||||
debugEl.setAttribute("annotation", "content:loading test")
|
||||
|
||||
wristShortcut = wristStepShortcuts[wristSteps]
|
||||
otherWristShortcut = 'jxr AFRAME.scenes[0].exitVR()' // probably risky, might want to active this only after few steps at least
|
||||
//otherWristShortcut = 'jxr console.log("unset wrist shortcut")' // probably risky, might want to active this only after few steps at least
|
||||
// BUG somehow does the opposite, namely works only before content is loaded
|
||||
|
||||
AFRAME.scenes[0].addEventListener("exit-vr", e => {
|
||||
//AFRAME.scenes[0].querySelector("a-sky").setAttribute("color", "black")
|
||||
AFRAME.scenes[0].querySelector("a-sky").setAttribute("color", "gray")
|
||||
console.log('exited VR', environment)
|
||||
setTimeout( _ => environment.setAttribute("position", "0 -1000 0"), 200 )
|
||||
let el = document.createElement("h1")
|
||||
el.style = "z-index: 1000; position: fixed; top: 100px; left: 100px; color: #black;"
|
||||
document.body.appendChild(el)
|
||||
// if content was saved, show resulting URL here, warning that it's been saved too
|
||||
// TODO add saveToRemoteStorage() now (untested) with specific unique URL thanks to date
|
||||
saveToRemoteStorage()
|
||||
let embedURL = '/index.html?username='+username+'&remoteStorageURL='+savedURL
|
||||
el.innerHTML = "Thank you for trying our demonstration for HyperText 2025.<br>Please remove the headset."
|
||||
+"<br><br><a href="+savedURL+" target=_blank>- Your data as JSON</a>"
|
||||
+"<br><br><a href="+embedURL+" target=_blank>- Data within environment</a>"
|
||||
+"<br><br>- Database of <a href='/ht25_annotatedbibliography_spatial_json_viewer_example.html' target=_blank>all data saved with search</a>"
|
||||
// el.style.color = "#ccc"
|
||||
// also https://companion.benetou.fr/index.html?username=q2_most_recent_file&partialfilename=q3_demo_ht25_annotatedbibliography_spatial_savingDataDemo_q3_annotatedbibliography_spatial_ht25_
|
||||
// but without dedicated filter for now
|
||||
// could redirect to this page with embedURL instead
|
||||
})
|
||||
|
||||
let documentsLoaded = 0
|
||||
const placeHolders = [
|
||||
{position:" 0 1.4 -.7", rotation:"0 0 0"},
|
||||
{position:"-.7 1.4 -.3", rotation:"0 45 0"},
|
||||
{position:"-.9 1.4 .5", rotation:"0 90 0"},
|
||||
//{position:"-.7 1.4 .8", rotation:"0 135 0"},
|
||||
]
|
||||
// could made visible as wireframe
|
||||
|
||||
AFRAME.scenes[0].addEventListener("pdfxmlloaded", e => {
|
||||
openedFiles.push( e.detail )
|
||||
let el = document.getElementById("page_from_"+e.detail.replaceAll("/","_"))
|
||||
el.setAttribute("onreleased", "if (selectedElements.at(-1).element.getAttribute('position').y<.5) { selectedElements.at(-1).element.setAttribute('visible', false) };")
|
||||
// trick to hide
|
||||
|
||||
// associate opened document with title and card
|
||||
const partialId = e.detail.replace('.xml','').replace(/.*\//,'')
|
||||
el.sourceCardEl = Array.from( document.querySelectorAll(".reference-entry-card") ).find( e => e.data.doipdfurl.includes(partialId) )
|
||||
el.sourceTitleEl = Array.from( document.querySelectorAll(".reference-entry") ).find( e => e.data.doipdfurl.includes(partialId) )
|
||||
|
||||
let cmdNextEl = addNewNote("jxr document.getElementById('page_from_"+e.detail.replaceAll("/","_")+"').nextPage()", placeHolders[documentsLoaded].position )
|
||||
cmdNextEl.setAttribute("annotation", "content: next page")
|
||||
//cmdNextEl.setAttribute("annotation", "content: next page ("+el.data.articletitle+")")
|
||||
cmdNextEl.setAttribute("rotation", "90 0 0")
|
||||
setTimeout( _ => cmdNextEl.object3D.position.y += .1, 200)
|
||||
|
||||
let cmdPreviousEl = addNewNote("jxr document.getElementById('page_from_"+e.detail.replaceAll("/","_")+"').previousPage()", placeHolders[documentsLoaded].position )
|
||||
setTimeout( _ => cmdPreviousEl.object3D.position.x -= .2, 200)
|
||||
setTimeout( _ => cmdPreviousEl.object3D.position.y += .1, 200)
|
||||
cmdPreviousEl.setAttribute("annotation", "content: previous page")
|
||||
//cmdPreviousEl.setAttribute("annotation", "content: next page ("+el.data.articletitle+")")
|
||||
cmdPreviousEl.setAttribute("rotation", "90 0 0")
|
||||
|
||||
setTimeout( _ => setTextAsHighlightable(), 1000 );
|
||||
|
||||
// break highlights, at least the visible lines
|
||||
// TODO on nextPage/previousPage
|
||||
//remove related lines
|
||||
// potentially add back to title
|
||||
|
||||
// to avoid visual overlap and thus performance hit put them on specific position and rotation
|
||||
if (documentsLoaded<placeHolders.length) {
|
||||
el.setAttribute("position", placeHolders[documentsLoaded].position)
|
||||
el.setAttribute("rotation", placeHolders[documentsLoaded].rotation)
|
||||
} else { // everything else slightly stacked
|
||||
el.object3D.position.x += documentsLoaded/10
|
||||
el.object3D.position.y -= documentsLoaded/10
|
||||
el.object3D.position.z += documentsLoaded/100
|
||||
}
|
||||
documentsLoaded++
|
||||
// TODO consider
|
||||
// aligning the card and title too
|
||||
// or visually linking them with line
|
||||
|
||||
// listen to page change events
|
||||
el.addEventListener("pagechanged", e => {
|
||||
console.log( "pagechanged", e.detail )
|
||||
setTimeout( _ => setTextAsHighlightable(), 2000 )
|
||||
})
|
||||
})
|
||||
|
||||
let openedFiles = []
|
||||
|
||||
AFRAME.scenes[0].addEventListener("jsonhtrefloaded", e => {
|
||||
Array.from( document.querySelectorAll(".reference-entry-card") ).map( el => {
|
||||
let filename = "/saved/pdfxml/"+el.data.doipdfurl.replace(/.*pdf\//,'').replace(/.*\//,'')+".xml"
|
||||
el.setAttribute("onreleased", "showFile('"+filename+"'); adjustLoadedReferences(); addManaMenu(); addDemoKeyboardThenHide(); selectedElements.at(-1).element.setAttribute('onreleased', '');" ) // removing itself after, no need to re-open the same file
|
||||
})
|
||||
Array.from( document.querySelectorAll(".reference-entry") ).map( el => {
|
||||
el.setAttribute("troika-text", "outlineWidth", 0)
|
||||
})
|
||||
|
||||
/*
|
||||
placeHolders.map( ph => {
|
||||
let el = document.createElement("a-box")
|
||||
el.setAttribute("wireframe", true)
|
||||
el.setAttribute("opacity", .1)
|
||||
el.setAttribute("scale", "1 1.2 .1")
|
||||
el.setAttribute("position", ph.position) // not actually correct... only the first one is
|
||||
el.setAttribute("rotation", ph.rotation)
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
setTimeout( _ => {
|
||||
el.object3D.position.x += .5
|
||||
el.object3D.position.y -= .6
|
||||
el.object3D.position.z += .05
|
||||
},100)
|
||||
})
|
||||
*/
|
||||
|
||||
setTimeout( _ => makeAnchorsVisibleOnTargets(), 1000)
|
||||
//document.querySelector("a-console").setAttribute("visible", true)
|
||||
//document.querySelector("a-console").setAttribute("height", 1.5)
|
||||
})
|
||||
|
||||
AFRAME.scenes[0].addEventListener("useraddednote", e => {
|
||||
let el = e.detail.element
|
||||
el.setAttribute("troika-text", "outlineWidth", 0)
|
||||
el.setAttribute("color", "black")
|
||||
// setTimeout( _ => el.object3D.position.z -= .1, 200) // does not seem to work
|
||||
el.classList.add(classNameToBeSaved) // does not seem to suffice
|
||||
toSave.notes.push( el )
|
||||
jxrhighlight()
|
||||
})
|
||||
|
||||
}, 500) // required due to past demos forcing a shortcut ( setTimeout() after cleanSlateUI() )
|
||||
|
||||
// saving -------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
setTimeout( _ => {
|
||||
if (remote_storage_url) window.loadFromRemoteStorage( remote_storage_url )
|
||||
}, 5000 )
|
||||
|
||||
window.appendSpatially = _ => {
|
||||
// TODO should not remove the original
|
||||
let newNote = addNewNote( selectedElements.at(-1).element.getAttribute("value") )
|
||||
setTimeout( _ => {
|
||||
newNote.setAttribute("position", AFRAME.utils.coordinates.stringify( pinches.filter( p => p.primary ).at(-1).position ) )
|
||||
newNote.setAttribute("color", "black")
|
||||
newNote.object3D.lookAt( player.object3D.position )
|
||||
// billboard (~ish) on initial drop then let user adjust if wanted
|
||||
}, 200 )
|
||||
|
||||
selectedElements.at(-1).element.setAttribute("color","pink")
|
||||
// does nothing visible
|
||||
|
||||
newNote.setAttribute("troika-text", "outlineWidth", 0)
|
||||
// should move to the release position instead of reset
|
||||
newNote.classList.add(classNameToBeSaved)
|
||||
|
||||
setTimeout( _ => {
|
||||
AFRAME.scenes[0].setAttribute('live-selector-line__citation_'+Date.now(), {
|
||||
start: newNote,
|
||||
end: selectedElements.at(-1).element })
|
||||
console.log( 'released', selectedElements.at(-1).element.getAttribute("value") )
|
||||
console.log( 'released', selectedElements.at(-1).element.getAttribute("position") )
|
||||
console.log( 'released', selectedElements.at(-1).element.getAttribute("originalposition") )
|
||||
}, 500 )
|
||||
highlights.push( newNote )
|
||||
toSave.highlights.push( newNote )
|
||||
}
|
||||
|
||||
window.flattenSpatialManuscript = function (savingClass=classNameToBeSaved){
|
||||
manuscript.setAttribute("visible", true)
|
||||
applyToClass(savingClass, el => {
|
||||
let value = el.getAttribute("value")
|
||||
if (!value.startsWith("jxr" )) manuscript.children[0].setAttribute( "value",
|
||||
manuscript.children[0].getAttribute( "value")
|
||||
+ "\n" + value
|
||||
)
|
||||
})
|
||||
// lose formatting
|
||||
highlights.map( h => { manuscript.children[0].setAttribute( "value", manuscript.children[0].getAttribute( "value") + "\n" + h.getAttribute("value") ) })
|
||||
// TODO position itself should matter, e.g. sorting on position y value
|
||||
}
|
||||
|
||||
window.flattenManuscriptExportToDocument = function (savingClass=classNameToBeSaved){
|
||||
async function w(path = "/file.txt"){ return await webdavClient.putFileContents(path, manuscript.children[0].getAttribute("value") ) }
|
||||
written = w(subdirWebDAV+usernamePrefix+saveBucketName+'.txt')
|
||||
}
|
||||
|
||||
window.getDataToSave = function (){ // replaced by dedicated structure (didn't seem reliable)
|
||||
// TODO include source documment so that it can be loaded too
|
||||
|
||||
let minimalData = {}
|
||||
minimalData.notes = []
|
||||
minimalData.highlights = []
|
||||
toSave.notes.map( el => {
|
||||
minimalData.notes.push({ value : el.getAttribute("value"), position: el.getAttribute("position"), rotation: el.getAttribute("rotation") })
|
||||
// rotation / position could be shortened
|
||||
})
|
||||
toSave.highlights.map( el => {
|
||||
minimalData.highlights.push({ value : el.getAttribute("value"), position: el.getAttribute("position"), rotation: el.getAttribute("rotation") })
|
||||
})
|
||||
return minimalData
|
||||
}
|
||||
window.saveToLocalStorage = function (savingClass=classNameToBeSaved){
|
||||
localStorage.setItem(saveBucketName, JSON.stringify( getDataToSave(savingClass) ) )
|
||||
}
|
||||
|
||||
// assume that elements already exist as entities and are uniquely identifiable via their value (content based, NOT id)
|
||||
window.loadFromLocalStorage = function(){
|
||||
window.displaySavedData( JSON.parse( localStorage.getItem(saveBucketName) ) )
|
||||
}
|
||||
|
||||
window.loadFromRemoteStorage = function( lastSaveURL = "/"+usernamePrefix+saveBucketName+".json"){
|
||||
// could rely on showFile instead with a new filter endingWith e.g. savingDataDemo_q3_annotatedbibliography.json
|
||||
// e.g. showFile("https://companion.benetou.fr/q3_annotatedbibliography_savingDataDemo_q3_annotatedbibliography.json")
|
||||
fetch(lastSaveURL).then( res => res.json() ).then( json => { window.displaySavedData( json ) } )
|
||||
}
|
||||
|
||||
window.displaySavedData = function( savedDataFromPreviousSession ){
|
||||
// should also display document higlights are from...
|
||||
|
||||
console.log( savedDataFromPreviousSession )
|
||||
if ( !savedDataFromPreviousSession.notes ) savedDataFromPreviousSession.notes = []
|
||||
// TODO metadata of provenance, being able to toggle show/hide all data from 1 source
|
||||
savedDataFromPreviousSession.notes.map( n => {
|
||||
let newNote = addNewNote( n.value, n.position )
|
||||
newNote.setAttribute("rotation", n.rotation )
|
||||
newNote.classList.add(classNameToBeSaved) // for re-saving
|
||||
toSave.notes.push( newNote )
|
||||
})
|
||||
highlights = []
|
||||
savedDataFromPreviousSession.highlights.map( h => {
|
||||
let newNoteFromHighlight = addNewNote( h.value, h.position )
|
||||
newNoteFromHighlight.classList.add(classNameToBeSaved) // for re-saving
|
||||
toSave.highlights.push( newNoteFromHighlight )
|
||||
newNoteFromHighlight.setAttribute("rotation", h.rotation )
|
||||
highlights.push( newNoteFromHighlight )
|
||||
Array.from( document.querySelectorAll(".highlightabletext") )
|
||||
.filter(el => h.value == el.getAttribute("value"))
|
||||
.map(el=> {
|
||||
el.setAttribute("color", highlightColor)
|
||||
AFRAME.scenes[0].setAttribute('live-selector-line__citation_'+Date.now(), {
|
||||
start: newNoteFromHighlight,
|
||||
end: el })
|
||||
})
|
||||
})
|
||||
// TODO should allow for re-saving, for now does not seem to work
|
||||
}
|
||||
|
||||
window.saveToRemoteStorage = function (savingClass=classNameItemsToSave){
|
||||
savedURL = usernamePrefix+saveBucketName+'_'+Date.now()+'.json'
|
||||
async function w(path = "/file.txt"){ return await webdavClient.putFileContents(path, JSON.stringify( getDataToSave(savingClass) )) }
|
||||
written = w ( subdirWebDAV+savedURL )
|
||||
//if (written){ fetch('https://ntfy.benetou.fr/fileuploadtowebdav', { method: 'POST', body: 'added '+usernamePrefix+saveBucketName }) }
|
||||
}
|
||||
}
|
||||
|
||||
function showHighlightableFile( el ){
|
||||
let filename = "/saved/pdfxml/"+el.data["bibtex-data"]["source-pdf"].replace(/.*pdf\//,'').replace(/.*\//,'')+".xml"
|
||||
el.setAttribute("onreleased", "showFile('"+filename+"'); adjustLoadedReferences(); addManaMenu(); setTimeout( _ => setTextAsHighlightable(), 1000 ); addDemoKeyboardThenHide(); " )
|
||||
}
|
||||
|
||||
function addDemoKeyboardThenHide(){
|
||||
if (keyboardAdded) return
|
||||
keyboardAdded = true
|
||||
// performance hit despite non visible, due to keyBoardCheck interval (lowered frequency from 20ms to 100ms but should be optimized instead)
|
||||
let kbdel = addDrumKeyboard(color="#d3e3e5")
|
||||
kbdel.addEventListener("keyboard-keypressed", e => {
|
||||
if (keyboard.getAttribute("visible")) {
|
||||
audio.play()
|
||||
// mirror typing
|
||||
keyboardwidget.setAttribute("value", "<"+ hudTextEl.getAttribute("value") + ">")
|
||||
}
|
||||
})
|
||||
// does not handle <> BKSP
|
||||
kbdel.addEventListener("keyboard-entered", e => {
|
||||
// reset after typed note
|
||||
keyboardwidget.setAttribute("value", "<>")
|
||||
if (keyboard.getAttribute("visible")) {
|
||||
audio.play()
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout( _ => {
|
||||
keyboard.setAttribute("visible", false)
|
||||
}, 500 )
|
||||
|
||||
// could also add the movable version
|
||||
window.showBBoxOfElement = function( el ){
|
||||
var bbox = new THREE.Box3().setFromObject(el.object3D);
|
||||
const helper = new THREE.Box3Helper( bbox, 0xd3e3e5 )
|
||||
helper.name = "keyboardhelper"
|
||||
AFRAME.scenes[0].object3D.add( helper )
|
||||
return helper
|
||||
}
|
||||
|
||||
setTimeout( _ => {
|
||||
let helper = showBBoxOfElement( keyboard )
|
||||
helper.visible = false
|
||||
|
||||
setTimeout( _ => {
|
||||
var lastKnownPositionKeyboardMover = helper.position
|
||||
let el = addNewNote('<>', AFRAME.utils.coordinates.stringify(helper.position) )
|
||||
el.setAttribute("onreleased", "movedKeyboard()")
|
||||
el.setAttribute("visible", "false")
|
||||
el.id = "keyboardwidget"
|
||||
window.movedKeyboard = function (){
|
||||
let newPos = selectedElements.at(-1).element.getAttribute("position").clone()
|
||||
let diff = lastKnownPositionKeyboardMover.sub(newPos)
|
||||
Array.from( document.querySelectorAll(".keys_from_drumsticks") ).map( k => { k.object3D.position.sub( diff ) })
|
||||
lastKnownPositionKeyboardMover = newPos
|
||||
// should update bbox too
|
||||
AFRAME.scenes[0].object3D.remove( helper )
|
||||
helper = showBBoxOfElement( keyboard )
|
||||
}
|
||||
}, 500 )
|
||||
|
||||
}, 1000 )
|
||||
}
|
||||
|
||||
function wristShortcutNextStep(){ // TODO untested
|
||||
if (wristSteps >= wristShortcut.length-1 ) return
|
||||
wristShortcut = wristStepShortcuts[++wristSteps]
|
||||
}
|
||||
|
||||
let manaMenuAdded = false
|
||||
|
||||
function addManaMenu(){
|
||||
if (manaMenuAdded) return
|
||||
manaMenuAdded = true
|
||||
let optionA = document.createElement("a-troika-text")
|
||||
optionA.id = "other_text"
|
||||
setTimeout( _=>{
|
||||
//optionA.setAttribute("value", "save and export")
|
||||
optionA.setAttribute("value", "keyboard")
|
||||
optionA.setAttribute("position", "0 0 -.06")
|
||||
optionA.setAttribute("scale", ".1 .1 .1")
|
||||
optionA.setAttribute("color", "black")
|
||||
optionA.setAttribute("rotation", "0 -90 0") // to adjust, for index finger tip
|
||||
|
||||
if (shorterManaLabels) {
|
||||
optionA.setAttribute("value", "k")
|
||||
optionA.setAttribute("position", "0 0 -.02")
|
||||
}
|
||||
|
||||
//el.setAttribute("rotation", "0 -90 180") // for thumb
|
||||
AFRAME.scenes[0].appendChild( optionA )
|
||||
AFRAME.scenes[0].setAttribute("bind-element-to-finger__other", { hand: 'r_handMeshNode', finger: 'middle-finger-tip', target: '#other_text' } )
|
||||
}, 500) // enough time for element to exist and thus bind
|
||||
|
||||
let el = document.createElement("a-troika-text")
|
||||
el.id = "highlight_text"
|
||||
setTimeout( _=>{
|
||||
el.setAttribute("value", "highlight text") // TODO togglable instead
|
||||
// via ("highlightabletext") .setAttribute("onreleased",
|
||||
|
||||
el.setAttribute("position", "0 0 -.08")
|
||||
el.setAttribute("scale", ".1 .1 .1")
|
||||
el.setAttribute("color", "black")
|
||||
el.setAttribute("rotation", "0 -90 0") // to adjust, for index finger tip
|
||||
|
||||
if (shorterManaLabels) {
|
||||
el.setAttribute("value", "h")
|
||||
el.setAttribute("position", "0 0 -.02")
|
||||
}
|
||||
|
||||
//el.setAttribute("rotation", "0 -90 180") // for thumb
|
||||
AFRAME.scenes[0].appendChild( el )
|
||||
AFRAME.scenes[0].setAttribute("bind-element-to-finger__highlight", { hand: 'r_handMeshNode', finger: 'index-finger-tip', target: '#highlight_text' } )
|
||||
}, 500) // enough time for element to exist and thus bind
|
||||
|
||||
//let manamenu_last_pressed_option_kbd = 0
|
||||
// to change with each step : update wrists and fingers actions
|
||||
setInterval( el => {
|
||||
if ( !AFRAME.scenes[0].object3D.getObjectByName("r_handMeshNode") ) return
|
||||
if ( !document.getElementById("highlight_text") ) return
|
||||
let jr = AFRAME.scenes[0].object3D.getObjectByName("r_handMeshNode")?.parent.getObjectByName("index-finger-tip").position
|
||||
let jrm = AFRAME.scenes[0].object3D.getObjectByName("r_handMeshNode")?.parent.getObjectByName("middle-finger-tip").position
|
||||
let jl = AFRAME.scenes[0].object3D.getObjectByName("l_handMeshNode")?.parent.getObjectByName("index-finger-tip").position
|
||||
|
||||
let c = highlight_text.getAttribute("color", "white")
|
||||
|
||||
// consider refractory period
|
||||
if ( jr.distanceTo(jl) < .05){
|
||||
(c == "black") ? highlight_text.setAttribute("color", "white") : highlight_text.setAttribute("color", "black")
|
||||
// TODO toggle on/off a way to allow/prevent highlighting
|
||||
// see setTextAsHighlightable()
|
||||
}
|
||||
if ( jrm.distanceTo(jl) < .05){
|
||||
/*
|
||||
if ( Date.now() - manamenu_last_pressed_option_kbd < 500 )
|
||||
console.warn('should be ignoring, last 500ms already')
|
||||
} else {
|
||||
manamenu_last_pressed_option_kbd = Date.now()
|
||||
// and should toggle keyboard properties
|
||||
}
|
||||
*/
|
||||
keyboard.setAttribute("visible", !keyboard.getAttribute("visible") )
|
||||
AFRAME.scenes[0].object3D.getObjectByName("keyboardhelper").visible = !AFRAME.scenes[0].object3D.getObjectByName("keyboardhelper").visible
|
||||
keyboardwidget.setAttribute("visible", !keyboardwidget.getAttribute("visible"))
|
||||
}
|
||||
// should check with middle finger tip too for other_text
|
||||
}, 50)
|
||||
|
||||
// if doing so, consider displaying
|
||||
// the current step
|
||||
// actions available
|
||||
}
|
||||
|
||||
function mobileTest(){
|
||||
// const rightHand = xrDevice.hands['right'];
|
||||
setTimeout( _ => {
|
||||
AFRAME.scenes[0].enterVR()
|
||||
//document.querySelector("a-console").setAttribute("visible", true)
|
||||
document.querySelector("a-console").setAttribute("position", "-.2 1.6 -0.3")
|
||||
document.querySelector("a-console").setAttribute("rotation", "0 0 0")
|
||||
|
||||
let hands = window.xrdevice.hands
|
||||
|
||||
// testing wrist shortcut
|
||||
//setTimeout( _ => { hands['right'].position.set(-.27,1.45 ,-.28 ) }, 40)
|
||||
// can't get the right position... binded hjkl to move right hand instead
|
||||
|
||||
// testing the mana menu
|
||||
setTimeout( _ => { hands['right'].position.set(.3,1.4 ,-.2 ) }, 100)
|
||||
setTimeout( _ => { hands['left'].position.set(.25, 1.4 ,-.2 ) }, 1000)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
/*
|
||||
Step 1: Select “SPORE: A Storybreaking Machine,” by Daniel Roßner, Claus Atzenbeck, Sam Brooker from the works accessible from the ACM HT’23 list of articles, and arrange it in the Knowledge Space so that it can be read
|
||||
• When selecting the card that contains the data for this article, the user pinches the card to move it toward themselves in order to inspect it and, then, places it in the Knowledge Space the user wishes to read it from
|
||||
• To open the card into a pull PDF, the user pinches with left hand. The card will transform into a document
|
||||
• When the user is finished reading the card, the card be returned by some action like the user tapping left wrist sphere
|
||||
*/
|
||||
|
||||
let adjustedLibrary = false
|
||||
function adjustLoadedReferences(xOffset=1.2){
|
||||
if (adjustedLibrary) return
|
||||
adjustedLibrary = true
|
||||
Array.from( document.querySelectorAll(".reference-entry") ).map( el => {
|
||||
el.setAttribute("target", "")
|
||||
el.object3D.translateX(xOffset)
|
||||
//el.setAttribute("onpicked", "puckFromVolumetricFrame()")
|
||||
// could hide the ones that do not have purple box children
|
||||
})
|
||||
Array.from( document.querySelectorAll(".reference-entry-card") ).map( el => {
|
||||
el.object3D.translateX(xOffset)
|
||||
// optional : use move of all cards
|
||||
})
|
||||
}
|
||||
|
||||
// TODO works only for the first page, should be updated on pagechanged
|
||||
function setTextAsHighlightable(){
|
||||
/*
|
||||
Step 2: Read the article and highlight salient parts
|
||||
• The user reads through the article and highlights parts of it the user finds salient for the abstract that they will input into the AB
|
||||
*/
|
||||
Array.from( document.querySelectorAll(".highlightabletext") )
|
||||
.map(el => {
|
||||
el.setAttribute("onreleased", el.getAttribute("onreleased") + '; appendSpatially(); ' )
|
||||
// problematic... consider the cloning used with images
|
||||
} )
|
||||
// TODO use new picker instead, allow for manipulating doc too
|
||||
Array.from( document.querySelectorAll(".highlightimagefromxmlitem") )
|
||||
.map(el => {
|
||||
// el.removeAttribute("onreleased") // still vanishes
|
||||
// try to snap back in place
|
||||
// el.setAttribute("onreleased", "console.log('image released'); selectedElements.at(-1).element.setAttribute('position','.1 .1 .1')")
|
||||
// still vanishes...
|
||||
//el.setAttribute("onreleased", "console.log('image released'); selectedElements.at(-1).element.setAttribute('position','"+ el.initialPosition + "')")
|
||||
el.setAttribute("onreleased", "let el=selectedElements.at(-1).element.cloneNode(true); AFRAME.scenes[0].appendChild(el); el.setAttribute('position', AFRAME.utils.coordinates.stringify( pinches.filter( p => p.primary ).at(-1).position ) );")
|
||||
// recreate another image... clone and append again
|
||||
// missed the rotation though
|
||||
} )
|
||||
|
||||
// probably deprecated now that we rely on card dropping to open file
|
||||
Array.from( document.querySelectorAll("a-troika-text") )
|
||||
.filter( el => el.getAttribute("value").startsWith("jxr showFile") )
|
||||
.map( el => el.object3D.position.z-=.3 )
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// ---------- deprecated but kept if older ideas could be useful
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function ignoreTheRest(){
|
||||
let toSave = {}
|
||||
toSave.highlights = []
|
||||
toSave.notes = []
|
||||
|
||||
AFRAME.scenes[0].addEventListener("useraddednote", e => {
|
||||
let el = e.detail.element
|
||||
el.setAttribute("onpicked", "startRingCheck()" )
|
||||
el.setAttribute("onreleased", "endRingCheck()" )
|
||||
el.setAttribute("troika-text", "outlineWidth", 0)
|
||||
el.classList.add(classNameToBeSaved) // does not seem to suffice
|
||||
toSave.notes.push( el )
|
||||
jxrhighlight()
|
||||
})
|
||||
|
||||
ringAdded = true // skip ring contextual menu
|
||||
let newRingBigFont = addRing("jxr setFontSize(1)", '-.6 1.5 -.5')
|
||||
newRingBigFont.children[0].setAttribute("annotation", "content:reset font size")
|
||||
newRingBigFont.children[0].setAttribute("rotation", "90 0 0")
|
||||
let newRingSmallFont = addRing("jxr setFontSize(2)", '-.6 1.2 -.5')
|
||||
newRingSmallFont.children[0].setAttribute("annotation", "content:bigger font size")
|
||||
newRingSmallFont.children[0].setAttribute("rotation", "90 0 0")
|
||||
// not flexible enough from shortcut in executeRing()
|
||||
|
||||
setInterval( _ => {
|
||||
ringAdded = true // skip ring contextual menu
|
||||
if ( document.getElementById("selectionnote")) selectionnote.setAttribute("visible", "false")
|
||||
jxrhighlight()
|
||||
}, 200)
|
||||
|
||||
// unused for now due, left as reminder it should be generalized
|
||||
window.increaseFontSize = _ => {
|
||||
let el = selectedElements.at(-1).element
|
||||
el.setAttribute("troika-text", "fontSize",
|
||||
el.getAttribute("troika-text", "fontSize") * 2
|
||||
)
|
||||
}
|
||||
|
||||
// cleanup other rings (shoulnd't have to be done when testing single ring)
|
||||
rings.setAttribute("visible", "true")
|
||||
Array.from( rings.children ).map( el => el.setAttribute("visible", "false"));
|
||||
Array.from( active_rings.children ).map( el => el.setAttribute("visible", "false"));
|
||||
active_rings.setAttribute("visible", "true")
|
||||
newRingBigFont.setAttribute("visible", "true")
|
||||
newRingSmallFont.setAttribute("visible", "true")
|
||||
|
||||
const docIds = [ '3342220.3343669', '3209542.3209570']
|
||||
// could also be parameters via showfile
|
||||
/*
|
||||
const testUrlParams = new URLSearchParams( "showfile=175235.175237.pdf-0.jpg" )
|
||||
parametersViaURL(testUrlParams)
|
||||
*/
|
||||
|
||||
// image only '276627.276630' (scan)
|
||||
showFile('/saved/pdfxml/3342220.3343669.xml') // working example as others might not have highlightable text
|
||||
showFile('/saved/pdfxml/'+docIds[1]+'.xml')
|
||||
|
||||
// TODO remove after testing
|
||||
document.querySelector("a-console").setAttribute("visible", true)
|
||||
basiccommands.setAttribute("visible", true)
|
||||
// at least useful to reload
|
||||
|
||||
/*
|
||||
Step 3: Prepare to enter data into the blank document.
|
||||
• The user accesses the blank document, arrangiing it next to the article. This action can be achieved various ways, one of which by tapping the right wrist cube.
|
||||
*/
|
||||
|
||||
setTimeout( _ => {
|
||||
document.getElementById("page_from__saved_pdfxml_3342220.3343669.xml").object3D.translateY(.7)
|
||||
// other document
|
||||
document.getElementById("page_from__saved_pdfxml_"+docIds[1]+".xml").object3D.translateY(.7)
|
||||
document.getElementById("page_from__saved_pdfxml_"+docIds[1]+".xml").object3D.translateX(1.1)
|
||||
|
||||
Array.from( document.querySelectorAll(".keys_from_drumsticks") ).map( k => k.object3D.position.y-=.3 )
|
||||
// color keeps on changing due to position check
|
||||
// Array.from( document.querySelectorAll(".keys_from_drumsticks") ).map( k => k.setAttribute("color", "red") )
|
||||
// see k.setAttribute("color", "lightgreen") that could become a parameter
|
||||
|
||||
// keypress highlight, see also the SHIFT modified with green hand demo
|
||||
document.addEventListener('keypress', event => {
|
||||
let el = document.getElementById('keys_from_drumsticks_0_'+event.key.toUpperCase() )
|
||||
if (el) {
|
||||
el.setAttribute("wireframe", "true")
|
||||
setTimeout( _ => el.setAttribute("wireframe", "false"), 300 )
|
||||
}
|
||||
})
|
||||
}, 3000 )
|
||||
|
||||
/*
|
||||
Step 4: Enter data on to the blank document
|
||||
• Interact with the keyboard, moving it where it needs to be. The keyboard can be developed so that users can write on the blank document while inside the Knowledge Space using a virtual keyboard (which would be very innovative), or they can use a Bluetooth keyboard and see which keys are tapped. Frode wants a long-press to highlight key in a ‘select’ color, not repeat, to help use know if their fingers are in the right places
|
||||
*/
|
||||
setTimeout( _ => {
|
||||
let el = addDrumKeyboard(color="#d3e3e5")
|
||||
//audio.src = "Keyboard_Clicky_8.mp3"
|
||||
el.addEventListener("keyboard-keypressed", e => {
|
||||
// console.log('key pressed:', e.detail.value )
|
||||
if ( hudTextEl.getAttribute("value").slice(0,3) == "jxr" ) colorJxrEl( el )
|
||||
audio.play()
|
||||
// see from https://mechvibes.com/sound-packs/
|
||||
// index cherrymx-black-abs_config.json
|
||||
// actual sound cherrymx-black-abs_sound.ogg
|
||||
|
||||
})
|
||||
|
||||
// moved down a bit
|
||||
// done with Array.from( document.querySelectorAll(".keys_from_drumsticks") ).map( k => k.object3D.position.y-=.3 )
|
||||
|
||||
// TODO make keyboard user movable instead
|
||||
setTimeout( _ => {
|
||||
var bbox = new THREE.Box3().setFromObject(keyboard.object3D);
|
||||
const helper = new THREE.Box3Helper( bbox, 0xd3e3e5 )
|
||||
AFRAME.scenes[0].object3D.add( helper )
|
||||
setTimeout( _ => {
|
||||
var lastKnownPositionKeyboardMover = helper.position
|
||||
let el = addNewNote('<>', AFRAME.utils.coordinates.stringify(helper.position) )
|
||||
el.setAttribute("onreleased", "movedKeyboard()")
|
||||
window.movedKeyboard = function (){
|
||||
Array.from( document.querySelectorAll(".keys_from_drumsticks") ).map( k => {
|
||||
let newPos = selectedElements.at(-1).element.getAttribute("position")
|
||||
k.object3D.position.add( lastKnownPositionKeyboardMover.sub(newPos) )
|
||||
lastKnownPositionKeyboardMover = newPos
|
||||
})
|
||||
}
|
||||
}, 500 )
|
||||
|
||||
}, 500 )
|
||||
// see filters/pdf_unpacked.xml.js with target on rootEl
|
||||
|
||||
}, 3000 )
|
||||
|
||||
/*
|
||||
Step 5: Move text from the article
|
||||
• Select (e.g., pinch) the text from the article that was highlighted and move it out of the article into the Knowledge Space to inspect it
|
||||
• Also, move it on to the blank document where it populates the blank document with the bibliographic metadata and the text that was highlighted
|
||||
*/
|
||||
|
||||
/*
|
||||
Step 6: Add content on the blank document with the keyboard
|
||||
• Using the keyboard, the user inputs information onto the blank document, causing the text to appear below text already inputted
|
||||
*/
|
||||
|
||||
/*
|
||||
Step 7: Repeat this activity with “Melody: A Platform for Linked Open Data Visualisation and Curated Storytelling,” by Giulia Renda, Marilena Daquino, Valentina Presutti from the works accessible from the ACM HT’23 list of articles.
|
||||
*/
|
||||
|
||||
// TODO save state
|
||||
// see window.saveToLocateStorage = function (savingClass=classNameItemsToSave)
|
||||
const classNameToBeSaved = "tobesaved"
|
||||
let testingCommands = [
|
||||
{value:'flattenManuscriptExportToDocument()', annotation: "export to .txt flatten spatial manuscript"},
|
||||
{value:'flattenSpatialManuscript()', annotation: "flatten spatial manuscript"},
|
||||
{value:'saveToRemoteStorage()', annotation: "save remotely"},
|
||||
]
|
||||
let DISABLEtestingCommands = [ // TODO re-enable
|
||||
{value:'loadFromLocalStorage()', annotation: "load locally"},
|
||||
{value:'saveToLocalStorage()', annotation: "save locally"},
|
||||
{value:'loadFromRemoteStorage()', annotation: "load remotely"},
|
||||
{value:'saveToRemoteStorage()', annotation: "save remotely"},
|
||||
]
|
||||
let elements = testingCommands
|
||||
.map( (c,i) => {
|
||||
let el = addNewNote("jxr " + c.value, "-0.5 "+(0.8+i/10)+" -.45" )
|
||||
el.setAttribute("annotation", "content:"+ testingCommands[i].annotation)
|
||||
el.classList.add(classNameToBeSaved)
|
||||
el.setAttribute("rotation", "90 0 0")
|
||||
})
|
||||
|
||||
// TODO test
|
||||
window.flattenSpatialManuscript = function (savingClass=classNameToBeSaved){
|
||||
manuscript.setAttribute("visible", true)
|
||||
applyToClass(savingClass, el => {
|
||||
let value = el.getAttribute("value")
|
||||
if (!value.startsWith("jxr" )) manuscript.children[0].setAttribute( "value",
|
||||
manuscript.children[0].getAttribute( "value")
|
||||
+ "\n" + value
|
||||
)
|
||||
})
|
||||
// lose formatting
|
||||
highlights.map( h => { manuscript.children[0].setAttribute( "value", manuscript.children[0].getAttribute( "value") + "\n" + h.getAttribute("value") ) })
|
||||
// TODO position itself should matter, e.g. sorting on position y value
|
||||
}
|
||||
|
||||
window.flattenManuscriptExportToDocument = function (savingClass=classNameToBeSaved){
|
||||
async function w(path = "/file.txt"){ return await webdavClient.putFileContents(path, manuscript.children[0].getAttribute("value") ) }
|
||||
written = w(subdirWebDAV+usernamePrefix+saveBucketName+'.txt')
|
||||
}
|
||||
|
||||
const saveBucketName = "savingDataDemo_q3_annotatedbibliography_spatial"
|
||||
window.getDataToSave = function (){ // replaced by dedicated structure (didn't seem reliable)
|
||||
let minimalData = {}
|
||||
minimalData.notes = []
|
||||
minimalData.highlights = []
|
||||
toSave.notes.map( el => {
|
||||
minimalData.notes.push({ value : el.getAttribute("value"), position: el.getAttribute("position"), rotation: el.getAttribute("rotation") })
|
||||
// rotation / position could be shortened
|
||||
})
|
||||
toSave.highlights.map( el => {
|
||||
minimalData.highlights.push({ value : el.getAttribute("value"), position: el.getAttribute("position"), rotation: el.getAttribute("rotation") })
|
||||
})
|
||||
return minimalData
|
||||
}
|
||||
window.saveToLocalStorage = function (savingClass=classNameToBeSaved){
|
||||
localStorage.setItem(saveBucketName, JSON.stringify( getDataToSave(savingClass) ) )
|
||||
}
|
||||
|
||||
// assume that elements already exist as entities and are uniquely identifiable via their value (content based, NOT id)
|
||||
window.loadFromLocalStorage = function(){
|
||||
window.displaySavedData( JSON.parse( localStorage.getItem(saveBucketName) ) )
|
||||
}
|
||||
|
||||
window.loadFromRemoteStorage = function( lastSaveURL = "/q3_annotatedbibliography_savingDataDemo_q3_annotatedbibliography.json"){
|
||||
// could rely on showFile instead with a new filter endingWith e.g. savingDataDemo_q3_annotatedbibliography.json
|
||||
// e.g. showFile("https://companion.benetou.fr/q3_annotatedbibliography_savingDataDemo_q3_annotatedbibliography.json")
|
||||
fetch(lastSaveURL).then( res => res.json() ).then( json => { window.displaySavedData( json ) } )
|
||||
}
|
||||
const remote_storage_url = urlParams.get('remoteStorageURL');
|
||||
setTimeout( _ => {
|
||||
if (remote_storage_url) window.loadFromRemoteStorage( remote_storage_url )
|
||||
}, 5000 )
|
||||
// this should happen only AFTER the document is loaded and displayed
|
||||
// testable as https://companion.benetou.fr/index.html?username=q3_annotatedbibliography&remoteStorageURL=/q3_annotatedbibliography_savingDataDemo_q3_annotatedbibliography.json
|
||||
|
||||
// how to maintain provenance, have each visually identifiable
|
||||
// but also reconcialiation when needed, e.g. UI
|
||||
// window.loadFromRemoteStorage( remote_storage_url_A )
|
||||
// window.loadFromRemoteStorage( remote_storage_url_B )
|
||||
|
||||
window.displaySavedData = function( savedDataFromPreviousSession ){
|
||||
if ( !savedDataFromPreviousSession.notes ) savedDataFromPreviousSession.notes = []
|
||||
// TODO metadata of provenance, being able to toggle show/hide all data from 1 source
|
||||
savedDataFromPreviousSession.notes.map( n => {
|
||||
let newNote = addNewNote( n.value, n.position )
|
||||
newNote.setAttribute("rotation", n.rotation )
|
||||
})
|
||||
highlights = []
|
||||
savedDataFromPreviousSession.highlights.map( h => {
|
||||
let newNoteFromHighlight = addNewNote( h.value, h.position )
|
||||
newNoteFromHighlight.setAttribute("rotation", h.rotation )
|
||||
highlights.push( newNoteFromHighlight )
|
||||
Array.from( document.querySelectorAll(".highlightabletext") )
|
||||
.filter(el => h.value == el.getAttribute("value"))
|
||||
.map(el=> {
|
||||
el.setAttribute("color", highlightColor)
|
||||
AFRAME.scenes[0].setAttribute('live-selector-line__citation_'+Date.now(), {
|
||||
start: newNoteFromHighlight,
|
||||
end: el })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
window.saveToRemoteStorage = function (savingClass=classNameItemsToSave){
|
||||
async function w(path = "/file.txt"){ return await webdavClient.putFileContents(path, JSON.stringify( getDataToSave(savingClass) )) }
|
||||
written = w(subdirWebDAV+usernamePrefix+saveBucketName+'.json')
|
||||
//if (written){ fetch('https://ntfy.benetou.fr/fileuploadtowebdav', { method: 'POST', body: 'added '+usernamePrefix+saveBucketName }) }
|
||||
}
|
||||
|
||||
// should be added to ...
|
||||
// new notes see AFRAME.scenes[0].setAttribute("useraddednote-append-to", "target:#manuscript")
|
||||
// thus class "manuscriptnote"
|
||||
// should save their content too namely addingNewNote back with their values too
|
||||
|
||||
// start with setInterval
|
||||
|
||||
// reset (initial layout)
|
||||
// could refresh while preventing load?
|
||||
// not ideal as kicks out of XR on VisionPro
|
||||
// history of undo
|
||||
|
||||
// from meeting of the 16th July 2025
|
||||
|
||||
// ring to bold line from manuscript
|
||||
// need new layout, not single element
|
||||
|
||||
// remove the cited document
|
||||
// not the actual focus
|
||||
|
||||
// bring document to the center
|
||||
// showing the result, why all this work
|
||||
// toggle flatten/volumetric views
|
||||
|
||||
} // ignore function
|
||||
|
||||
127
data/demos_editor_example.html
Normal file
127
data/demos_editor_example.html
Normal file
@@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="https://fabien.benetou.fr/pub/home/future_of_text_demo/engine/dependencies/webdav.js"></script>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<button onclick="save()">save</button>
|
||||
|
||||
<div id=content></div>
|
||||
|
||||
<script>
|
||||
// insert screenshots (could probably do the same way, i.e. filereader then webdav upload
|
||||
const webdavURL = "https://webdav.benetou.fr";
|
||||
const subdirWebDAV = "/fotsave/fot_sloan_companion_public/"
|
||||
var webdavClient = window.WebDAV.createClient(webdavURL)
|
||||
const hmdURL = "https://hmd.link/?https://companion.benetou.fr"
|
||||
|
||||
// const eventSourceConverted = new EventSource( `https://ntfy.benetou.fr/convertedwebdav/sse` )
|
||||
// to use for live updates
|
||||
|
||||
let positions = []
|
||||
let newElements = []
|
||||
let originalJSON
|
||||
|
||||
function save(){
|
||||
let newContent = {}
|
||||
newContent.configuration = originalJSON.configuration
|
||||
newContent.content = []
|
||||
newElements.map( n => newContent.content.push( originalJSON.content.find( o => o.name == n ) ) )
|
||||
// assuming we always find
|
||||
let uu = originalJSON.content.find( n => n["unassigned-usernames"] )
|
||||
if ( uu ) newContent.content.push( uu )
|
||||
let filename = "demos_saved_"+Date.now()+".json"
|
||||
saveJSONToWebDAV( filename, newContent )
|
||||
let url = "https://companion.benetou.fr/demos_example.html?filename="+filename
|
||||
// let url = webdavURL+subdirWebDAV+filename
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
|
||||
function saveJSONToWebDAV(filename, content){
|
||||
async function w(path = "/file.txt"){ return await webdavClient.putFileContents(path, JSON.stringify(content)) }
|
||||
written = w(subdirWebDAV+filename)
|
||||
}
|
||||
|
||||
async function getContent(){
|
||||
let rootEl = document.getElementById("content")
|
||||
const contents = await webdavClient.getDirectoryContents(subdirWebDAV);
|
||||
// consider instead search https://github.com/perry-mitchell/webdav-client#search
|
||||
contents.filter(f => f.basename.endsWith('demo_q1.json'))
|
||||
.map(a => {
|
||||
fetch(a.basename).then( r => r.json() ).then( r => {
|
||||
originalJSON = r
|
||||
r.content.filter( c => c.name ).map( c => {
|
||||
let el = document.createElement("h3")
|
||||
el.innerText = c.name
|
||||
el.draggable="true"
|
||||
el.ondragend = (e) => {
|
||||
// console.log( e.layerY )
|
||||
let name = e.target.innerText
|
||||
newElements = newElements.filter( n => n != name)
|
||||
if ( e.layerY < positions[0].y ) {
|
||||
// console.log( 'before first' )
|
||||
newElements = [name].concat(newElements)
|
||||
}
|
||||
if ( e.layerY > positions.at(-1).y ) {
|
||||
// console.log( 'after last' )
|
||||
newElements.push( name )
|
||||
}
|
||||
positions.map( (p,i) => {
|
||||
let next = positions[i+1]
|
||||
if (next && e.layerY > p.y && e.layerY < next.y){
|
||||
// console.log( name, 'between', p.name, ' & ', next.name)
|
||||
newElements.splice(newElements.indexOf(next.name), 0, name)
|
||||
}
|
||||
})
|
||||
// console.log( newElements )
|
||||
let existing = Array.from( rootEl.children )
|
||||
newElements.map( (el,i) => existing[i].innerText = el )
|
||||
|
||||
}
|
||||
rootEl.appendChild(el)
|
||||
let pos = el.getBoundingClientRect()
|
||||
positions.push( { name:c.name, y:pos.y+pos.height/2 } )
|
||||
newElements.push( c.name )
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
getContent()
|
||||
</script>
|
||||
|
||||
<div id=comments>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<h3>
|
||||
ideas :
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>remove items (to split into N demos)
|
||||
<li>update code link to proper repository, i.e. https://git.benetou.fr/utopiah/spasca-fot-sloan-q1
|
||||
<li>better integration with viewer (e.g. side by side view)
|
||||
<li>in XR mode
|
||||
<li>listing of past saved demo queues
|
||||
</ul>
|
||||
|
||||
<h3>
|
||||
done :
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>save
|
||||
<li>linked from viewer
|
||||
<li>re-order
|
||||
<li>test output https://companion.benetou.fr/demos_saved_1742539103750.json
|
||||
<li>open directly in viewer, e.g. https://companion.benetou.fr/demos_example.html?filename=demos_saved_1742882525475.json
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
170
data/demos_example.html
Normal file
170
data/demos_example.html
Normal file
@@ -0,0 +1,170 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="https://fabien.benetou.fr/pub/home/future_of_text_demo/engine/dependencies/webdav.js"></script>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div id=content></div>
|
||||
|
||||
<script>
|
||||
// insert screenshots (could probably do the same way, i.e. filereader then webdav upload
|
||||
const webdavURL = "https://webdav.benetou.fr";
|
||||
const subdirWebDAV = "/fotsave/fot_sloan_companion_public/"
|
||||
var webdavClient = window.WebDAV.createClient(webdavURL)
|
||||
const hmdURL = "https://hmd.link/?https://companion.benetou.fr"
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
let filename = urlParams.get('filename');
|
||||
if (!filename) filename = 'demo_q1.json'
|
||||
|
||||
// should update on query parameter
|
||||
// should then use that in demo editor page
|
||||
|
||||
// const eventSourceConverted = new EventSource( `https://ntfy.benetou.fr/convertedwebdav/sse` )
|
||||
// to use for live updates
|
||||
|
||||
async function getContent(){
|
||||
let rootEl = document.getElementById("content")
|
||||
/*
|
||||
const contents = await webdavClient.getDirectoryContents(subdirWebDAV);
|
||||
// consider instead search https://github.com/perry-mitchell/webdav-client#search
|
||||
contents.filter(f => f.basename.endsWith( filename ))
|
||||
.map(a => {
|
||||
fetch(a.basename).then( r => r.json() ).then( r => {
|
||||
*/
|
||||
// removed direct WebDAV as it seems to create CORS issues (which... wasn't the case until now?)
|
||||
fetch(filename).then( r => r.json() ).then( r => {
|
||||
r.content.filter( c => c.name ).map( c => {
|
||||
let h2 = document.createElement("h2")
|
||||
h2.innerText = c.name
|
||||
h2.id = c.name.replaceAll(' ', '_') // is added after the page has loaded... should position back
|
||||
rootEl.appendChild(h2)
|
||||
if ( c.screenshot ){
|
||||
let img = document.createElement("img")
|
||||
img.src = c.screenshot
|
||||
img.style.height = "200px"
|
||||
rootEl.appendChild(img)
|
||||
}
|
||||
if ( c.description ){
|
||||
let h3 = document.createElement("h3")
|
||||
//h3.innerText = c.description //.replace()
|
||||
h3.innerHTML = c.description.replace(/(.*) (http.*)/,'$1 <a href="$2">$2</a>').replaceAll('\n','<br>')
|
||||
// could be innerHTML instead
|
||||
// should make link clickable
|
||||
rootEl.appendChild(h3)
|
||||
}
|
||||
if ( c.video ){
|
||||
let ul = document.createElement("ul")
|
||||
rootEl.appendChild(ul)
|
||||
let li = document.createElement("li")
|
||||
let link = document.createElement("a")
|
||||
link.href = c.video
|
||||
link.innerText = "video extract"
|
||||
ul.appendChild(li)
|
||||
link.target = "_blank"
|
||||
li.appendChild(link)
|
||||
}
|
||||
if (c.usernames) {
|
||||
let ul = document.createElement("ul")
|
||||
rootEl.appendChild(ul)
|
||||
|
||||
c.usernames.map( h => {
|
||||
let li = document.createElement("li")
|
||||
let link = document.createElement("a")
|
||||
link.href = "/index.html?username="+h
|
||||
link.innerText = "link"
|
||||
li.appendChild(link)
|
||||
let spanEl = document.createElement("span")
|
||||
spanEl.innerText = " "
|
||||
li.appendChild(spanEl)
|
||||
let linkHMD = document.createElement("a")
|
||||
linkHMD.href = hmdURL + "/index.html?username="+h
|
||||
linkHMD.target = "_blank"
|
||||
linkHMD.innerText = "(open on other device)"
|
||||
li.appendChild(linkHMD)
|
||||
ul.appendChild(li)
|
||||
})
|
||||
}
|
||||
if (c.testingurl) {
|
||||
let h3 = document.createElement("h4")
|
||||
h3.innerHTML = "testing URL:"
|
||||
rootEl.appendChild(h3)
|
||||
let ul = document.createElement("ul")
|
||||
rootEl.appendChild(ul)
|
||||
c.testingurl.map( h => {
|
||||
let li = document.createElement("li")
|
||||
let link = document.createElement("a")
|
||||
link.href = h
|
||||
link.innerText = h.replace(/.*\//,'')
|
||||
li.appendChild(link)
|
||||
ul.appendChild(li)
|
||||
})
|
||||
}
|
||||
if (c.code) {
|
||||
let h3 = document.createElement("h4")
|
||||
h3.innerHTML = "code:"
|
||||
rootEl.appendChild(h3)
|
||||
let ul = document.createElement("ul")
|
||||
rootEl.appendChild(ul)
|
||||
c.code.map( h => {
|
||||
let li = document.createElement("li")
|
||||
let link = document.createElement("a")
|
||||
link.href = h
|
||||
link.innerText = h.replace(/.*\//,'')
|
||||
li.appendChild(link)
|
||||
ul.appendChild(li)
|
||||
})
|
||||
}
|
||||
|
||||
let hr = document.createElement("hr")
|
||||
rootEl.appendChild(hr)
|
||||
})
|
||||
if (location.hash) document.getElementById(location.hash.replace('#','')).scrollIntoView()
|
||||
})
|
||||
//})
|
||||
}
|
||||
|
||||
getContent()
|
||||
</script>
|
||||
|
||||
<div id=comments>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<h3>
|
||||
ideas :
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>integrate better live messages (via ?allowNtfyFeedbackHUD=true , e.g. https://companion.benetou.fr/index.htm?allowNtfyFeedbackHUD=true )
|
||||
<li>JSON editing, either as-is or via PmWiki (including raw text within JSON) or with CodeMirror as editor (just text area is plain text should be enough
|
||||
<li>feedback intertwined per demo (based on screenshot/audio recording demos)
|
||||
<li>richer text rendering (beyond just clickable link)
|
||||
<li>couple live messages with inView(targetSelector)
|
||||
<li>showcase sequentialFiltersInteractionOnReleased
|
||||
<li>prepopulate JSON, e.g. demo_q3.json via https://video.benetou.fr/api/v1/search/videos?tagOneOf=q3_fot_sloan
|
||||
</ul>
|
||||
|
||||
<h3>
|
||||
done :
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>hmd.link/? to share directly over same local network
|
||||
<li>link as clickable (right now only trailing ones, and 1 link per description maximum)
|
||||
<li>source JSON URL https://webdav.benetou.fr/fotsave/fot_sloan_companion_public/demo_q1.json
|
||||
<li>alternative descriptions https://futuretextlab.info/1st-quarter/ (more verbose but static)
|
||||
<li>mobile view
|
||||
<li>linked to editor : https://companion.benetou.fr/demos_editor_example.html
|
||||
<li>edited list https://companion.benetou.fr/demos_example.html?filename=demos_saved_1742834331999.json
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
195
data/demos_feedback_example.html
Normal file
195
data/demos_feedback_example.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="https://fabien.benetou.fr/pub/home/future_of_text_demo/engine/dependencies/webdav.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Feedback on XR for academic authoring demo</h1>
|
||||
|
||||
<div>Please feel the form freely. You can add comment per demo, all optionals, and at the end global feedback and your email. Every word is appreciated. Write as much or as little as you like. Press send at the bottom to save.</div>
|
||||
|
||||
<div id=content></div>
|
||||
|
||||
<script>
|
||||
// insert screenshots (could probably do the same way, i.e. filereader then webdav upload
|
||||
const webdavURL = "https://webdav.benetou.fr";
|
||||
const subdirWebDAV = "/fotsave/fot_sloan_companion_public/"
|
||||
var webdavClient = window.WebDAV.createClient(webdavURL)
|
||||
const hmdURL = "https://hmd.link/?https://companion.benetou.fr"
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
let filename = urlParams.get('filename');
|
||||
if (!filename) filename = 'demo_q1.json'
|
||||
|
||||
function save(){
|
||||
let newContent = {}
|
||||
let saveFilename = "demos_feedback_"+Date.now()+".json"
|
||||
newContent.filename = filename
|
||||
Array.from( document.querySelectorAll('.tosave')).map( e => {
|
||||
if ( e.value )
|
||||
newContent[e.id] = e.value
|
||||
})
|
||||
saveJSONToWebDAV( saveFilename, newContent )
|
||||
console.log( saveFilename, newContent )
|
||||
let url = "https://companion.benetou.fr/demos_feedback_viewer_example.html?filename="+saveFilename
|
||||
// let url = webdavURL+subdirWebDAV+filename
|
||||
setTimeout( _ => window.open(url, '_blank'), 1000 )
|
||||
}
|
||||
|
||||
function saveJSONToWebDAV(filename, content){
|
||||
async function w(path = "/file.txt"){ return await webdavClient.putFileContents(path, JSON.stringify(content)) }
|
||||
written = w(subdirWebDAV+filename)
|
||||
}
|
||||
|
||||
async function getContent(){
|
||||
let rootEl = document.getElementById("content")
|
||||
const contents = await webdavClient.getDirectoryContents(subdirWebDAV);
|
||||
// consider instead search https://github.com/perry-mitchell/webdav-client#search
|
||||
contents.filter(f => f.basename.endsWith( filename ))
|
||||
.map(a => {
|
||||
fetch(a.basename).then( r => r.json() ).then( r => {
|
||||
r.content.filter( c => c.name ).map( c => {
|
||||
let h2 = document.createElement("h2")
|
||||
h2.innerText = c.name
|
||||
rootEl.appendChild(h2)
|
||||
if ( c.screenshot ){
|
||||
let img = document.createElement("img")
|
||||
img.src = c.screenshot
|
||||
img.style.height = "200px"
|
||||
rootEl.appendChild(img)
|
||||
}
|
||||
if ( c.description ){
|
||||
let h3 = document.createElement("h3")
|
||||
//h3.innerText = c.description //.replace()
|
||||
h3.innerHTML = c.description.replace(/(.*) (http.*)/,'$1 <a href="$2">$2</a>').replaceAll('\n','<br>')
|
||||
// could be innerHTML instead
|
||||
// should make link clickable
|
||||
rootEl.appendChild(h3)
|
||||
let textarea = document.createElement("textarea")
|
||||
textarea.cols = 40
|
||||
if ( window.screen.width > 1000 ) {
|
||||
textarea.style = "float:right;margin-top:-100px"
|
||||
textarea.cols = 80
|
||||
}
|
||||
textarea.rows = 5
|
||||
textarea.id = c.name.replaceAll(' ','_')
|
||||
textarea.classList.add('tosave')
|
||||
rootEl.appendChild(textarea)
|
||||
}
|
||||
if ( c.video ){
|
||||
let ul = document.createElement("ul")
|
||||
rootEl.appendChild(ul)
|
||||
let li = document.createElement("li")
|
||||
let link = document.createElement("a")
|
||||
link.href = c.video
|
||||
link.innerText = "video extract"
|
||||
ul.appendChild(li)
|
||||
link.target = "_blank"
|
||||
li.appendChild(link)
|
||||
}
|
||||
if (c.usernames) {
|
||||
let ul = document.createElement("ul")
|
||||
rootEl.appendChild(ul)
|
||||
|
||||
c.usernames.map( h => {
|
||||
let li = document.createElement("li")
|
||||
let link = document.createElement("a")
|
||||
link.href = "/index.html?username="+h
|
||||
link.innerText = "link"
|
||||
li.appendChild(link)
|
||||
let spanEl = document.createElement("span")
|
||||
spanEl.innerText = " "
|
||||
li.appendChild(spanEl)
|
||||
let linkHMD = document.createElement("a")
|
||||
linkHMD.href = hmdURL + "/index.html?username="+h
|
||||
linkHMD.target = "_blank"
|
||||
linkHMD.innerText = "(open on other device)"
|
||||
li.appendChild(linkHMD)
|
||||
ul.appendChild(li)
|
||||
})
|
||||
}
|
||||
if (c.code) {
|
||||
let h3 = document.createElement("h4")
|
||||
h3.innerHTML = "code:"
|
||||
rootEl.appendChild(h3)
|
||||
let ul = document.createElement("ul")
|
||||
rootEl.appendChild(ul)
|
||||
c.code.map( h => {
|
||||
let li = document.createElement("li")
|
||||
let link = document.createElement("a")
|
||||
link.href = h
|
||||
link.innerText = h.replace(/.*\//,'')
|
||||
li.appendChild(link)
|
||||
ul.appendChild(li)
|
||||
})
|
||||
}
|
||||
|
||||
let hr = document.createElement("hr")
|
||||
rootEl.appendChild(hr)
|
||||
})
|
||||
})
|
||||
})
|
||||
setTimeout( _ => {
|
||||
let h3 = document.createElement("h4")
|
||||
h3.innerHTML = "global feedback, any idea or suggestion, what hardware was used, context for the demo, etc, anything goes :"
|
||||
rootEl.appendChild(h3)
|
||||
let textarea = document.createElement("textarea")
|
||||
//textarea.style = "float:right;margin-top:-100px"
|
||||
textarea.cols = 80
|
||||
textarea.rows = 5
|
||||
textarea.id = 'freeform_feedback'
|
||||
textarea.classList.add('tosave')
|
||||
rootEl.appendChild(textarea)
|
||||
let br = document.createElement("br")
|
||||
rootEl.appendChild(br)
|
||||
let span = document.createElement("span")
|
||||
span.innerText = 'email:'
|
||||
rootEl.appendChild(span)
|
||||
let input = document.createElement("input")
|
||||
input.classList.add('tosave')
|
||||
input.id = "email"
|
||||
rootEl.appendChild(input)
|
||||
rootEl.appendChild(br.cloneNode())
|
||||
let button = document.createElement("button")
|
||||
button.innerText = 'send feedback'
|
||||
button.onclick = save
|
||||
rootEl.appendChild(button)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
getContent()
|
||||
</script>
|
||||
|
||||
<div id=comments>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3>
|
||||
ideas :
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>save on local storage (if so, provide a clear all fields button)
|
||||
<li>accept audio feedback
|
||||
<li>ntfy on feedback received
|
||||
</ul>
|
||||
|
||||
<h3>
|
||||
done :
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>responsive-ish design
|
||||
<li>save, including which JSON source file was used (now that experiment list and order can be modified)
|
||||
<li>principle
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
101
data/demos_feedback_viewer_example.html
Normal file
101
data/demos_feedback_viewer_example.html
Normal file
@@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="https://fabien.benetou.fr/pub/home/future_of_text_demo/engine/dependencies/webdav.js"></script>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Feedback on XR for academic authoring demo</h1>
|
||||
|
||||
<div id=content></div>
|
||||
|
||||
<script>
|
||||
// insert screenshots (could probably do the same way, i.e. filereader then webdav upload
|
||||
const webdavURL = "https://webdav.benetou.fr";
|
||||
const subdirWebDAV = "/fotsave/fot_sloan_companion_public/"
|
||||
var webdavClient = window.WebDAV.createClient(webdavURL)
|
||||
const hmdURL = "https://hmd.link/?https://companion.benetou.fr"
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
let filename = urlParams.get('filename');
|
||||
if (!filename) filename = 'demos_feedback_1742934066973.json'
|
||||
|
||||
async function getContent(){
|
||||
let rootEl = document.getElementById("content")
|
||||
const contents = await webdavClient.getDirectoryContents(subdirWebDAV);
|
||||
// consider instead search https://github.com/perry-mitchell/webdav-client#search
|
||||
contents.filter(f => f.basename.endsWith( filename ))
|
||||
.map(a => {
|
||||
fetch(a.basename).then( r => r.json() ).then( r => {
|
||||
if ( r.filename ){
|
||||
let spanEl = document.createElement("div")
|
||||
let linkEl = document.createElement("a")
|
||||
linkEl.href = "https://companion.benetou.fr/demos_example.html?filename=" + r.filename
|
||||
linkEl.innerText = r.filename
|
||||
spanEl.appendChild(linkEl)
|
||||
//spanEl.innerText = "source file: " + r.filename
|
||||
rootEl.appendChild(spanEl)
|
||||
}
|
||||
if ( r.email ){
|
||||
let spanEl = document.createElement("div")
|
||||
spanEl.innerText = "email: " + r.email
|
||||
rootEl.appendChild(spanEl)
|
||||
}
|
||||
if ( r.freeform_feedback ){
|
||||
let spanEl = document.createElement("div")
|
||||
spanEl.innerText = "free feedback form: " + r.freeform_feedback
|
||||
rootEl.appendChild(spanEl)
|
||||
}
|
||||
fetch(r.filename).then( r => r.json() ).then( original => {
|
||||
original.content.map( d => {
|
||||
if ( d.name ){
|
||||
let fixedId = d.name.replaceAll(' ','_')
|
||||
if ( r[fixedId] ) {
|
||||
let spanEl = document.createElement("div")
|
||||
spanEl.innerText = r[fixedId] + " for "
|
||||
rootEl.appendChild(spanEl)
|
||||
let linkEl = document.createElement("a")
|
||||
linkEl.href = "https://companion.benetou.fr/demos_example.html?filename=" + r.filename + "#"+fixedId
|
||||
linkEl.innerText = d.name + " in " + r.filename
|
||||
spanEl.appendChild(linkEl)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
getContent()
|
||||
</script>
|
||||
|
||||
<div id=comments>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3>
|
||||
ideas :
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>link back to go anchors on orignial demo viewer page
|
||||
</ul>
|
||||
|
||||
<h3>
|
||||
done :
|
||||
</h3>
|
||||
|
||||
<ul>
|
||||
<li>link to proper example, e.g. https://companion.benetou.fr/demos_feedback_viewer_example.html?filename=demos_feedback_1742934066973.json
|
||||
<li>display feedback
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1
data/dynamic-snap.min.js
vendored
Normal file
1
data/dynamic-snap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
data/example.prototype
Normal file
10
data/example.prototype
Normal file
@@ -0,0 +1,10 @@
|
||||
title: dot proto
|
||||
description: metadata file for prototype that can be found (via e.g. find) then used to make prototypes accessible after their immediate use, see also https://fabien.benetou.fr/Fabien/Principle
|
||||
files: ./index.proto
|
||||
environment: any
|
||||
# ignore:
|
||||
# video: URL1
|
||||
# video: URL2
|
||||
# thumbnail: URL3
|
||||
# setup_instructions: none here present
|
||||
format: plaintext # could be plaintext or markdown or anything else but never binary blobs
|
||||
75
data/fabien_corneish_zen.keymap
Normal file
75
data/fabien_corneish_zen.keymap
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
#include <dt-bindings/zmk/bt.h>
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,matrix_transform = &default_transform;
|
||||
//zmk,matrix_transform = &five_column_transform;
|
||||
};
|
||||
};
|
||||
|
||||
/ {
|
||||
|
||||
|
||||
behaviors {
|
||||
hm: homerow_mods {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "HOMEROW_MODS";
|
||||
#binding-cells = <2>;
|
||||
tapping-term-ms = <150>;
|
||||
quick-tap-ms = <0>;
|
||||
flavor = "tap-preferred";
|
||||
bindings = <&kp>, <&kp>;
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
label = "QWERTY";
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// | TAB | Q | W | E | R | T | | Y | U | I | O | P | BKSP |
|
||||
// | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' |
|
||||
// | SHFT | Z | X | C | V | B | | N | M | , | . | / | ESC |
|
||||
// | GUI | LWR | SPC | | ENT | RSE | ALT |
|
||||
bindings = <
|
||||
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
|
||||
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
|
||||
//&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
|
||||
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ESC
|
||||
&kp LGUI &mo 1 &kp SPACE &kp RET &mo 2 &kp RALT
|
||||
>;
|
||||
};
|
||||
lower_layer {
|
||||
label = "NUMBER";
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// | TAB | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BKSP |
|
||||
// | | BT1 | BT2 | BT3 | BT4 | BT5 | | LFT | DWN | UP | RGT | | |
|
||||
// | SHFT | F11 | F12 | | | | | | PAGE_DOWN | PAGE_UP | | | BTCLR |
|
||||
// | GUI | | SPC | | ENT | | ALT |
|
||||
bindings = <
|
||||
&kp TAB &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC
|
||||
&trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans &trans
|
||||
&kp LSHFT &kp F11 &kp F12 &trans &trans &trans &trans &kp PAGE_DOWN &kp PAGE_UP &trans &trans &bt BT_CLR
|
||||
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
|
||||
>;
|
||||
};
|
||||
|
||||
raise_layer {
|
||||
label = "SYMBOL";
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// | TAB | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BKSP |
|
||||
// | CTRL | | | | | | | - | = | [ | ] | \ | ` |
|
||||
// | SHFT | pp | vUP | vDO | | | | _ | + | { | } | "|" | ~ |
|
||||
// | GUI | | SPC | | ENT | | ALT |
|
||||
bindings = <
|
||||
&kp TAB &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR &kp BSPC
|
||||
&kp LCTRL &trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE
|
||||
&kp LSHFT &kp C_PLAY_PAUSE &kp K_VOLUME_UP &kp K_VOLUME_DOWN &trans &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE
|
||||
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
9
data/filesystems_in_XR/.extras_autoenter.json
Normal file
9
data/filesystems_in_XR/.extras_autoenter.json
Normal file
@@ -0,0 +1,9 @@
|
||||
[
|
||||
{"filename":"filesystems_in_XR/title.txt","position":"-1 2 -1", "rotation":"20 0 0", "scale":".4 .4 .4"},
|
||||
|
||||
{"filename":"filesystems_in_XR/background.txt","position":"-1 1 -.5", "rotation":"0 45 0"},
|
||||
{"filename":"filesystems_in_XR/now.txt","position":"0 1 -.5", "rotation":"0 45 0"},
|
||||
{"filename":"filesystems_in_XR/tomorrow.txt","position":"1 1 -.5", "rotation":"0 -45 0"},
|
||||
|
||||
{"filename":"filesystems_in_XR/preview.jpg","position":"0 2 -3", "rotation":"0 0 0","scale": "2 1 1"}
|
||||
]
|
||||
16
data/filesystems_in_XR/background.txt
Normal file
16
data/filesystems_in_XR/background.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
Some years ago most of us starting walk around with mobile phones. Those phones
|
||||
used "apps" or mobile applications. In order to make our mobile lives safer each
|
||||
application was limited to its own context, sandboxed so that the operating
|
||||
system would manage everything safely.
|
||||
|
||||
This was all done to protect us, simple users, again malicious attempts at
|
||||
hacking our increasingly digital life.
|
||||
|
||||
This in theory is good for us. Unfortunately we also lost something we grew
|
||||
very accustomed to : files.
|
||||
|
||||
Our mobile lives didn't give us files but rather isolated experiences as "apps".
|
||||
XR repeated this pattern, maybe due to technical limitations (relying on Android,
|
||||
like most phones on the planet) maybe due to lack of imagination.
|
||||
|
||||
In practice it means currently each XR experience is again sandboxed, against file-less.
|
||||
23
data/filesystems_in_XR/filesystems_in_XR.txt
Normal file
23
data/filesystems_in_XR/filesystems_in_XR.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
From isolated XR experiences to files in XR to filesystems in XR
|
||||
|
||||
Some years ago most of us starting walk around with mobile phones. Those phones used "apps" or mobile applications. In order to make our mobile lives safer each application was limited to its own context, sandboxed so that the operating system would manage everything safely.
|
||||
|
||||
This was all done to protect us, simple users, again malicious attempts at hacking our increasingly digital life.
|
||||
|
||||
This in theory is good for us. Unfortunately we also lost something we grew very accustomed to : files.
|
||||
|
||||
Our mobile lives didn't give us files but rather isolated experiences as "apps". XR repeated this pattern, maybe due to technical limitations (relying on Android, like most phones on the planet) maybe due to lack of imagination.
|
||||
|
||||
In practice it means currently each XR experience is again sandboxed, against file-less.
|
||||
|
||||
Last year we demonstrated that taking files seriously was empowering. Over the last months we have add more and more filters allowing not just to display the icon of actual files but their content. Even though this is limited to some file types and the content itself is manipulable only in some way, the process opened up a lot of exciting possiblities.
|
||||
|
||||
We knew files we powerful. We know they still are (which is why it also had to be put into law with mandatory data take out) regardless of devices used.
|
||||
|
||||
Out of this exciting new potential came hew challenges, namely what can one do with... too many files?
|
||||
|
||||
Once again the answer does not come from our creativity... but our history with content, digital or name, namely file cabinets or rather directories. In fact putting directories inside directories, with file in them, gave us filesystems.
|
||||
|
||||
What if we could not just manipulate objects in XR, not solely files, but rather set of files as filesystems? What could be do if we took directories and their files seriously?
|
||||
|
||||
What can manipulating entirely filesystems, and their content, in XR feel like? What exciting new potential can it open?
|
||||
15
data/filesystems_in_XR/now.txt
Normal file
15
data/filesystems_in_XR/now.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Last year we demonstrated that taking files seriously was empowering. Over the
|
||||
last months we have add more and more filters allowing not just to display the
|
||||
icon of actual files but their content. Even though this is limited to some
|
||||
file types and the content itself is manipulable only in some way, the process
|
||||
opened up a lot of exciting possiblities.
|
||||
|
||||
We knew files we powerful. We know they still are (which is why it also had to
|
||||
be put into law with mandatory data take out) regardless of devices used.
|
||||
|
||||
Out of this exciting new potential came hew challenges, namely what can one do
|
||||
with... too many files?
|
||||
|
||||
Once again the answer does not come from our creativity... but our history with
|
||||
content, digital or name, namely file cabinets or rather directories. In fact
|
||||
putting directories inside directories, with file in them, gave us filesystems.
|
||||
BIN
data/filesystems_in_XR/preview.jpg
Normal file
BIN
data/filesystems_in_XR/preview.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
1
data/filesystems_in_XR/title.txt
Normal file
1
data/filesystems_in_XR/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
From isolated XR experiences to files in XR to filesystems in XR
|
||||
6
data/filesystems_in_XR/tomorrow.txt
Normal file
6
data/filesystems_in_XR/tomorrow.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
What if we could not just manipulate objects in XR, not solely files, but
|
||||
rather set of files as filesystems? What could be do if we took directories
|
||||
and their files seriously?
|
||||
|
||||
What can manipulating entirely filesystems, and their content, in XR feel like?
|
||||
What exciting new potential can it open?
|
||||
50
data/filters/csl-json.js
Normal file
50
data/filters/csl-json.js
Normal file
@@ -0,0 +1,50 @@
|
||||
function filterCSLJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentType.includes("json") && contentFilename.includes("csl-data.json") ) {
|
||||
console.log('it is a CSL JSON file', contentFilename)
|
||||
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
console.log( JSON.stringify(json))
|
||||
|
||||
console.log( "mereology", openingOptions.mereology )
|
||||
switch( openingOptions.mereology ) {
|
||||
case "whole":
|
||||
addNewNote( JSON.stringify(json) , "0 1.4 -.8")
|
||||
break;
|
||||
case "listonly":
|
||||
default:
|
||||
addNewNote( JSON.stringify(json) , "0 1.4 -.8")
|
||||
}
|
||||
|
||||
const rootEl = document.createElement("a-entity")
|
||||
// having a root element to attach on makes manipulation later on easier and safer, bringing a context for later modifications
|
||||
rootEl.fromfile = json
|
||||
// to make the data usable, better with JSON or per element but still potentially useful by other elements
|
||||
file.filteredEl = rootEl
|
||||
rootEl.test = _ => console.log( 'test' )
|
||||
// function that can then be called on the created element later on
|
||||
// e.g. filesWithMetadata["https://companion.benetou.fr/saved/pdfxml/3209542.3209570.xml"].filteredEl.nextPage('ok')
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
|
||||
AFRAME.scenes[0].emit('csljsonloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("templateexampleloaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterCSLJSON )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
31
data/filters/csv.js
Normal file
31
data/filters/csv.js
Normal file
@@ -0,0 +1,31 @@
|
||||
function filterCSV( contentFilename ){
|
||||
|
||||
if ( contentFilename.endsWith(".csv") ) {
|
||||
console.log('it is a CSV file', contentFilename)
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
fetch( contentFilename )
|
||||
.then( r => r.text() ).then( r => {
|
||||
// console.log('CSV', r)
|
||||
|
||||
console.log( "mereology", openingOptions.mereology )
|
||||
switch( openingOptions.mereology ) {
|
||||
case "whole":
|
||||
addNewNote(r, "0 1.4 -.8")
|
||||
break;
|
||||
default:
|
||||
r.split('\n').map( (c,i) => addNewNote(c, "0 "+(1+i/10)+" -.8") )
|
||||
}
|
||||
|
||||
AFRAME.scenes[0].emit('csvloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("csvloaded", e => console.log(e))
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterCSV )
|
||||
30
data/filters/docx_packed.xml.js
Normal file
30
data/filters/docx_packed.xml.js
Normal file
@@ -0,0 +1,30 @@
|
||||
function filterDocx( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("xml") && contentFilename.includes("_content.docx/") && contentFilename.endsWith(".docx")) {
|
||||
console.log('it is a docx packed file', contentFilename)
|
||||
fetch( contentFilename )
|
||||
.then( r => r.blob(r) )
|
||||
.then( file => zip.loadAsync(file) )
|
||||
.then( f => {
|
||||
// console.log(f.files)
|
||||
|
||||
f.files["word/document.xml"].async("string")
|
||||
.then( str => new window.DOMParser().parseFromString(str, "text/xml"))
|
||||
.then(data => {
|
||||
// console.log('docx via packed', data)
|
||||
|
||||
el = addNewNote( data.childNodes[0].textContent, "-.5 1.2 -0.5" )
|
||||
AFRAME.scenes[0].emit('docxxmlloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("visualmetajsonloaded", e => console.log(e))
|
||||
})
|
||||
});
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterDocx )
|
||||
24
data/filters/docx_unpacked.xml.js
Normal file
24
data/filters/docx_unpacked.xml.js
Normal file
@@ -0,0 +1,24 @@
|
||||
function filterDocxJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("xml") && contentFilename.includes("_content.docx/") && contentFilename.endsWith(".xml")) {
|
||||
console.log('it is a docx file', contentFilename)
|
||||
fetch( contentFilename )
|
||||
.then(response => response.text())
|
||||
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
|
||||
.then(data => {
|
||||
// console.log(data)
|
||||
|
||||
el = addNewNote( data.childNodes[0].textContent, "0 1.2 -0.7" )
|
||||
AFRAME.scenes[0].emit('docxxmlloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("visualmetajsonloaded", e => console.log(e))
|
||||
});
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterDocxJSON )
|
||||
42
data/filters/dotdesktop.js
Normal file
42
data/filters/dotdesktop.js
Normal file
@@ -0,0 +1,42 @@
|
||||
function filterDotDesktop( contentFilename ){
|
||||
// see https://specifications.freedesktop.org/desktop-entry/latest/
|
||||
// initially as https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/fot-sloan-companion/public/index.html#L771-L793
|
||||
// if (!file) return
|
||||
// special filter, done via URL, no local file (for now at least)
|
||||
|
||||
if ( contentFilename.endsWith(".desktop") ) { // not very reliable
|
||||
console.log('it is a .desktop file', contentFilename)
|
||||
|
||||
fetch( contentFilename )
|
||||
.then( r => r.text() ).then( text => {
|
||||
console.log( text )
|
||||
let el, name, url
|
||||
text.split('\n').map(line => {
|
||||
if ( line.startsWith('[') ){
|
||||
console.log('group header:', line)
|
||||
if (line.includes("[Desktop Action ")){
|
||||
let action = line.replace('[Desktop Action ','').replace(']','')
|
||||
console.warn(`group include action ${action}, not yet supported` )
|
||||
}
|
||||
}
|
||||
if (line.includes("Name"))
|
||||
name = line.split('=',2)[1]
|
||||
if (line.includes("URL")){
|
||||
url = line.split('=',2)[1]
|
||||
// name could be a JXR annotation
|
||||
el = addNewNote( "jxr location='"+url+"'" )
|
||||
setTimeout( _ => el.object3D.position.y += Math.random(), 200 )
|
||||
if (name) el.setAttribute("annotation", "content", name)
|
||||
}
|
||||
if (!el && name) addNewNote( name )
|
||||
})
|
||||
|
||||
AFRAME.scenes[0].emit('dotdesktoploaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("keymaploaded", e => console.log(e))
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterDotDesktop )
|
||||
51
data/filters/estxt.js
Normal file
51
data/filters/estxt.js
Normal file
@@ -0,0 +1,51 @@
|
||||
function filterTextModifications( contentFilename ){
|
||||
|
||||
let idFromFilename = contentFilename.replaceAll('.','') // has to remove from proper CSS ID
|
||||
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentFilename.endsWith(".estxt")) {
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
console.warn( 'single line only for now')
|
||||
|
||||
let lines = txt.split('\n').filter( l => !l.startsWith('#') )
|
||||
let content = lines.filter( l => !l.startsWith('{') && l.length>0 )
|
||||
let data = lines.filter( l => l.startsWith('{') ).map( l => JSON.parse(l) )
|
||||
let mappedSections = content.map( (l,i) => { return {text:l, properties:data[i]} } )
|
||||
let el = document.createElement('a-entity')
|
||||
|
||||
// console.log (openingOptions.maximumlength)
|
||||
// if (openingOptions.maximumlength) txt = txt.substr(0,openingOptions.maximumlength)
|
||||
mappedSections.map( (s,i) => {
|
||||
let section = addNewNote( s.text )
|
||||
section.sectionNumber = i // can be used for addressing
|
||||
// should apply s.properties to section
|
||||
if ( s.properties.position ) section.setAttribute('position', s.properties.position )
|
||||
if ( s.properties.scale ) section.setAttribute('scale', s.properties.scale )
|
||||
if ( s.properties.rotation ) section.setAttribute('rotation', s.properties.rotation )
|
||||
// should generalize for all properties, safer for now this way though
|
||||
if ( s.properties.knowledge ) {
|
||||
if (s.properties.knowledge.name) section.id = s.properties.knowledge.name
|
||||
if (s.properties.knowledge.reference) {
|
||||
let color = 'black'
|
||||
if (s.properties.knowledge.reference_type && s.properties.knowledge.reference_type == "supporting") { color = 'darkgreen' }
|
||||
AFRAME.scenes[0].setAttribute( ('live-selector-line__estxt'+Math.random()).replaceAll('.',''), {start: '#'+section.id, end: '#'+s.properties.knowledge.reference, color:color} )
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
el.id = idFromFilename
|
||||
AFRAME.scenes[0].emit('extended_spatialtext_loaded', el)
|
||||
// should split per section delimited by {} object
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterTextModifications )
|
||||
81
data/filters/gpx.js
Normal file
81
data/filters/gpx.js
Normal file
@@ -0,0 +1,81 @@
|
||||
function filterTemplateExample( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentFilename.endsWith(".gpx") ) {
|
||||
console.log('it is a GPX unpacked file', contentFilename)
|
||||
|
||||
/*
|
||||
// example of zip support
|
||||
fetch( contentFilename ).then( r => r.blob(r) ).then( file => zip.loadAsync(file) ).then( f => {
|
||||
console.log(f.files)
|
||||
let filenameFromZip = Object.entries( f.files ).filter( i => i[0].includes("partialfilename.ext") ).map( i => i[0] )[0]
|
||||
f.files[filenameFromZip].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
})
|
||||
})
|
||||
*/
|
||||
|
||||
fetch( contentFilename )
|
||||
.then(response => response.text())
|
||||
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
|
||||
.then(data => {
|
||||
// console.log(data)
|
||||
window.gpx = data
|
||||
|
||||
let trail = Array.from( gpx.querySelectorAll("trkpt") ).map( p => {
|
||||
return {ele: Number(p.querySelector("ele").innerHTML), lat: Number(p.getAttribute("lat")), lon: Number(p.getAttribute("lon")) }
|
||||
} )
|
||||
|
||||
let max = {ele:0,lat:0,lon:0}
|
||||
let min = {ele:10000,lat:1000,lon:1000}
|
||||
trail.map( p => {
|
||||
if ( p.ele > max.ele) max.ele = p.ele
|
||||
if ( p.lat > max.lat) max.lat = p.lat
|
||||
if ( p.lon > max.lon) max.lon = p.lon
|
||||
|
||||
if ( p.ele < min.ele) min.ele = p.ele
|
||||
if ( p.lat < min.lat) min.lat = p.lat
|
||||
if ( p.lon < min.lon) min.lon = p.lon
|
||||
} )
|
||||
|
||||
const scales = {ele:1/100, lat:500, lon:500}
|
||||
const offset = {ele:0, lat:-4, lon:-18}
|
||||
// could also manually offset...
|
||||
|
||||
let rescaled = trail.map( p => { return { ele: (p.ele-min.ele) * scales.ele, lat: (p.lat-min.lat) * scales.lat, lon: (p.lon-min.lon) * scales.lon, } })
|
||||
|
||||
rescaled.map( p => {
|
||||
//rescaled.slice(0,1000).map( p => { // to test on just part of the trail
|
||||
|
||||
let sphereEl = document.createElement("a-sphere")
|
||||
sphereEl.setAttribute("radius", ".02")
|
||||
sphereEl.setAttribute("wireframe", "true")
|
||||
sphereEl.setAttribute("segments-height", 8)
|
||||
sphereEl.setAttribute("segments-width", 8)
|
||||
sphereEl.setAttribute("position", (p.lat+offset.lat) + " " + (p.ele+offset.ele) + " " + (p.lon+offset.lon) )
|
||||
AFRAME.scenes[0].appendChild( sphereEl )
|
||||
|
||||
})
|
||||
|
||||
AFRAME.scenes[0].emit('tinkerboxxmlloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("visualmetajsonloaded", e => console.log(e))
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterTemplateExample )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
79
data/filters/ifixitguidesapi.js
Normal file
79
data/filters/ifixitguidesapi.js
Normal file
@@ -0,0 +1,79 @@
|
||||
function GuidesiFixit( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
//if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentFilename.includes("ifixit.com/api/2.0/guides/") ) { // iFixit Guides API
|
||||
// could verify instead via header i.e x-powered-by: PeerTube
|
||||
console.log('it is a iFixit Guides API call', contentFilename)
|
||||
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
const rootEl = document.createElement("a-entity")
|
||||
rootEl.jsonfromapi = json // rarely so big that it makes any difference to have it twice, on here and on individual items
|
||||
// having a root element to attach on makes manipulation later on easier and safer, bringing a context for later modifications
|
||||
file.filteredEl = rootEl
|
||||
rootEl.test = _ => console.log( 'test' )
|
||||
// function that can then be called on the created element later on
|
||||
// e.g. filesWithMetadata["https://companion.benetou.fr/saved/pdfxml/3209542.3209570.xml"].filteredEl.nextPage('ok')
|
||||
rootEl.jsonfromapi = json
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
|
||||
const imageCacheQuality = 'medium'
|
||||
const z = -.5
|
||||
|
||||
let id = contentFilename.replace('https://www.ifixit.com/api/2.0/guides/','')
|
||||
// should not get new images if caches is available
|
||||
// could test by getting status 2XX on `/cached/ifixit_images/${id}/images/medium/${id}_imagesmedium.jpg`
|
||||
fetch(`/cached/ifixit_images/${id}/images/medium/${id}_imagesmedium.jpg`).then( cachedres => {
|
||||
if (cachedres.status == 200)
|
||||
addImagesForSteps(json.steps)
|
||||
else
|
||||
fetch('/cachers/ifixit_images/'+id).then( res => res.text() ).then( imagesReady => { addImagesForSteps(json.steps) })
|
||||
})
|
||||
|
||||
addImagesForSteps = function(steps){
|
||||
steps.map( (s,n) => {
|
||||
let el = addNewNote(s.title, "0 "+(1.5-n/10)+" "+z);
|
||||
el.classList.add( 'instruction_ifixit_guides' )
|
||||
el.classList.add( 'elements_ifixit_guides' )
|
||||
el.provenance = contentFilename
|
||||
s.lines.map( (l,m) => addNewNote(l.text_raw, ".5 "+(1.5-n/10 - m/20)+" "+z) )
|
||||
if (s.media && s.media.type == "image") {
|
||||
const imageHash = s.media.data[0].medium.replace(/.*\//,'')
|
||||
const imageURL = `/cached/ifixit_images/${id}/images/medium/${imageHash}.jpg`
|
||||
// cached images to avoid CORS errors
|
||||
let elImg = document.createElement("a-image")
|
||||
elImg.setAttribute("height", .1 )
|
||||
elImg.setAttribute("width", .2 )
|
||||
elImg.setAttribute("src", imageURL)
|
||||
elImg.setAttribute("position", "-.3 "+(1.5-n/10)+" "+z)
|
||||
elImg.setAttribute("target", "")
|
||||
rootEl.appendChild(elImg)
|
||||
//AFRAME.scenes[0].appendChild(elImg)
|
||||
elImg.classList.add( 'image_ifixit_guides' )
|
||||
elImg.classList.add( 'elements_ifixit_guides' )
|
||||
elImg.provenance = contentFilename
|
||||
//elImg.id = "image_"+d.name
|
||||
}
|
||||
})
|
||||
AFRAME.scenes[0].emit('ifxitguidesapi_loaded', contentFilename)
|
||||
}
|
||||
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("videoapipeertube_loaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( GuidesiFixit )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
45
data/filters/image_and_glb_gltf.js
Normal file
45
data/filters/image_and_glb_gltf.js
Normal file
@@ -0,0 +1,45 @@
|
||||
// inspired by http://expressjs.com/en/guide/using-middleware.html
|
||||
|
||||
function filterImage( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("image") ) {
|
||||
console.log('normal image', contentFilename)
|
||||
let fullPath = contentFilename
|
||||
let el = document.createElement("a-image")
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
el.setAttribute("position", "0 "+(Math.random()+1)+" -1")
|
||||
el.setAttribute("src", fullPath)
|
||||
el.setAttribute("target", "")
|
||||
el.id = fullPath.replaceAll('.','') // prevent multiple instances
|
||||
// should probably be el.id = file.idFromFilename
|
||||
// but not modifying for now, might be breaking
|
||||
el.filename = fullPath
|
||||
AFRAME.scenes[0].emit('image_loaded', el)
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterImage )
|
||||
|
||||
function filterGlbOrGltf( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("model/gl") && (contentFilename.endsWith('gltf') || contentFilename.endsWith('glb') ) ) {
|
||||
let el = document.createElement("a-gltf-model")
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
el.setAttribute("src", contentFilename)
|
||||
el.setAttribute("target", "")
|
||||
el.id = file.idFromFilename
|
||||
AFRAME.scenes[0].emit('gltf_loaded', el)
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterGlbOrGltf )
|
||||
102
data/filters/json_ref_manual.js
Normal file
102
data/filters/json_ref_manual.js
Normal file
@@ -0,0 +1,102 @@
|
||||
function filterJSONRef( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("json") && contentFilename.startsWith("references_manual_") && contentFilename.endsWith(".json")) {
|
||||
console.log('it is a manual reference JSON file', contentFilename)
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
let ref = json["data-objects"]
|
||||
ref.map( (r, i) => {
|
||||
let el = addNewNote( r["bibtex-data"].title, "0 "+(1+i/20)+" -.5" )
|
||||
// should be able to specify a parent
|
||||
el.id = r["object-id"]
|
||||
el.classList.add("reference-entry")
|
||||
el.data = r
|
||||
// could add some new interaction onreleased/onpicked
|
||||
el.setAttribute("onpicked", "console.log( selectedElements.at(-1).element.id )")
|
||||
// el.setAttribute("onreleased", "console.log( selectedElements.at(-1).element.id )")
|
||||
// could also toggle show/hide onreleased in a target area or close enough to something else
|
||||
// show what though? all? "quick" layout engine?
|
||||
let fullEl = addNewNote( Object.entries( r["bibtex-data"] )
|
||||
.filter( e => e[1] )
|
||||
.map( e => e.join(": "))
|
||||
.join("\n") , "-.1 "+(1+i/20)+" -.5" )
|
||||
fullEl.setAttribute("color", "black")
|
||||
fullEl.setAttribute("outline-width", "0")
|
||||
// filtering out empty values
|
||||
fullEl.setAttribute("rotation", "45 0 0")
|
||||
fullEl.setAttribute("scale", ".01 .01 .01")
|
||||
fullEl.classList.add("reference-entry-card")
|
||||
fullEl.data = r
|
||||
let backgroundEl = document.createElement("a-box")
|
||||
backgroundEl.setAttribute("scale", "10 5 .1")
|
||||
backgroundEl.setAttribute("position", "4.5 0 -.1")
|
||||
fullEl.appendChild( backgroundEl )
|
||||
if (r["annote"]) {
|
||||
let annoteEl = addNewNoteAsPostItNote( r["annote"], "-.3 "+(1+i/20)+" -.5", ".02 .02 .02" )
|
||||
annoteEl.classList.add("reference-entry-annotate")
|
||||
}
|
||||
if (r["note"]) {
|
||||
let annoteEl = addNewNoteAsPostItNote( r["note"], "-.2 "+(1+i/20)+" -.5", ".02 .02 .02" )
|
||||
annoteEl.classList.add("reference-entry-note")
|
||||
}
|
||||
// if ACM and OA might be available via https://dl.acm.org/doi/pdf/DOI
|
||||
// could then try to pass as PDF reader argument
|
||||
// cf pageAsTextViaXML() and related in index.html
|
||||
// note that it'd still need to fetch then upload via WebDAV
|
||||
let pdf = r["bibtex-data"]["source-pdf"]
|
||||
let acmoa = r["bibtex-data"]["free-acm-access"] // warning, this is a string, not a boolean
|
||||
// fallback due to file structure change between v4 and v11
|
||||
if (!pdf) pdf = r["source-pdf"]
|
||||
if (!acmoa) acmoa = r["free-acm-access"] // warning, this is a string, not a boolean
|
||||
|
||||
if (pdf && acmoa == "true" && pdf.startsWith("https://dl.acm.org")) {
|
||||
|
||||
// could then try to fetch content then upload via WebDAV
|
||||
// should skip if already available
|
||||
let pdfEl = document.createElement("a-box")
|
||||
//pdfEl.setAttribute("scale", ".1 .1 .1")
|
||||
pdfEl.setAttribute("position", "-1.2 0 0") // trying to move away in order to be executable
|
||||
fullEl.appendChild( pdfEl )
|
||||
|
||||
let truncated_filename = pdf.replace(/.*pdf\//,'').replace(/.*\//,'')
|
||||
// here by convention it would be in "/saved/pdfxml/"
|
||||
let url = "/saved/pdfxml/"+truncated_filename+".xml"
|
||||
fetch(url).then( response => {
|
||||
if (response.ok) {
|
||||
pdfEl.setAttribute( "color", "purple" )
|
||||
// could have a showFile() on pinched here
|
||||
let openCommandEl = addNewNote( "jxr showFile('"+url+"')", "-.6 "+(1+i/20)+" -.5", '.05 .05 .05' )
|
||||
openCommandEl.classList.add("reference-entry-showfile")
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
if (pdf.endsWith( truncated_filename )) {
|
||||
pdfEl.setAttribute("color", "green" )
|
||||
pdfEl.setAttribute("color", "purple" )
|
||||
//pdfEl.setAttribute("value", "jxr console.log('"+truncated_filename+"')" )
|
||||
// what should become the target then? the cube?
|
||||
// problematic because it becomes movable
|
||||
//pdfEl.setAttribute("target", "" )
|
||||
|
||||
// then should add JXR open of target PDF
|
||||
|
||||
window.pageastextviaxmlsrc = "https://companion.benetou.fr/saved/pdfxml/"+truncated_filename+".xml"
|
||||
pageAsTextViaXML()
|
||||
highlightcommands.setAttribute("visible", true)
|
||||
roundedpageborders.setAttribute("visible", true)
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
})
|
||||
AFRAME.scenes[0].emit('jsonrefloaded', contentFilename)
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterJSONRef )
|
||||
82
data/filters/json_ref_manual_ht25_allset.js
Normal file
82
data/filters/json_ref_manual_ht25_allset.js
Normal file
@@ -0,0 +1,82 @@
|
||||
function filterJSONRef( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
|
||||
if ( contentType.includes("json") && contentFilename.startsWith("references_HT_") && contentFilename.endsWith(".json")) {
|
||||
console.log('it is a manual reference JSON file', contentFilename)
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
let filtered = json
|
||||
if (openingOptions.ids)
|
||||
filtered = filtered.filter( e => openingOptions.ids.includes(e.id) )
|
||||
if (openingOptions.doiurl)
|
||||
filtered = filtered.filter( e => e.doiurl == openingOptions.doiurl )
|
||||
if (openingOptions.doiurls)
|
||||
filtered = filtered.filter( e => openingOptions.doiurls.includes( e.doiurl ) )
|
||||
if (openingOptions.year)
|
||||
filtered = filtered.filter( e => e.year == openingOptions.year )
|
||||
if (openingOptions.years)
|
||||
filtered = filtered.filter( e => e.year >= openingOptions.years[0] && e.year <= openingOptions.years[1] )
|
||||
if (openingOptions.articletype)
|
||||
filtered = filtered.filter( e => e.articletype == openingOptions.articletype )
|
||||
// letting the user define a filter
|
||||
// ideally should be stackable, i.e. have multiple such filters one after the other
|
||||
if (openingOptions.customFilter){
|
||||
if (openingOptions.operator == "==")
|
||||
filtered = filtered.filter( e => e[openingOptions.field] == openingOptions.value )
|
||||
// untested
|
||||
if (openingOptions.operator == ">=")
|
||||
filtered = filtered.filter( e => e[openingOptions.field] >= openingOptions.value )
|
||||
if (openingOptions.operator == "<=")
|
||||
filtered = filtered.filter( e => e[openingOptions.field] <= openingOptions.value )
|
||||
if (openingOptions.operator == "<")
|
||||
filtered = filtered.filter( e => e[openingOptions.field] < openingOptions.value )
|
||||
if (openingOptions.operator == ">")
|
||||
filtered = filtered.filter( e => e[openingOptions.field] > openingOptions.value )
|
||||
if (openingOptions.operator == "!=")
|
||||
filtered = filtered.filter( e => e[openingOptions.field] != openingOptions.value )
|
||||
if (openingOptions.operator == "includes")
|
||||
filtered = filtered.filter( e => openingOptions.value.includes(e[openingOptions.field]) )
|
||||
}
|
||||
// details https://git.benetou.fr/utopiah/spasca-fot-sloan-q3/issues/1#issuecomment-578
|
||||
console.log( json, openingOptions, filtered )
|
||||
filtered.map( (r, i) => {
|
||||
let el = addNewNote( r.articletitle, "0 "+(1.2+i/20)+" -.5" )
|
||||
// should be able to specify a parent
|
||||
el.id = r.id
|
||||
el.classList.add("reference-entry")
|
||||
el.data = r
|
||||
// could add some new interaction onreleased/onpicked
|
||||
el.setAttribute("onpicked", "console.log( selectedElements.at(-1).element.id )")
|
||||
// el.setAttribute("onreleased", "console.log( selectedElements.at(-1).element.id )")
|
||||
// could also toggle show/hide onreleased in a target area or close enough to something else
|
||||
// show what though? all? "quick" layout engine?
|
||||
// shorten abstract
|
||||
r.abstract = r.abstract.slice(0,300) // not great for data exploration later on though...
|
||||
let fullEl = addNewNote( Object.entries( r )
|
||||
.filter( e => e[1] )
|
||||
.map( e => e.join(": "))
|
||||
.join("\n") , "-.1 "+(1.2+i/20)+" -.5" )
|
||||
fullEl.setAttribute("color", "black")
|
||||
fullEl.setAttribute("outline-width", "0")
|
||||
// filtering out empty values
|
||||
fullEl.setAttribute("rotation", "45 0 0")
|
||||
fullEl.setAttribute("scale", ".01 .01 .01")
|
||||
fullEl.classList.add("reference-entry-card")
|
||||
fullEl.data = r
|
||||
let backgroundEl = document.createElement("a-box")
|
||||
backgroundEl.setAttribute("scale", "10 5 .1")
|
||||
backgroundEl.setAttribute("position", "4.5 0 -.1")
|
||||
fullEl.appendChild( backgroundEl )
|
||||
|
||||
})
|
||||
AFRAME.scenes[0].emit('jsonhtrefloaded', contentFilename)
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterJSONRef )
|
||||
33
data/filters/keymap.js
Normal file
33
data/filters/keymap.js
Normal file
@@ -0,0 +1,33 @@
|
||||
function filterKeymap( contentFilename ){
|
||||
// if (!file) return
|
||||
// special filter, done via URL, no local file (for now at least)
|
||||
|
||||
if ( contentFilename.endsWith(".keymap") ) { // not very reliable
|
||||
console.log('it is a .keymap file', contentFilename)
|
||||
|
||||
fetch( contentFilename )
|
||||
.then( r => r.text() ).then( r => {
|
||||
// console.log('Keymap', r)
|
||||
let parsedMap = r.split("_layer").filter( l => l.includes('-----') ).map( l => l.split('\n').filter( l => (l.startsWith('//') && !l.includes('------'))).map(l => l.replace("// ",'').split('| ') ) )
|
||||
// WARNING : this is NOT a normal keymap, rather this is about the comments (!) with a visual representation of a keymap
|
||||
// see for example https://github.com/Utopiah/zmk-config-zen-2/blob/main/config/corneish_zen.keymap
|
||||
|
||||
r.split("_layer").filter( l => l.includes('-----') ).map( l => l.split('\n').filter( l => (l.startsWith('//') && !l.includes('------'))).map(l => l.replace("// ",'') ) ).map( (layer, l) => {
|
||||
let el = addNewNote( layer.join('\n') )
|
||||
el.id = 'keymap_layer'+l
|
||||
el.classList.add( 'keymap_layer' )
|
||||
el.data = layer
|
||||
el.highlightLetter = ( letter ) => { keymap_layer0.setAttribute("value", keymap_layer0.getAttribute("value").replace(' '+letter+' ','_'+letter+'_') ) }
|
||||
el.unhighlightLetter = ( letter ) => { keymap_layer0.setAttribute("value", keymap_layer0.getAttribute("value").replace('_'+letter+'_',' '+letter+' ') ) }
|
||||
// then available e.g. keymap_layer0.unhighlightLetter("J")
|
||||
})
|
||||
|
||||
AFRAME.scenes[0].emit('keymaploaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("keymaploaded", e => console.log(e))
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterKeymap )
|
||||
36
data/filters/layout.json.js
Normal file
36
data/filters/layout.json.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// see e.g. https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/fot-sloan-companion/public/index.html#L806
|
||||
// overall newContent() from that branch of Q3/Q4 2024
|
||||
function filterLayoutJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("json") && contentFilename.endsWith(".layout.json") ) {
|
||||
console.warn('not fully implemented yet, only display file name, not their content with the right pose')
|
||||
console.log('it is a JSON layout file', contentFilename)
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
console.log( json )
|
||||
// could here rely on showFile for each element but maybe some are NOT files
|
||||
// different format than previous save
|
||||
// must insure that moved also to the right position/rotation after loading
|
||||
json.map( i => {
|
||||
showFile( i.filename )
|
||||
// AFRAME.scenes[0].emit('layoutjsonloaded', contentFilename)
|
||||
// would have to wait for any file to be loaded...
|
||||
// el.setAttribute("position", AFRAME.utils.coordinates.stringify( i.position ) )
|
||||
// el.setAttribute("rotation", AFRAME.utils.coordinates.stringify( i.rotation ) )
|
||||
// el.id = i.id
|
||||
|
||||
})
|
||||
|
||||
AFRAME.scenes[0].emit('layoutjsonloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("layoutjsonloaded", e => console.log(e))
|
||||
})
|
||||
}
|
||||
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterLayoutJSON )
|
||||
43
data/filters/libraryvisualmeta.json.zip.js
Normal file
43
data/filters/libraryvisualmeta.json.zip.js
Normal file
@@ -0,0 +1,43 @@
|
||||
function filterPackedLibraryVisualMetaJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
|
||||
// could overwrite via URL
|
||||
const scale = 1/1000
|
||||
const xOffset = 0
|
||||
const yOffset = 1
|
||||
|
||||
const idprefix = 'visualmetaexport_'
|
||||
|
||||
if ( contentType.includes("zip") && contentFilename.includes("readinglistvisualmetaexport") ) {
|
||||
// naming issue due to WordPress
|
||||
console.log('it is a packed library visualmeta export file', contentFilename)
|
||||
fetch( contentFilename )
|
||||
// see for packed filters/docx_packed.xml.js
|
||||
.then( r => r.blob(r) )
|
||||
.then( file => zip.loadAsync(file) )
|
||||
.then( f => {
|
||||
// console.log(f.files)
|
||||
// check for optional export directory
|
||||
let filenameLibrary = Object.entries( f.files ).filter( i => i[0].includes("_visualmetaexport.json") ).map( i => i[0] )[0]
|
||||
f.files[filenameLibrary].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
json.map( (item, n) => {
|
||||
let el = addNewNote( item.title+' ('+item.author+')', `0 ${1.5-n/10} -1`)
|
||||
el.setAttribute("outline-width", 0)
|
||||
})
|
||||
|
||||
AFRAME.scenes[0].emit('libraryvisualmetajsonloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("mapvisualmetajsonloaded", e => console.log(e))
|
||||
} )
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterPackedLibraryVisualMetaJSON )
|
||||
63
data/filters/mapvisualmeta.json.js
Normal file
63
data/filters/mapvisualmeta.json.js
Normal file
@@ -0,0 +1,63 @@
|
||||
function filterMapVisualMetaJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
let sidecarFile = contentFilename.replace("dynamicview", "glossary")
|
||||
const scale = 1/1000
|
||||
const xOffset = 1
|
||||
const yOffset = 1
|
||||
|
||||
const idprefix = 'visualmetaexport_'
|
||||
|
||||
if ( contentType.includes("json") && contentFilename.endsWith("_dynamicviewvisualmetaexport.json")) {
|
||||
console.log('it is a map visualmeta export file', contentFilename)
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
fetch( sidecarFile ).then( r => r.json() ).then( sidecarjson => {
|
||||
let glossary = Object.entries( sidecarjson.entries ).map( i => i[1].phrase )
|
||||
|
||||
// console.log( json, sidecarjson )
|
||||
|
||||
json.nodes.map( n => {
|
||||
let x = json.layout.nodePositions[ n.identifier ].x * scale + xOffset
|
||||
let y = -json.layout.nodePositions[ n.identifier ].y * scale + yOffset
|
||||
let z = -1/2
|
||||
let el = addNewNote( n.title, "" + x + " " + y + " " + z )
|
||||
el.id = "visualmetaexport_"+n.title.toLowerCase().replaceAll(" ","_").replaceAll(".","_").replaceAll("'","_")
|
||||
el.setAttribute("outline-width", 0)
|
||||
// optional background color "#7c7c7c"
|
||||
// could use onpicked/onreleased to show links from glossary
|
||||
// check if any word from title is in glossary
|
||||
// if so, display line or highlight visually by removing outline
|
||||
// reset onreleased
|
||||
})
|
||||
|
||||
Object.entries( sidecarjson.entries ).map( i => i[1].phrase ).map( n => {
|
||||
Object.entries( sidecarjson.entries )
|
||||
.map( i => { return {phrase:i[1].phrase, entry:i[1].entry} } )
|
||||
.filter( i => i.entry.toLowerCase().includes(n.toLowerCase()) )
|
||||
.map( i => {
|
||||
let el = document.createElement("a-entity")
|
||||
el.setAttribute('live-selector-line',
|
||||
'start: #'+(idprefix+n.toLowerCase().replaceAll(" ","_").replaceAll(".","_").replaceAll("'","_"))
|
||||
+'; end: #'+(idprefix+i.phrase.toLowerCase().replaceAll(" ","_").replaceAll(".","_").replaceAll("'","_"))
|
||||
+';' )
|
||||
el.classList.add('visualmeta_export_link')
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
})
|
||||
|
||||
})
|
||||
Array.from( document.querySelectorAll("[line]") ).map( el => el.setAttribute("line", "color", "black"))
|
||||
// should filter a bit better otherwise take lines from other components and elements e.g. raycaster
|
||||
|
||||
AFRAME.scenes[0].emit('mapvisualmetajsonloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("mapvisualmetajsonloaded", e => console.log(e))
|
||||
})
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterMapVisualMetaJSON )
|
||||
82
data/filters/mapvisualmeta.jsons.zip.js
Normal file
82
data/filters/mapvisualmeta.jsons.zip.js
Normal file
@@ -0,0 +1,82 @@
|
||||
function filterPackedMapVisualMetaJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
|
||||
// could overwrite via URL
|
||||
const scale = 1/1000
|
||||
const xOffset = 0
|
||||
const yOffset = 1
|
||||
|
||||
const idprefix = 'visualmetaexport_'
|
||||
|
||||
if ( contentType.includes("zip") && contentFilename.includes("dynamicviewvisualmetaexport.jsons") ) {
|
||||
// naming issue due to WordPress
|
||||
console.log('it is a packed map visualmeta export file', contentFilename)
|
||||
fetch( contentFilename )
|
||||
// see for packed filters/docx_packed.xml.js
|
||||
.then( r => r.blob(r) )
|
||||
.then( file => zip.loadAsync(file) )
|
||||
.then( f => {
|
||||
// console.log(f.files)
|
||||
// check for optional export directory
|
||||
let filenameDynamicView = Object.entries( f.files ).filter( i => i[0].includes("_dynamicviewvisualmetaexport.json") ).map( i => i[0] )[0]
|
||||
let filenameGlossary = Object.entries( f.files ).filter( i => i[0].includes("_glossaryvisualmetaexport.json") ).map( i => i[0] )[0]
|
||||
f.files[filenameDynamicView].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
f.files[filenameGlossary].async("string").then( gloss_content => {
|
||||
let sidecarjson = JSON.parse( gloss_content )
|
||||
let glossary = Object.entries( sidecarjson.entries ).map( i => i[1].phrase )
|
||||
|
||||
console.log( json, sidecarjson )
|
||||
//console.log( glossary )
|
||||
|
||||
json.nodes.map( n => {
|
||||
let x = json.layout.nodePositions[ n.identifier ].x * scale + xOffset
|
||||
let y = -json.layout.nodePositions[ n.identifier ].y * scale + yOffset
|
||||
let z = -1/2
|
||||
let el = addNewNote( n.title, "" + x + " " + y + " " + z )
|
||||
el.id = "visualmetaexport_"+n.title.toLowerCase().replaceAll(" ","_").replaceAll(".","_").replaceAll("'","_")
|
||||
el.setAttribute("outline-width", 0)
|
||||
// optional background color "#7c7c7c"
|
||||
// could use onpicked/onreleased to show links from glossary
|
||||
// check if any word from title is in glossary
|
||||
// if so, display line or highlight visually by removing outline
|
||||
// reset onreleased
|
||||
|
||||
let definitionFound = Object.entries( sidecarjson.entries ).filter( i => i[1].phrase == n.title ).map( f => f[1].entry )
|
||||
if (openingOptions.showDefinitions && definitionFound ){ el.setAttribute("annotation", "content", definitionFound[0] ) }
|
||||
})
|
||||
|
||||
Object.entries( sidecarjson.entries ).map( i => i[1].phrase ).map( n => {
|
||||
Object.entries( sidecarjson.entries )
|
||||
.map( i => { return {phrase:i[1].phrase, entry:i[1].entry} } )
|
||||
.filter( i => i.entry.toLowerCase().includes(n.toLowerCase()) )
|
||||
.map( i => {
|
||||
let el = document.createElement("a-entity")
|
||||
el.setAttribute('live-selector-line',
|
||||
'start: #'+(idprefix+n.toLowerCase().replaceAll(' ','_').replaceAll(".","_").replaceAll("'","_"))
|
||||
+'; end: #'+(idprefix+i.phrase.toLowerCase().replaceAll(' ','_').replaceAll(".","_").replaceAll("'","_"))
|
||||
+';' )
|
||||
el.classList.add('visualmeta_export_link')
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
})
|
||||
|
||||
})
|
||||
Array.from( document.querySelectorAll("[line]") ).map( el => el.setAttribute("line", "color", "black"))
|
||||
// should filter a bit better otherwise take lines from other components and elements e.g. raycaster
|
||||
|
||||
AFRAME.scenes[0].emit('mapvisualmetajsonloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("mapvisualmetajsonloaded", e => console.log(e))
|
||||
})
|
||||
} )
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterPackedMapVisualMetaJSON )
|
||||
42
data/filters/markdown.js
Normal file
42
data/filters/markdown.js
Normal file
@@ -0,0 +1,42 @@
|
||||
function filterMarkdown( contentFilename ){
|
||||
// if (!file) return
|
||||
// special filter, done via URL, no local file (for now at least)
|
||||
|
||||
if ( contentFilename.endsWith(".md") ) {
|
||||
console.log('it is a markdown file', contentFilename)
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
fetch( contentFilename )
|
||||
.then( r => r.text() ).then( r => {
|
||||
console.log('markdown', r)
|
||||
|
||||
console.log( "mereology", openingOptions.mereology )
|
||||
switch( openingOptions.mereology ) {
|
||||
case "whole":
|
||||
addNewNote(r, "0 1.4 -.8")
|
||||
break;
|
||||
case "section":
|
||||
r.split(/! /).map( (c,i) => addNewNote(c, "0 "+(1+i/10)+" -.8") ) // untested
|
||||
break;
|
||||
case "line":
|
||||
r.split('\n').reverse().map( (c,i) => addNewNote(c, "0 "+(1+i/10)+" -.8") )
|
||||
break;
|
||||
case "listonly":
|
||||
r.replaceAll('* ','').split('\n').map( (c,i) => addNewNote(c, "0 "+(1+i/10)+" -.8") )
|
||||
// based on pmwiki, should also work with + or -
|
||||
default:
|
||||
r.split('\n').reverse().map( (c,i) => addNewNote(c, "0 "+(1+i/10)+" -.8") )
|
||||
}
|
||||
|
||||
AFRAME.scenes[0].emit('markdownloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("markdownloaded", e => console.log(e))
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterMarkdown )
|
||||
18
data/filters/modifications_via_url.js
Normal file
18
data/filters/modifications_via_url.js
Normal file
@@ -0,0 +1,18 @@
|
||||
function filterTextModifications( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("text") && contentFilename.endsWith("_modifications.txt")) {
|
||||
console.log('it is an modification scheme', contentFilename)
|
||||
console.log('try to pass it to parametersViaURL(data)')
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
const data = new URLSearchParams(txt)
|
||||
parametersViaURL(data)
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterTextModifications )
|
||||
84
data/filters/odt_unpacked.xml.js
Normal file
84
data/filters/odt_unpacked.xml.js
Normal file
@@ -0,0 +1,84 @@
|
||||
function filterOdtJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("xml") && contentFilename.includes("_content.odt/") && contentFilename.endsWith(".xml")) {
|
||||
console.log('it is a visualmeta export file', contentFilename)
|
||||
fetch( contentFilename )
|
||||
.then(response => response.text())
|
||||
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
|
||||
el = addNewNote( data.childNodes[0].textContent )
|
||||
});
|
||||
/*
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
// not JSON!
|
||||
console.log( json )
|
||||
let thumbnailPath = json.thumbnail.replace("file:/","/tapestry/")
|
||||
let el = document.createElement("a-image")
|
||||
el.setAttribute("position", "0 1.5 0.7")
|
||||
el.setAttribute("rotation", "0 180 0")
|
||||
el.setAttribute("src", thumbnailPath)
|
||||
el.setAttribute("width", json.startView.size.width/10000)
|
||||
el.setAttribute("height", json.startView.size.height/10000)
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
|
||||
let positioned = {}
|
||||
json.items.map( i => {
|
||||
let x = 1-i.position.x/1000
|
||||
let y = 2-i.position.y/1000
|
||||
|
||||
let el = null
|
||||
if (i.type == "text") {
|
||||
el = addNewNoteAsPostItNote( i.text, x + " " + y + " 1", ".1 .1 .1", "tapestry_"+i.id, "tapestry_text", true, "0 180 0")
|
||||
// addNewNoteAsPostItNote( text, position=`-0.2 1.1 -0.1`, scale= "0.1 0.1 0.1", id=null, classes="notes", visible="true", rotation="0 0 0" ){
|
||||
}
|
||||
|
||||
if (i.thumbnail) {
|
||||
let thumbnailPath = i.thumbnail.source.replace("file:/","/tapestry/")
|
||||
el = document.createElement("a-image")
|
||||
el.setAttribute("position", x + " " + y + " 1")
|
||||
el.setAttribute("rotation", "0 180 0")
|
||||
el.setAttribute("src", thumbnailPath)
|
||||
el.setAttribute("width", i.size.width/1000)
|
||||
el.setAttribute("height", i.size.height/1000)
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
}
|
||||
positioned[i.id] = el
|
||||
if ( el ) el.setAttribute("target", "")
|
||||
})
|
||||
|
||||
setTimeout( _ => {
|
||||
// must be done after the items are positioned
|
||||
json.rels.map( i => {
|
||||
let el = document.createElement("a-tube")
|
||||
console.log( i.from.itemId, i.to.itemId )
|
||||
let start = positioned[i.from.itemId].getAttribute("position")
|
||||
let end = positioned[i.to.itemId].getAttribute("position")
|
||||
let mid = new THREE.Vector3()
|
||||
mid.copy ( start )
|
||||
mid.add ( end )
|
||||
mid.divideScalar(2)
|
||||
mid.z += 0.3
|
||||
let path = [start, mid, end].map( p => AFRAME.utils.coordinates.stringify( p ) ).join(", ")
|
||||
|
||||
el.setAttribute("radius", 0.01)
|
||||
el.setAttribute("path", path)
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
})
|
||||
}, 1000 )
|
||||
|
||||
AFRAME.scenes[0].emit('visualmetajsonloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("visualmetajsonloaded", e => console.log(e))
|
||||
})
|
||||
*/
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterOdtJSON )
|
||||
146
data/filters/pdf_unpacked.xml.js
Normal file
146
data/filters/pdf_unpacked.xml.js
Normal file
@@ -0,0 +1,146 @@
|
||||
function filterPDFUnpackedXml( contentFilename ){
|
||||
const path = "/saved/pdfxml/"
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
// might have to hijack again
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("xml") && contentFilename.includes("pdfxml/") ) {
|
||||
console.log('it is a pdf unpacked file', contentFilename)
|
||||
pageAsTextViaXML(contentFilename, page=0)
|
||||
}
|
||||
|
||||
applyNextFilter( contentFilename )
|
||||
|
||||
function pageAsTextViaXML(src, page=0){
|
||||
const scalingFactor = 1/1000 // used for position of text and images
|
||||
// could also use x/y/z offsets
|
||||
// probably easier to append to an entity, either empty or used as (white) background
|
||||
const xOffset = 0.1 // changed by rootEl position
|
||||
const yOffset = -1.0
|
||||
const zPos = 0.01
|
||||
let disabledHighlight = true // for testing manipulation
|
||||
disabledHighlight=false
|
||||
// highlight ball still hidden due to thickness
|
||||
|
||||
fetch( src ).then( r => r.text() ).then( txt => {
|
||||
const rootEl = document.createElement("a-box")
|
||||
file.filteredEl = rootEl
|
||||
|
||||
// consider show/hide instead, much faster
|
||||
// could filter on tktxt.getAttribute("originalpage")
|
||||
rootEl.nextPage = (el) => {
|
||||
// if (page == 0) return // what is the maximum page number?
|
||||
page++
|
||||
// not tested in depth
|
||||
// TODO missing images and breaks highlights
|
||||
Array.from( rootEl.querySelectorAll(".highlightabletext") ).map( el => el.remove() )
|
||||
Array.from( doc.children[0].children[page].querySelectorAll("text") ).map( (l,n) => {
|
||||
let tktxt = addLineToPage(l, rootEl)
|
||||
})
|
||||
Array.from( rootEl.querySelectorAll(".highlightimagefromxmlitem") ).map( el => el.remove() )
|
||||
Array.from( doc.children[0].children[page].querySelectorAll("image") ).map( (l,n) => {
|
||||
let el = addImageToPage(l, n, rootEl)
|
||||
})
|
||||
|
||||
rootEl.emit('pagechanged', page)
|
||||
}
|
||||
rootEl.previousPage = (el) => {
|
||||
if (page == 0) return
|
||||
page--
|
||||
// not tested in depth
|
||||
Array.from( rootEl.querySelectorAll(".highlightabletext") ).map( el => el.remove() )
|
||||
Array.from( doc.children[0].children[page].querySelectorAll("text") ).map( (l,n) => {
|
||||
let tktxt = addLineToPage(l, rootEl)
|
||||
})
|
||||
Array.from( rootEl.querySelectorAll(".highlightimagefromxmlitem") ).map( el => el.remove() )
|
||||
Array.from( doc.children[0].children[page].querySelectorAll("image") ).map( (l,n) => {
|
||||
let el = addImageToPage(l, n, rootEl)
|
||||
})
|
||||
rootEl.emit('pagechanged', page)
|
||||
}
|
||||
|
||||
const sheetEl = document.createElement("a-box")
|
||||
sheetEl.setAttribute("width", "1")
|
||||
sheetEl.setAttribute("height", "1.2")
|
||||
sheetEl.setAttribute("depth", ".01")
|
||||
sheetEl.setAttribute("position", "0.5 -.6 0")
|
||||
rootEl.appendChild(sheetEl)
|
||||
rootEl.setAttribute("width", ".01")
|
||||
rootEl.setAttribute("height", ".01")
|
||||
rootEl.setAttribute("depth", ".01")
|
||||
rootEl.setAttribute("color", "brown")
|
||||
|
||||
rootEl.setAttribute("target", "") // "hidden" by the highlightable texts as targets
|
||||
// can temporarily remove target from .highlightabletext elements
|
||||
// alternatively could have a handle, a la lens demo
|
||||
rootEl.setAttribute("position", "-0.5 1.7 -.6")
|
||||
rootEl.id = "page_from_"+src.replaceAll("https://","").replaceAll("/","_")
|
||||
rootEl.classList.add ( "page_from_pdf" )
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
|
||||
const parser = new DOMParser();
|
||||
let doc = parser.parseFromString(txt, "application/xml")
|
||||
|
||||
Array.from( doc.children[0].children[page].querySelectorAll("text") ).map( (l,n) => {
|
||||
let tktxt = addLineToPage(l, rootEl)
|
||||
})
|
||||
|
||||
Array.from( doc.children[0].children[page].querySelectorAll("image") ).map( (l,n) => {
|
||||
let img = addImageToPage(l, n, rootEl)
|
||||
})
|
||||
|
||||
AFRAME.scenes[0].emit('pdfxmlloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("visualmetajsonloaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
|
||||
function addImageToPage(l, n, rootEl){
|
||||
let el = document.createElement("a-box")
|
||||
// is position via center of element so should offset it
|
||||
el.setAttribute("src", path+l.attributes.src.value); // somehow set to #transparent...
|
||||
el.setAttribute("width", l.attributes.width.value*scalingFactor);
|
||||
el.setAttribute("height", l.attributes.height.value*scalingFactor);
|
||||
el.setAttribute("depth", .01);
|
||||
el.setAttribute("target", "")
|
||||
el.id = "highlightimagefromxml_"+n
|
||||
el.classList.add("highlightimagefromxmlitem")
|
||||
//el.classList.add("highlightabletext")
|
||||
let w = l.attributes.width.value*scalingFactor
|
||||
let h = l.attributes.height.value*scalingFactor
|
||||
el.setAttribute("position", ""+(w/2+l.attributes.left.value*scalingFactor+xOffset)+" "+ (-h/2+1-l.attributes.top.value*scalingFactor+yOffset)+ " "+zPos)
|
||||
el.initialPosition = ""+(w/2+l.attributes.left.value*scalingFactor+xOffset)+" "+ (-h/2+1-l.attributes.top.value*scalingFactor+yOffset)+ " "+zPos
|
||||
rootEl.appendChild(el)
|
||||
return el
|
||||
}
|
||||
|
||||
function addLineToPage(l, rootEl){
|
||||
let tktxt = document.createElement("a-troika-text")
|
||||
let pos = ""+(l.attributes.left.value*scalingFactor+xOffset) + " " + (1-l.attributes.top.value*scalingFactor+yOffset) + " "+zPos
|
||||
let scale = "0.045 0.045 0.045"
|
||||
tktxt.setAttribute("position", pos)
|
||||
tktxt.setAttribute("originalposition", pos)
|
||||
tktxt.setAttribute("originalpage", page)
|
||||
tktxt.setAttribute("font-size", "0.009")
|
||||
tktxt.setAttribute("color", "black")
|
||||
tktxt.setAttribute("value", l.textContent)
|
||||
tktxt.setAttribute("anchor", "left")
|
||||
tktxt.classList.add("highlightabletext")
|
||||
if (!disabledHighlight) tktxt.setAttribute("target", "")
|
||||
//tktxt.setAttribute("onpicked", "console.log(selectedElements.at(-1).element.getAttribute('value'))")
|
||||
tktxt.setAttribute("onpicked", "let original = selectedElements.at(-1).element; let el = original.cloneNode(true); original.parentElement.appendChild(el); setTimeout( _ => { el.setAttribute( 'position', original.getAttribute('originalposition') ) ; el.setAttribute('color','grey'); } );")
|
||||
// could try highlighting with color again in here
|
||||
// maybe parenting issue...
|
||||
// element seems to be somewhere, in the right position, yet not visible
|
||||
// should test if problematic while changing page, probably so
|
||||
tktxt.setAttribute("onreleased", "let el = selectedElements.at(-1).element; el.setAttribute('color', highlightColor); el.setAttribute('rotation', ''); el.setAttribute('position', el.getAttribute('originalposition') )")
|
||||
rootEl.appendChild(tktxt)
|
||||
return tktxt
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterPDFUnpackedXml )
|
||||
51
data/filters/peertubeapi.js
Normal file
51
data/filters/peertubeapi.js
Normal file
@@ -0,0 +1,51 @@
|
||||
function videoAPIPeerTube( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
//if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentFilename.includes("/api/v1/search/videos") ) { // peertube API, not specific enough
|
||||
// could verify instead via header i.e x-powered-by: PeerTube
|
||||
console.log('it is a PeerTube API call', contentFilename)
|
||||
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
const rootEl = document.createElement("a-entity")
|
||||
rootEl.jsonfromapi = json // rarely so big that it makes any difference to have it twice, on here and on individual items
|
||||
// having a root element to attach on makes manipulation later on easier and safer, bringing a context for later modifications
|
||||
file.filteredEl = rootEl
|
||||
rootEl.test = _ => console.log( 'test' )
|
||||
// function that can then be called on the created element later on
|
||||
// e.g. filesWithMetadata["https://companion.benetou.fr/saved/pdfxml/3209542.3209570.xml"].filteredEl.nextPage('ok')
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
json.data.map( (d,i) => {
|
||||
let el = document.createElement("a-image")
|
||||
rootEl.appendChild(el)
|
||||
el.setAttribute("position", ""+(-1+Math.random())+" "+(Math.random()+1)+" -0.5" )
|
||||
el.setAttribute("scale", ".2 .1 .1")
|
||||
el.setAttribute("src", contentFilename.replace(/\/api.*/,'') + d.thumbnailPath)
|
||||
el.setAttribute("target", "")
|
||||
el.jsonfromapi = d
|
||||
el.classList.add( 'videoapipeertube' )
|
||||
el.provenance = contentFilename
|
||||
el.id = "video_"+d.name
|
||||
})
|
||||
|
||||
|
||||
AFRAME.scenes[0].emit('videoapipeertube_loaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("videoapipeertube_loaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( videoAPIPeerTube )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
35
data/filters/pkpass.js
Normal file
35
data/filters/pkpass.js
Normal file
@@ -0,0 +1,35 @@
|
||||
function filterPkpass( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentType.includes("pkpass") && contentFilename.includes(".pkpass") ) {
|
||||
console.log('it is a PKPass packed file', contentFilename)
|
||||
|
||||
const rootEl = document.createElement("a-entity")
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
fetch( contentFilename ).then( r => r.blob(r) ).then( file => zip.loadAsync(file) ).then( f => {
|
||||
// console.log(f.files)
|
||||
let filenameFromZip = Object.entries( f.files ).filter( i => i[0].includes("pass.json") ).map( i => i[0] )[0]
|
||||
f.files[filenameFromZip].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
let el = addNewNote( json.boardingPass.primaryFields.map( f => f.label ).join(" - ") )
|
||||
el.dataSource = json
|
||||
AFRAME.scenes[0].emit('pkpassloaded', contentFilename)
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterPkpass )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
50
data/filters/pmwiki.js
Normal file
50
data/filters/pmwiki.js
Normal file
@@ -0,0 +1,50 @@
|
||||
function filterPmWiki( contentFilename ){
|
||||
// if (!file) return
|
||||
// special filter, done via URL, no local file (for now at least)
|
||||
|
||||
if ( contentFilename.endsWith("?action=source") ) { // not very reliable
|
||||
console.log('it is a pmwiki file', contentFilename)
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
fetch( contentFilename )
|
||||
.then( r => r.text() ).then( r => {
|
||||
// console.log('pmwiki', r)
|
||||
// TODO
|
||||
// diff support to replay over time, e.g. https://fabien.benetou.fr/PIMVRdata/ItemsStates?action=diff
|
||||
// index as a special case https://fabien.benetou.fr/Site/AllRecentChanges?action=source
|
||||
// rendered previews e.g https://vatelier.benetou.fr/MyDemo/newtooling/textures/fabien.benetou.fr_PIMVRdata_ItemsStates.png
|
||||
// server side graph generation e.g. https://vatelier.benetou.fr/MyDemo/newtooling/wiki_graph.json
|
||||
// very specific
|
||||
|
||||
let elements = []
|
||||
console.log( "mereology", openingOptions.mereology )
|
||||
switch( openingOptions.mereology ) {
|
||||
case "whole":
|
||||
elements.push( addNewNote(r, "0 1.4 -.8") )
|
||||
break;
|
||||
case "section":
|
||||
r.split(/! /).map( (c,i) => elements.push( addNewNote(c, "0 "+(1+i/10)+" -.8") ) ) // untested
|
||||
break;
|
||||
case "line":
|
||||
r.split('\n').map( (c,i) => elements.push( addNewNote(c, "0 "+(1+i/10)+" -.8") ) )
|
||||
break;
|
||||
case "listonly":
|
||||
default:
|
||||
r.replaceAll('* ','').split('\n').map( (c,i) => elements.push( addNewNote(c, "0 "+(1+i/10)+" -.8") ) )
|
||||
// this is specific to https://fabien.benetou.fr/PersonalInformationStream/WithoutNotesMay2025 and similar
|
||||
}
|
||||
elements.map( el => { el.classList.add('pmwikifilter'); el.classList.add('filterimport') } )
|
||||
// for something more generic see https://www.pmwiki.org/wiki/PmWiki/PageFileFormat
|
||||
|
||||
AFRAME.scenes[0].emit('pmwikiloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("pmwikiloaded", e => console.log(e))
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterPmWiki )
|
||||
40
data/filters/q2layout.json.js
Normal file
40
data/filters/q2layout.json.js
Normal file
@@ -0,0 +1,40 @@
|
||||
function filterQ2LayoutJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentType.includes("json") && contentFilename.endsWith("_q2layout.json") ) {
|
||||
console.log('it is a Q2 Layout JSON file', contentFilename)
|
||||
|
||||
fetch( contentFilename ).then( r => r.json() ).then( savedDataFromPreviousSession => {
|
||||
// console.log( savedDataFromPreviousSession )
|
||||
savedDataFromPreviousSession.map( savedData =>
|
||||
Array.from( document.querySelectorAll('.'+classNameItemsToSave) )
|
||||
.filter( noteEl => noteEl.getAttribute("value") == savedData.value )
|
||||
// search by value as in theory those are constant (but not necessarily unique, even though usually are)
|
||||
.map( foundNoteEl => {
|
||||
foundNoteEl.setAttribute("position", AFRAME.utils.coordinates.stringify(savedData.position) )
|
||||
foundNoteEl.setAttribute("rotation", AFRAME.utils.coordinates.stringify(savedData.rotation) )
|
||||
} )
|
||||
// should also debug the unfound ones
|
||||
)
|
||||
|
||||
AFRAME.scenes[0].emit('q2layoutjsonloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("templateexampleloaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterQ2LayoutJSON )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
112
data/filters/rete.bitbybit.json.js
Normal file
112
data/filters/rete.bitbybit.json.js
Normal file
@@ -0,0 +1,112 @@
|
||||
function filterReteBiByBit( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentType.includes("") && (contentFilename.endsWith("-rete.bitbybit") || contentFilename.endsWith("rete-runner.bitbybit") )) {
|
||||
console.log('it is a Rete BitByBit file', contentFilename)
|
||||
// assuming non minified code... but maybe works the same way
|
||||
// TODO try with minified code, would be preferred in order to do execution after
|
||||
|
||||
const filenameIdPrefix = "retebitbybit_id_"
|
||||
if (contentFilename.endsWith("rete-runner.bitbybit") ) {
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
executeBitbybit(txt)
|
||||
// can keep track of generate meshes via
|
||||
// AFRAME.scenes[0].object3D.children.filter( o => o.name.includes("brepMesh") )
|
||||
// filtering with before the call and after (even though async)
|
||||
})
|
||||
} else {
|
||||
fetch( contentFilename ).then( r => r.json() ).then( txt => {
|
||||
let nodes = Object.entries( JSON.parse(txt.script).nodes )
|
||||
//console.log( nodes )
|
||||
|
||||
const rootEl = document.createElement("a-entity")
|
||||
file.filteredEl = rootEl
|
||||
rootEl.execute = _ => console.warn( 'Not implemented for now, see executeBitbybit()')
|
||||
// TODO see executeBitbybit() , needs runner code too
|
||||
|
||||
// function that can then be called on the created element later on
|
||||
// e.g. filesWithMetadata["https://companion.benetou.fr/saved/pdfxml/3209542.3209570.xml"].filteredEl.nextPage('ok')
|
||||
nodes.map( n => {
|
||||
let el = document.createElement("a-troika-text")
|
||||
let boxEl = document.createElement("a-box")
|
||||
boxEl.setAttribute("wireframe", "true" )
|
||||
boxEl.setAttribute("width", .3 )
|
||||
boxEl.setAttribute("height", .4 )
|
||||
boxEl.setAttribute("depth", .01 )
|
||||
boxEl.setAttribute("position", "0 -.18 0" )
|
||||
el.setAttribute("value", n[1].customName )
|
||||
el.setAttribute("font-size", ".05")
|
||||
el.setAttribute("target", "")
|
||||
let x = 1+n[1].position[0]/1000
|
||||
let y = 2-n[1].position[1]/1000
|
||||
let z = -1
|
||||
el.setAttribute("position", ""+x+" "+y+" "+z)
|
||||
rootEl.appendChild(el)
|
||||
el.appendChild(boxEl)
|
||||
el.id = filenameIdPrefix + n[1].id
|
||||
})
|
||||
nodes.map( p => {
|
||||
let n = p[1]
|
||||
let inputs = Object.entries( n.inputs ).map( o => o[1] )
|
||||
if (inputs.length) {
|
||||
// console.log( n.id, inputs )
|
||||
inputs.map( c => {
|
||||
let el = document.createElement("a-entity")
|
||||
el.setAttribute('live-selector-line',
|
||||
'start: #'+(filenameIdPrefix+n.id)
|
||||
+'; end: #'+(filenameIdPrefix+c.connections[0].node)
|
||||
+';' )
|
||||
el.classList.add('retebitbybit_export_link')
|
||||
rootEl.appendChild(el)
|
||||
})
|
||||
}
|
||||
})
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
|
||||
AFRAME.scenes[0].emit('retebitbybitloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("retebitbybitloaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterReteBiByBit )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
|
||||
async function executeBitbybit(code){
|
||||
window.THREEJS = window.THREE;
|
||||
await import("https://cdn.jsdelivr.net/gh/bitbybit-dev/bitbybit-assets@0.20.4/runner/bitbybit-runner-lite-threejs.js")
|
||||
const aframeScene = document.querySelector('a-scene').object3D;
|
||||
const runnerOptions = {
|
||||
canvasZoneClass: 'myCanvasZone',
|
||||
enableOCCT: true,
|
||||
enableJSCAD: false,
|
||||
enableManifold: false,
|
||||
loadFonts: ['Roboto'],
|
||||
externalThreeJSSettings: {
|
||||
scene: aframeScene,
|
||||
camera: AFRAME.systems.camera,
|
||||
}
|
||||
};
|
||||
|
||||
const runner = window.bitbybitRunner.getRunnerInstance();
|
||||
const { bitbybit, Bit, camera, scene, renderer } = await runner.run( runnerOptions);
|
||||
window.bitbybit = bitbybit;
|
||||
window.Bit = Bit;
|
||||
window.runner = runner
|
||||
|
||||
runner.executeScript(code)
|
||||
}
|
||||
66
data/filters/saved-rss.js
Normal file
66
data/filters/saved-rss.js
Normal file
@@ -0,0 +1,66 @@
|
||||
function filterSavedRSS( contentFilename ){
|
||||
// for example in bounded volume
|
||||
// see how to load an XML document in JS
|
||||
// limit to useful values for our context (e.g. title and date)
|
||||
// cf DOM parser
|
||||
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentType.includes("xml") && contentFilename.includes(".rss") ) {
|
||||
console.log('it is a rss saved file', contentFilename)
|
||||
|
||||
/*
|
||||
// example of zip support
|
||||
fetch( contentFilename ).then( r => r.blob(r) ).then( file => zip.loadAsync(file) ).then( f => {
|
||||
console.log(f.files)
|
||||
let filenameFromZip = Object.entries( f.files ).filter( i => i[0].includes("partialfilename.ext") ).map( i => i[0] )[0]
|
||||
f.files[filenameFromZip].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
})
|
||||
})
|
||||
*/
|
||||
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
const rootEl = document.createElement("a-entity")
|
||||
rootEl.id = filesWithMetadata[contentFilename].idFromFilename
|
||||
rootEl.elements = []
|
||||
|
||||
const parser = new DOMParser()
|
||||
const doc = parser.parseFromString( txt, "application/xml" )
|
||||
const titles = Array.from( doc.querySelectorAll( 'title' )
|
||||
).map( el => el.innerHTML )
|
||||
//).map( el => el.innerText )
|
||||
titles.map( (t,i) => {
|
||||
let el = addNewNote(t, "0 "+(1+i/10)+" -.8" )
|
||||
// should change parent to rootEl
|
||||
// addNewNote shouldn't force parent on scene
|
||||
rootEl.elements.push( el )
|
||||
el.classList.add( "rss-element" )
|
||||
})
|
||||
|
||||
rootEl.test = _ => console.log( 'test' )
|
||||
// function that can then be called on the created element later on
|
||||
// e.g. filesWithMetadata["https://companion.benetou.fr/saved/pdfxml/3209542.3209570.xml"].filteredEl.nextPage('ok')
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
|
||||
AFRAME.scenes[0].emit('savedrssloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("templateexampleloaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterSavedRSS )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
28
data/filters/screenshot_ui.js
Normal file
28
data/filters/screenshot_ui.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// inspired by http://expressjs.com/en/guide/using-middleware.html
|
||||
|
||||
function filterScreenshot( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("image") && contentFilename.startsWith('screenshot_') && contentFilename.endsWith('.jpg') ) {
|
||||
console.log('screenshot image', contentFilename)
|
||||
let fullPath = contentFilename
|
||||
let id = fullPath.replaceAll('.','')
|
||||
// get element generated by the previous filter
|
||||
// probably too fast
|
||||
let elParent = document.getElementById( id )
|
||||
let el = document.createElement("a-entity")
|
||||
elParent.appendChild( el )
|
||||
let elBox = document.createElement("a-box")
|
||||
elBox.setAttribute("scale", ".1 .1 .1")
|
||||
elBox.setAttribute("wireframe", "true")
|
||||
elBox.setAttribute("color", "purple")
|
||||
el.appendChild( elBox )
|
||||
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterScreenshot )
|
||||
61
data/filters/sqlite.js
Normal file
61
data/filters/sqlite.js
Normal file
@@ -0,0 +1,61 @@
|
||||
// https://cdnjs.com/libraries/sql.js
|
||||
// https://github.com/sql-js/sql.js?tab=readme-ov-file#loading-a-database-from-a-server
|
||||
|
||||
function filterTemplateExample( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentType.includes("xml") && contentFilename.includes("pdfxml/") ) {
|
||||
console.log('it is a pdf unpacked file', contentFilename)
|
||||
|
||||
/*
|
||||
// example of zip support
|
||||
fetch( contentFilename ).then( r => r.blob(r) ).then( file => zip.loadAsync(file) ).then( f => {
|
||||
console.log(f.files)
|
||||
let filenameFromZip = Object.entries( f.files ).filter( i => i[0].includes("partialfilename.ext") ).map( i => i[0] )[0]
|
||||
f.files[filenameFromZip].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
})
|
||||
})
|
||||
*/
|
||||
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
|
||||
console.log( "mereology", openingOptions.mereology )
|
||||
switch( openingOptions.mereology ) {
|
||||
case "whole":
|
||||
addNewNote(txt, "0 1.4 -.8")
|
||||
break;
|
||||
case "listonly":
|
||||
default:
|
||||
txt.replaceAll('* ','').split('\n').map( (c,i) => addNewNote(c, "0 "+(1+i/10)+" -.8") )
|
||||
}
|
||||
|
||||
const rootEl = document.createElement("a-entity")
|
||||
// having a root element to attach on makes manipulation later on easier and safer, bringing a context for later modifications
|
||||
file.filteredEl = rootEl
|
||||
rootEl.test = _ => console.log( 'test' )
|
||||
// function that can then be called on the created element later on
|
||||
// e.g. filesWithMetadata["https://companion.benetou.fr/saved/pdfxml/3209542.3209570.xml"].filteredEl.nextPage('ok')
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
|
||||
AFRAME.scenes[0].emit('templateexampleloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("templateexampleloaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterTemplateExample )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
24
data/filters/srt_to_json.js
Normal file
24
data/filters/srt_to_json.js
Normal file
@@ -0,0 +1,24 @@
|
||||
function filterTextModifications( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("subrip") && contentFilename.endsWith(".srt")) {
|
||||
console.log('it is an modification scheme', contentFilename)
|
||||
console.log('try to pass it to parametersViaURL(data)')
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
let jsonFromSRT = txt.split(/$\n/).map(l=>{
|
||||
let subItem = l.split('\n')
|
||||
let timings = subItem[1].split(' --> ')
|
||||
return { id:Number(subItem[0]), timingStart:timings[0], timingEnd:timings[1], text:subItem[2] }
|
||||
} )
|
||||
console.log( jsonFromSRT )
|
||||
addNewNote( jsonFromSRT.map( i => i.text).join('\n') )
|
||||
// could instead delegate that later as event
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterTextModifications )
|
||||
42
data/filters/stxt.js
Normal file
42
data/filters/stxt.js
Normal file
@@ -0,0 +1,42 @@
|
||||
function filterTextModifications( contentFilename ){
|
||||
|
||||
let idFromFilename = contentFilename.replaceAll('.','') // has to remove from proper CSS ID
|
||||
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentFilename.endsWith(".stxt")) {
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
console.warn( 'single line only for now')
|
||||
|
||||
let lines = txt.split('\n')
|
||||
let content = lines.filter( l => !l.startsWith('{') && l.length>0 )
|
||||
let data = lines.filter( l => l.startsWith('{') ).map( l => JSON.parse(l) )
|
||||
let mappedSections = content.map( (l,i) => { return {text:l, properties:data[i]} } )
|
||||
let el = document.createElement('a-entity')
|
||||
|
||||
// console.log (openingOptions.maximumlength)
|
||||
// if (openingOptions.maximumlength) txt = txt.substr(0,openingOptions.maximumlength)
|
||||
mappedSections.map( (s,i) => {
|
||||
let section = addNewNote( s.text )
|
||||
// should apply s.properties to section
|
||||
if ( s.properties.position ) section.setAttribute('position', s.properties.position )
|
||||
if ( s.properties.scale ) section.setAttribute('scale', s.properties.scale )
|
||||
if ( s.properties.rotation ) section.setAttribute('rotation', s.properties.rotation )
|
||||
// should generalize for all properties, safer for now this way though
|
||||
})
|
||||
|
||||
el.id = idFromFilename
|
||||
AFRAME.scenes[0].emit('spatialtext_loaded', el)
|
||||
// should split per section delimited by {} object
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterTextModifications )
|
||||
16
data/filters/svg.js
Normal file
16
data/filters/svg.js
Normal file
@@ -0,0 +1,16 @@
|
||||
function filterSVGImage( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("image") && contentFilename.endsWith(".svg")) {
|
||||
console.log('it is an SVG image', contentFilename)
|
||||
// could also try to parse the SVG itself, for now delegated potentially via event
|
||||
AFRAME.scenes[0].emit('svgloaded', contentFilename)
|
||||
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterSVGImage )
|
||||
94
data/filters/tapestry.json.js
Normal file
94
data/filters/tapestry.json.js
Normal file
@@ -0,0 +1,94 @@
|
||||
function filterTapestryJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// TODO support zipped version directly, cf e.g. mapvisualmeta.jsons.zip.js
|
||||
|
||||
/*
|
||||
// example of zip support
|
||||
fetch( contentFilename ).then( r => r.blob(r) ).then( file => zip.loadAsync(file) ).then( f => {
|
||||
console.log(f.files)
|
||||
let filenameFromZip = Object.entries( f.files ).filter( i => i[0].includes("partialfilename.ext") ).map( i => i[0] )[0]
|
||||
f.files[filenameFromZip].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
})
|
||||
})
|
||||
*/
|
||||
|
||||
if ( contentType.includes("json") && contentFilename.startsWith("tapestry/") && contentFilename.endsWith("root.json")) {
|
||||
console.log('it is a tapestry export file', contentFilename)
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
// console.log( json )
|
||||
let thumbnailPath = json.thumbnail.replace("file:/","/tapestry/")
|
||||
let el = document.createElement("a-image")
|
||||
el.setAttribute("position", "0 1.5 0.7")
|
||||
el.setAttribute("rotation", "0 180 0")
|
||||
el.setAttribute("src", thumbnailPath)
|
||||
el.setAttribute("width", json.startView.size.width/10000)
|
||||
el.setAttribute("height", json.startView.size.height/10000)
|
||||
el.classList.add( "tapestryelement")
|
||||
el.provenance = contentFilename
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
|
||||
let positioned = {}
|
||||
json.items.map( i => {
|
||||
let x = 1-i.position.x/1000
|
||||
let y = 2-i.position.y/1000
|
||||
|
||||
let el = null
|
||||
if (i.type == "text") {
|
||||
el = addNewNoteAsPostItNote( i.text, x + " " + y + " 1", ".1 .1 .1", "tapestry_"+i.id, "tapestry_text", true, "0 180 0")
|
||||
// addNewNoteAsPostItNote( text, position=`-0.2 1.1 -0.1`, scale= "0.1 0.1 0.1", id=null, classes="notes", visible="true", rotation="0 0 0" ){
|
||||
}
|
||||
|
||||
if (i.thumbnail) {
|
||||
let thumbnailPath = i.thumbnail.source.replace("file:/","/tapestry/")
|
||||
el = document.createElement("a-image")
|
||||
el.setAttribute("position", x + " " + y + " 1")
|
||||
el.setAttribute("rotation", "0 180 0")
|
||||
el.setAttribute("src", thumbnailPath)
|
||||
el.setAttribute("width", i.size.width/1000)
|
||||
el.setAttribute("height", i.size.height/1000)
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
}
|
||||
positioned[i.id] = el
|
||||
if ( el ) {
|
||||
el.setAttribute("target", "")
|
||||
el.classList.add( "tapestryelement")
|
||||
el.provenance = contentFilename
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout( _ => {
|
||||
// must be done after the items are positioned
|
||||
json.rels.map( i => {
|
||||
let el = document.createElement("a-tube")
|
||||
console.log( i.from.itemId, i.to.itemId )
|
||||
let start = positioned[i.from.itemId].getAttribute("position")
|
||||
let end = positioned[i.to.itemId].getAttribute("position")
|
||||
let mid = new THREE.Vector3()
|
||||
mid.copy ( start )
|
||||
mid.add ( end )
|
||||
mid.divideScalar(2)
|
||||
mid.z += 0.3
|
||||
let path = [start, mid, end].map( p => AFRAME.utils.coordinates.stringify( p ) ).join(", ")
|
||||
|
||||
el.setAttribute("radius", 0.01)
|
||||
el.setAttribute("path", path)
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
el.classList.add( "tapestryelement")
|
||||
el.provenance = contentFilename
|
||||
})
|
||||
|
||||
AFRAME.scenes[0].emit('tapestryjsonloaded', contentFilename)
|
||||
}, 1000 )
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("visualmetajsonloaded", e => console.log(e))
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterTapestryJSON )
|
||||
61
data/filters/template_example.js
Normal file
61
data/filters/template_example.js
Normal file
@@ -0,0 +1,61 @@
|
||||
function filterTemplateExample( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentType.includes("xml") && contentFilename.includes("pdfxml/") ) {
|
||||
console.log('it is a pdf unpacked file', contentFilename)
|
||||
|
||||
/*
|
||||
// example of zip support
|
||||
fetch( contentFilename ).then( r => r.blob(r) ).then( file => zip.loadAsync(file) ).then( f => {
|
||||
console.log(f.files)
|
||||
let filenameFromZip = Object.entries( f.files ).filter( i => i[0].includes("partialfilename.ext") ).map( i => i[0] )[0]
|
||||
f.files[filenameFromZip].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
})
|
||||
})
|
||||
*/
|
||||
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
|
||||
console.log( "mereology", openingOptions.mereology )
|
||||
switch( openingOptions.mereology ) {
|
||||
case "whole":
|
||||
addNewNote(txt, "0 1.4 -.8")
|
||||
break;
|
||||
case "listonly":
|
||||
default:
|
||||
txt.replaceAll('* ','').split('\n').map( (c,i) => addNewNote(c, "0 "+(1+i/10)+" -.8") )
|
||||
// could had here
|
||||
}
|
||||
|
||||
const rootEl = document.createElement("a-entity")
|
||||
// having a root element to attach on makes manipulation later on easier and safer, bringing a context for later modifications
|
||||
rootEl.fromfile = txt
|
||||
// to make the data usable, better with JSON or per element but still potentially useful by other elements
|
||||
file.filteredEl = rootEl
|
||||
rootEl.test = _ => console.log( 'test' )
|
||||
// function that can then be called on the created element later on
|
||||
// e.g. filesWithMetadata["https://companion.benetou.fr/saved/pdfxml/3209542.3209570.xml"].filteredEl.nextPage('ok')
|
||||
AFRAME.scenes[0].appendChild(rootEl)
|
||||
|
||||
AFRAME.scenes[0].emit('templateexampleloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("templateexampleloaded", e => console.log(e))
|
||||
|
||||
} );
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterTemplateExample )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
64
data/filters/tinderbox.js
Normal file
64
data/filters/tinderbox.js
Normal file
@@ -0,0 +1,64 @@
|
||||
function filterTemplateExample( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
// can be removed for URLs as those are not with metadata
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
// mereology option
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
// can be used via e.g. showFile("https://fabien.benetou.fr/?action=source",{ mereology:"whole"})
|
||||
|
||||
// filtering, only applying what's next to a certain content type and/or with filename filtering with .startsWith() .endsWith() .includes() or regex
|
||||
if ( contentFilename.endsWith(".tbx") ) {
|
||||
console.log('it is a TinderBox unpacked file', contentFilename)
|
||||
|
||||
/*
|
||||
// example of zip support
|
||||
fetch( contentFilename ).then( r => r.blob(r) ).then( file => zip.loadAsync(file) ).then( f => {
|
||||
console.log(f.files)
|
||||
let filenameFromZip = Object.entries( f.files ).filter( i => i[0].includes("partialfilename.ext") ).map( i => i[0] )[0]
|
||||
f.files[filenameFromZip].async("string").then( dyn_content => {
|
||||
json = JSON.parse( dyn_content )
|
||||
})
|
||||
})
|
||||
*/
|
||||
|
||||
fetch( contentFilename )
|
||||
.then(response => response.text())
|
||||
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
|
||||
.then(data => {
|
||||
// console.log(data)
|
||||
window.tbx = data
|
||||
let example = Array.from( tbx.querySelectorAll("item [Creator='Mark Anderson']") ).slice(0,10)
|
||||
.map( tinderItem => Array.from( tinderItem.children ).filter( e => e.outerHTML.includes("Name") ).map( e => e.innerHTML ) )
|
||||
|
||||
let spatialExample = Array.from( tbx.querySelectorAll("item [Creator='Mark Anderson']") ).slice(0,10).map( tinderItem => {
|
||||
res = {}
|
||||
Array.from( tinderItem.children )
|
||||
.map( e => {
|
||||
if (e.outerHTML.includes("Name")) res.name = e.innerHTML
|
||||
if (e.outerHTML.includes("Xpos")) res.x = Number(e.innerHTML)
|
||||
if (e.outerHTML.includes("Ypos")) res.y = Number(e.innerHTML)
|
||||
})
|
||||
|
||||
return res
|
||||
})
|
||||
console.log( example )
|
||||
|
||||
spatialExample.map( (e,i) =>
|
||||
addNewNote( e.name, (e.x/10) + " " + (1+e.y) + " -0.7" )
|
||||
)
|
||||
AFRAME.scenes[0].emit('tinkerboxxmlloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("visualmetajsonloaded", e => console.log(e))
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
// can stop here or move on to the next filter that might or not be applied
|
||||
}
|
||||
sequentialFilters.push( filterTemplateExample )
|
||||
// adding this to the list of filters to go through, order matters
|
||||
// typically one would be generic filters first then more specific ones after
|
||||
26
data/filters/txt.js
Normal file
26
data/filters/txt.js
Normal file
@@ -0,0 +1,26 @@
|
||||
function filterTextModifications( contentFilename ){
|
||||
|
||||
let idFromFilename = contentFilename.replaceAll('.','') // has to remove from proper CSS ID
|
||||
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let openingOptions = filesWithMetadata[contentFilename].openingOptions
|
||||
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("text") && contentFilename.endsWith(".txt")) {
|
||||
fetch( contentFilename ).then( r => r.text() ).then( txt => {
|
||||
console.log (openingOptions.maximumlength)
|
||||
if (openingOptions.maximumlength)
|
||||
txt = txt.substr(0,openingOptions.maximumlength)
|
||||
let el = addNewNote( txt )
|
||||
el.id = idFromFilename
|
||||
AFRAME.scenes[0].emit('plaintext_loaded', el)
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterTextModifications )
|
||||
48
data/filters/visualmeta.json.js
Normal file
48
data/filters/visualmeta.json.js
Normal file
@@ -0,0 +1,48 @@
|
||||
function filterVisualMetaJSON( contentFilename ){
|
||||
let file = filesWithMetadata[contentFilename]
|
||||
if (!file) return
|
||||
|
||||
let contentType = file.contentType
|
||||
|
||||
if ( contentType.includes("json") && contentFilename.endsWith(".visualmetaexport.json")) {
|
||||
console.log('it is a visualmeta export file', contentFilename)
|
||||
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
||||
//console.log( json )
|
||||
|
||||
let titleEl = addNewNote( json["visual-meta-bibtex-self-citation"].article.title, "0 1.8 -.3" )
|
||||
|
||||
json["visual-meta-full-document-text"].text.split("\n").reverse().map( (e, i) => {
|
||||
let el = addNewNote( e, "0 "+(1+i/40)+" -.5" )
|
||||
if ( e.startsWith("#") ){
|
||||
//el.addEventListener("object3dset", _ => el.setAttribute("font-size", el.getAttribute("font-size")*20 ) )
|
||||
// not yet set, events loaded and object3dset do not help
|
||||
el.setAttribute("font-size", 0.3)
|
||||
el.setAttribute("value", e.replaceAll("#","") )
|
||||
// should be a bit more subtle...
|
||||
}
|
||||
el.provenance = contentFilename
|
||||
el.classList.add('visualmetaelement')
|
||||
})
|
||||
|
||||
Object.values( json["Glossary"].entries ).map( (e, i) => {
|
||||
let el = addNewNote( e.phrase + ' ' + e.entry, "-1.3 "+(1+i/10)+" -.6" )
|
||||
el.provenance = contentFilename
|
||||
el.classList.add('visualmetaelement')
|
||||
})
|
||||
|
||||
Object.values( json["document-headings"] ).reverse().map( (e, i) => {
|
||||
let el = addNewNote( e.name, "-1.1 "+(1+i/10)+" -.6" )
|
||||
el.setAttribute("font-size", Number(e.level.replace("level",""))/10 )
|
||||
el.addEventListener("object3dset", _ => el.object3D.translateX( 1-Number(e.level.replace("level",""))/10 ) )
|
||||
el.provenance = contentFilename
|
||||
el.classList.add('visualmetaelement')
|
||||
})
|
||||
AFRAME.scenes[0].emit('visualmetajsonloaded', contentFilename)
|
||||
// to use the event consider :
|
||||
//AFRAME.scenes[0].addEventListener("visualmetajsonloaded", e => console.log(e))
|
||||
})
|
||||
}
|
||||
applyNextFilter( contentFilename )
|
||||
}
|
||||
|
||||
sequentialFilters.push( filterVisualMetaJSON )
|
||||
337
data/found_set_param.html
Normal file
337
data/found_set_param.html
Normal file
@@ -0,0 +1,337 @@
|
||||
<h1>Documentation of parameters</h1>
|
||||
|
||||
The experience can be configured via its URL. This allow for customization by anyone while also allowing to share the result back with anyone else. There is no code modification needed, no saving needed. The URL itself becomes the modified experience.
|
||||
<br>
|
||||
<br>
|
||||
|
||||
Within that context there are 3 main query parameters to understand, namely <b>username</b>, <b>set</b> and <b>showfile</b>. Specifically :
|
||||
<ul>
|
||||
|
||||
<li><code>username</code> : set a pre-defined experiment with its dedicated interface, data, etc. Note that some do require more parameters. An example could be <a target=_blank href="https://companion.benetou.fr/index.html?username=demoqueueq1">https://companion.benetou.fr/index.html?username=demoqueueq1</a> which allowed for a sequence of experiments. It required no additional parameters. Alternatively <a target=_blank href="https://companion.benetou.fr/index.html?username=q2_step_refcards_filtering&emulatexr=true">https://companion.benetou.fr/index.html?username=q2_step_refcards_filtering&emulatexr=true</a> has both a username (here q2_step_refcards_filtering ) and another parameter (emulatexr with value true). See the <a href="#username">dedicated list</a> below.
|
||||
<li><code>set</code> : modify any element of the page. Typically this is done to visually modify something, showing or hiding elements. An example could be <a target=_blank href="https://companion.benetou.fr/index.html?set_a-sky_color=purple&showfile=Fortress.glb">https://companion.benetou.fr/index.html?set_a-sky_color=purple&showfile=Fortress.glb</a> which set the color of the sky to purple and show a file that is a 3D model of a castle where the user starts their experience. See the <a href="#set">dedicated list</a> below.
|
||||
<li><code>showfile</code> : display the content of a file. This is done thanks to filters (see recorded video) and allows for a relatively wide range of files. The most basic ones, e.g. 3D model, show 3D models in space but some filters allow parsing of specific file formats, e.g. PmWiki lists, docx text content, zipped exports, etc. An example could be <a target=_blank href="https://companion.benetou.fr/index.html?username=q2_visualmetaexport_map_via_wordpress&showfile=https://futuretextlab.info/wp-content/uploads/Frode-dynamicviewvisualmetaexport.jsons_.zip">a remote VisualMeta export</a> hosted on a WordPress instance. The filter unpacks the zip file and display its content while making each item interactable. Note also that some specific formats, e.g. _modifications.txt files, can contain set parameters and thus multiple modifications back. Shown files can also contain layouts of displayed content in order to resume the state of a past session, e.g. <a target=_blank href="https://companion.benetou.fr/index.html?username=q2_annotated_bibliography_week2&showfile=q2_annotated_bibliography_week2_test_q2layout.json">https://companion.benetou.fr/index.html?username=q2_annotated_bibliography_week2&showfile=q2_annotated_bibliography_week2_test_q2layout.json</a>.
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
const baseURL = 'https://companion.benetou.fr/index.html'
|
||||
</script>
|
||||
|
||||
<h2>Note on live documentation of experiments</h2>
|
||||
|
||||
<div>
|
||||
Most links should work, yes surely some will not work or won't make sense outside of XR or need some interactions.
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
A lot of the <code>?set</code> examples (see below) do not show a visual difference as we decided at the end of the 1st quarter to hide a lot of elements to faciliate demonstrations. This unfortunately had the side effect of preventing those examples later on despite them working back then. For example at the end of Q2 <code>?set_IDenvironment_gltf-model=world-bake.glb</code> does not show the 3D model despite the file being present and showfile working because we are not hiding the element with ID environment.
|
||||
From an experimentation perspective it is arguably not useful to "fix" those historical links as doings will most likely prevent newer ones from working and thus rather unpredictively. It is though important to know that they did work.
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
Regardless of those technical limitations please do feel free to report links that seem, according to you, not to work as expected. Plenty do provide :
|
||||
|
||||
<ol>
|
||||
<li>the URL (full including all parameters used),
|
||||
<li>hardware used, browser used (e.g. Vision Pro with OS version 123 and browser version 456),
|
||||
<li>date and hour of test (as things are live, maybe something was edited as you tried)
|
||||
<li>the current behavior (what you expected to see),
|
||||
<li>the expected behavior (what actually happened),
|
||||
<li>any supporting materials you think would be useful, e.g. video recording, screenshots, etc.
|
||||
<ol>
|
||||
|
||||
</div>
|
||||
|
||||
<h2>Parameters</h2>
|
||||
<div id=parameters_to_expand>
|
||||
<ul>
|
||||
<li>allowNtfyFeedbackHUD
|
||||
<li>emulatexr
|
||||
<li>forcecontrollers
|
||||
<li>itemsfile
|
||||
<li>partialfilename
|
||||
<li>query
|
||||
<li>remote_keyboard_group // should be URL encoded, assuming for now alphanum only
|
||||
<li>shareerrors
|
||||
<li>showdebug
|
||||
<li>showdefinitions
|
||||
<li>showdemoexample
|
||||
<li>sourceFromNextDemo
|
||||
<li>speedup_emulatexr_test
|
||||
<li>username
|
||||
</ul>
|
||||
<script>
|
||||
// could make URLs clickable, even though some won't work or show visible changes
|
||||
Array.from( parameters_to_expand.querySelectorAll('li') ).map( p => {
|
||||
return // none of these are useful without the right value
|
||||
let el = document.createElement('a')
|
||||
el.href = baseURL + '?' + p.innerText
|
||||
el.target = '_blank'
|
||||
el.innerText = p.innerText
|
||||
p.innerText = ''
|
||||
p.appendChild( el )
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
|
||||
Note that some parameters (e.g. <code>emulatorxr</code>) are only used in conjonction with other parameters. Here <code>emulatorxr</code> with <code>username</code> itself within only a range of values, see below.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
Some parameters added after the creation of this documenation (early June 2025) are not documented.
|
||||
|
||||
<h3>How to populate that list</h3>
|
||||
Ran server side
|
||||
<pre>grep urlParams.get /transition/webdav/data/fotsave/fot_sloan_companion_public/index.html | sed "s/.*get//" | sort | uniq</pre>
|
||||
|
||||
<a id=username></a>
|
||||
<h2>Username values</h2>
|
||||
for username which is itself a just a parameter
|
||||
|
||||
<div id=usernamevalues_to_expand>
|
||||
<ul>
|
||||
<li>cubetester
|
||||
<li>demoqueueq1
|
||||
<li>icon_tags
|
||||
<li>instructionsonhands
|
||||
<li>jsonrefmanualtester
|
||||
<li>metatester10032025
|
||||
<li>metatester13032025
|
||||
<li>poweruser
|
||||
<li>refoncubetester
|
||||
<li>ring_discovery
|
||||
<li>ring_discovery_with_keyboard
|
||||
<li>ring_highlights
|
||||
<li>skating_rings
|
||||
<li>spreadsheetcolumns
|
||||
<li>tabletest
|
||||
<li>temple_test
|
||||
<li>thicknesstesteruser
|
||||
</ul>
|
||||
|
||||
<h3>Quarter 1</h3>
|
||||
<ul>
|
||||
<li>q1_step_audio
|
||||
<li>q1_step_highlights
|
||||
<li>q1_step_refcards
|
||||
<li>q1_step_screenshot
|
||||
<li>q1_step_showfile
|
||||
<li>q1_step_urlcustom
|
||||
</ul>
|
||||
|
||||
<h3>Quarter 2</h3>
|
||||
<ul>
|
||||
<li>q2_annotated_bibliography
|
||||
<li>q2_annotated_bibliography_week2
|
||||
<li>q2_arcade
|
||||
<li>q2_bbox_per_filter_source
|
||||
<li>q2_drop_for_graph
|
||||
<li>q2_fingersmenu
|
||||
<li>q2_handswap
|
||||
<li>q2_immersive_console
|
||||
<li>q2_json_collaborations
|
||||
<li>q2_keydrumsticks
|
||||
<li>q2_keymap
|
||||
<li>q2_lego_map
|
||||
<li>q2_lense
|
||||
<li>q2_most_recent_file
|
||||
<li>q2_noneuclidian
|
||||
<li>q2_nouploadfile
|
||||
<li>q2_ntfy_keyboard_with_keymap_visual_feedback
|
||||
<li>q2_onrelease_lookat
|
||||
<li>q2_os_keyboard
|
||||
<li>q2_pasting
|
||||
<li>q2_picker
|
||||
<li>q2_remote_ntfy_keyboard
|
||||
<li>q2_ring_keyboard
|
||||
<li>q2_secondarypinch_singlehanded
|
||||
<li>q2_secondarypinch_singlehanded_spatial
|
||||
<li>q2_spatialknowledgeobject
|
||||
<li>q2_step_contextuallayouts
|
||||
<li>q2_step_end
|
||||
<li>q2_step_highlight
|
||||
<li>q2_step_jsonedit
|
||||
<li>q2_step_layout_animationtests
|
||||
<li>q2_step_refcards_filtering
|
||||
<li>q2_step_start
|
||||
<li>q2_step_volumetric_frames
|
||||
<li>q2_visualmetaexport
|
||||
<li>q2_visualmetaexport_map
|
||||
<li>q2_visualmetaexport_map_via_wordpress
|
||||
<li>q2_visualmetaexport_map_via_wordpress_with_keyboard
|
||||
<li>q2_visualmetaexport_map_via_wordpress_with_lookat
|
||||
<li>q2_wrist_rotations
|
||||
<li>q2_yubikeyotp
|
||||
</ul>
|
||||
<script>
|
||||
// make URLs clickable, even though some won't work or show visible changes
|
||||
Array.from( usernamevalues_to_expand.querySelectorAll('li') ).map( p => {
|
||||
let el = document.createElement('a')
|
||||
el.href = baseURL + '?username=' + p.innerText
|
||||
el.target = '_blank'
|
||||
el.innerText = p.innerText
|
||||
p.innerText = ''
|
||||
p.appendChild( el )
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<h3>How to populate that list</h3>
|
||||
Ran server side
|
||||
<pre>grep username /transition/webdav/data/fotsave/fot_sloan_companion_public/index.html | sed "s/.*== //" | sed "s/) {//" | grep -v dictionaryForCompletion | sort | uniq</pre>
|
||||
|
||||
<a id=emulatorxr></a>
|
||||
<h2>emulatexr working with Username values</h2>
|
||||
and for test scenarii only which is with emulatexr parameter
|
||||
<div id=emulaterxrvalues_to_expand>
|
||||
<ul>
|
||||
<li>q2_lense
|
||||
<li>q2_step_layout_animationtests
|
||||
<li>q2_step_refcards_filtering
|
||||
<li>q2_step_volumetric_frames
|
||||
</ul>
|
||||
<script>
|
||||
// make URLs clickable, even though some won't work or show visible changes
|
||||
Array.from( emulaterxrvalues_to_expand.querySelectorAll('li') ).map( p => {
|
||||
let el = document.createElement('a')
|
||||
el.href = baseURL + '?emulatexr=true&username=' + p.innerText
|
||||
el.target = '_blank'
|
||||
el.innerText = p.innerText
|
||||
p.innerText = ''
|
||||
p.appendChild( el )
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<h3>How to populate that list</h3>
|
||||
Ran server side
|
||||
<pre>head -300 /transition/webdav/data/fotsave/fot_sloan_companion_public/index.html | grep username | sed "s/.*== //" | sed "s/) {//" | grep -v dictionaryForCompletion | sort | uniq</pre>
|
||||
|
||||
there are a quite a few more from Q1 via specifically parametersViaURL because that one https://git.benetou.fr/utopiah/spasca-fot-sloan-q1/src/branch/main/data/index.html#L602 can do a lot, letting anybody changing what is shown or not, how, etc
|
||||
|
||||
<a id=set></a>
|
||||
<h2>Set values</h2>
|
||||
|
||||
<h3>Syntax</h3>
|
||||
<ul>
|
||||
<li>selector ID environment (not # as this is not a valid URL query parameter!) or .classname
|
||||
<li>attribute name (e.g. color)
|
||||
<li>value, (e.g. blue)
|
||||
</ul>
|
||||
|
||||
For example <code>?set_.pannel_color=red</code> will set to "red" the attribute named "color" for all elements of class name "pannel".
|
||||
|
||||
<h3>Example of values</h3>
|
||||
<ul>
|
||||
<li><code>color=blue</code> can be a string of HTML colors
|
||||
<li><code>gltf-model=world-bake.glb</code> can be a relative or absolute URL (where CORS is supported)
|
||||
<li><code>visible=false</code> to show or hide an element, a boolean string that can be either true or false (not True or False or TRUE or FALSE!)
|
||||
<li><code>src=https://webdav.benetou.fr/fotsave/fot_sloan_companion_public/world-bake.glb</code> can be a full URL (where CORS is supported)
|
||||
<li><code>src=pano4s.png</code> can also be the relative URL of an image, using it as texture
|
||||
<li><code>scale=1%201%201</code> as a scale for width height and depth, e.g. here a uniform scale of 1 (URI encoded, where %20 becomes an empty space " ")
|
||||
<li><code>position=0%201%200</code> as metric position along X, Y and Z axis, X=-1 is 1 to the left of the starting position, Y=1 is 1m up and Z=-1 is 1m ahead
|
||||
<li><code>rotation=0%20-30%200</code> as angle rotation in degrees along X, Y and Z axis relative to the object center, here 0 deg pitch, -30 yaw and 0 roll (see <a href="https://aframe.io/docs/1.7.0/components/rotation.html">details</a>)
|
||||
</ul>
|
||||
|
||||
Your browser will automatically URI encode your URL, thus one can type <code>position=0 1.4 -1</code> and get <code>position=0%201.4%20-1</code>
|
||||
<br>
|
||||
<br>
|
||||
To get a URL to later on use as a parameter value consider using the upload function of the prototype <a target=_blank href="https://companion.benetou.fr">https://companion.benetou.fr</a> which in turns make the resulting file available at <code>https://companion.benetou.fr/filename</code>
|
||||
|
||||
<h3>Values used</h3>
|
||||
<div id=setvalues_to_expand>
|
||||
<ul>
|
||||
<li>?set_.manuscript_color=blue
|
||||
<li>?set_.notes_visible=false
|
||||
<li>?set_IDenvironment_visible=false&set_.pannel_color=blue&set_a-sky_color=grey&showfile=Fortress.glb
|
||||
<li>?set_IDenvironment_visible=false&set_.pannel_color=blue&set_a-sky_color=grey&showfile=Fortress.glb&showfile=augmented_paper.pdf-0.jpg
|
||||
<li>?set_IDenvironment_visible=false&set_.pannel_color=blue&set_a-sky_color=grey&showfile=Fortress.glb&showfile=augmented_paper.pdf-1.jpg
|
||||
<li>?set_IDenvironment_visible=false&set_.pannel_color=blue&set_a-sky_color=grey&showfile=Fortress.glb&showfile=fabien_modifications_test.txt
|
||||
<li>?set_IDenvironment_visible=false&showfile=Apartment.glb
|
||||
<li>?set_IDmanuscript_color=blue
|
||||
<li>?set_IDmanuscript_color=lightbrown
|
||||
<li>?set_IDmanuscript_color=lightyellow
|
||||
<li>?set_a-sky_src=Solstice-sunrise-cylinder-105-degrees.png
|
||||
<li>?set_a-sky_src=Solstice-sunrise-cylinder-105-degrees.png
|
||||
<li>?set_a-sky_src=Solstice-sunrise-cylinder-105-degrees.png&set_IDgroundfor360_visible=true
|
||||
<li>?set_a-sky_src=Solstice-sunrise-cylinder-105-degrees.png&set_IDgroundfor360_visible=true
|
||||
<li>?set_a-sky_src=faded-ground-keithm.jpg
|
||||
<li>?set_a-sky_src=faded-ground-keithm.jpg&set_IDgroundfor360_visible=true
|
||||
<li>?set_a-sky_src=office%20windows%20closed%20edited.jpg
|
||||
<li>?set_a-sky_src=office%20windows%20closed%20edited.jpg
|
||||
<li>?set_a-sky_src=office-windows-closed-edited25.png
|
||||
<li>?set_a-sky_src=pano3s.png
|
||||
<li>?set_a-sky_src=pano4s.png
|
||||
<li>?set_a-sky_src=spacemed.jpg&set_IDgroundfor360_visible=true
|
||||
<li>?set_a-sky_src=spacemed.jpg&set_IDgroundfor360_visible=true
|
||||
<li>?set_a-sky_src=spacemed.jpg&set_IDgroundfor360_visible=true
|
||||
<li>?set_a-sky_src=spacemed.jpg&set_IDgroundfor360_visible=true&set_IDgroundfor360_scale=2%202%202
|
||||
<li>?set_a-sky_src=spacemed.jpg&set_IDgroundfor360_visible=true&set_IDgroundfor360_scale=20%202%2020
|
||||
<li>?set_environmentsky_color=green
|
||||
<li>?set_environmentsky_color=red
|
||||
</ul>
|
||||
|
||||
Known problematic ones (usually not a bug, just not visible change)
|
||||
<ul>
|
||||
<li>?set_.notes_visible=false&set_IDpanopticonpannels_visible=false
|
||||
<li>?set_IDenvironment_visible=false&set_.pannels_color=blue
|
||||
<li>?set_IDenvironment_visible=false&set_IDpanopticonpannels_visible=false
|
||||
<li>?set_IDenvironment_src=https://webdav.benetou.fr/fotsave/fot_sloan_companion_public/world-bake.glb
|
||||
<li>?set_IDenvironment_visible=false&set_.pannel_color=blue
|
||||
<li>?set_IDenvironment_visible=false&set_.pannel_color=blue&set_a-sky_color=grey
|
||||
<li>?set_IDenvironment_gltf-model=world-bake.glb
|
||||
<li>?set_IDenvironment_gltf-model=world-bake.glb&set_IDenvironment_scale=1%201%201
|
||||
<li>?set_IDenvironment_gltf-model=world-bake.glb&set_IDenvironment_scale=1%201%201&set_IDenvironment_position=0%200%200
|
||||
<li>?set_IDenvironment_gltf-model=world-bake.glb&set_IDenvironment_scale=1%201%201&set_IDenvironment_position=0%201%200&set_IDenvironment_rotation=0%20-30%200
|
||||
<li>?set_IDenvironment_gltf-model=world-bake.glb&set_IDenvironment_scale=1%201%201&set_IDenvironment_position=0%201%200&set_IDenvironment_rotation=0%200%200
|
||||
<li>?set_IDenvironment_gltf-model=world-bake.glb&set_IDenvironment_scale=1%201%201&set_IDenvironment_position=0%201%200&set_IDenvironment_rotation=0%2030%200
|
||||
<li>?set_IDenvironment_gltf-model=world-bake.glb&set_IDenvironment_scale=1%201%201&set_IDenvironment_position=0%202%20-7&set_IDenvironment_rotation=0%20-30%200
|
||||
<li>?set_IDenvironment_gltf-model=world-bake.glb&set_IDenvironment_scale=1%201%201&set_IDenvironment_position=0%203%200&set_IDenvironment_rotation=0%20-30%200
|
||||
<li>?set_.pannel_color=blue
|
||||
<li>?set_.pannel_color=red
|
||||
<li>?set_.environment_visible=false&set_.panopticonpannels_visible=false
|
||||
<li>?set_IDpanopticonpannels_position=0%200%200&set_IDpanopticonpannels_rotation=0%2045%200
|
||||
<li>?set_IDpanopticonpannels_position=0%200%200&set_IDpanopticonpannels_rotation=0%2090%200
|
||||
<li>?set_IDpanopticonpannels_position=0%200.5%200
|
||||
<li>?set_IDpanopticonpannels_position=0%200.5%200&set_IDpanopticonpannels_rotation=0%2045%200
|
||||
<li>?set_IDpanopticonpannels_position=0%202%200
|
||||
<li>?set_panopticonpannels_position=0%201%200
|
||||
<li>?set_panopticonpannels_scale=.1%20.1%20.1
|
||||
<li>?set_panopticonpannels_scale=2%202%202
|
||||
<li>?set_IDenvironment_src=url(world-bake.glb)
|
||||
<li>?set_IDenvironment_src=world_bake.glb
|
||||
<li>?set_environment_glb=Fortress.glb
|
||||
<li>?set_environment_glb=url(Fortress.glb)
|
||||
<li>?set_environment_gltf-model=url(Fortress.glb)
|
||||
<li>?set_environment_gltf-model=url(Fortress.glb)&set_environment_position=0%20-1%200
|
||||
<li>?set_environment_gltf-model=url(Fortress.glb)&set_environment_position=0%20-10%200
|
||||
<li>?set_environment_gltf-model=url(Fortress.glb)&set_environment_position=0%200%200
|
||||
<li>?set_environment_visible=false&set_panopticonpannels_visible=false
|
||||
<li>?set_environment_visible=false&set_panopticonpannels_visible=false
|
||||
</ul>
|
||||
<script>
|
||||
// make URLs clickable, even though some won't work or show visible changes
|
||||
Array.from( setvalues_to_expand.querySelectorAll('li') ).map( p => {
|
||||
let el = document.createElement('a')
|
||||
el.href = baseURL + p.innerText
|
||||
el.target = '_blank'
|
||||
el.innerText = p.innerText
|
||||
p.innerText = ''
|
||||
p.appendChild( el )
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<h3>How to populate that list</h3>
|
||||
Ran client side
|
||||
<pre>sqlite3 /home/fabien/Prototypes/places.sqlite "select url from moz_places where url like '%?set_%';" | sort | uniq</pre>
|
||||
|
||||
<hr>
|
||||
<h2>See also</h2>
|
||||
<ul>
|
||||
<li>listing of Q1 demos https://companion.benetou.fr/demos_example.html?filename=demo_q1.json
|
||||
<li>listing of Q2 demos (still to be edited) https://companion.benetou.fr/demos_example.html?filename=demo_q2.json
|
||||
<li>to provide feedback on demo sets https://companion.benetou.fr/demos_feedback_example.html
|
||||
<li>to visually edit a demo set https://companion.benetou.fr/demos_editor_example.html
|
||||
</ul>
|
||||
471
data/gesture-exploration.js
Normal file
471
data/gesture-exploration.js
Normal file
@@ -0,0 +1,471 @@
|
||||
/* potential improvements
|
||||
|
||||
event on state switch, e.g. thumb up to thumb down or whatever to thumb down
|
||||
but NOT thumb down to thumb down
|
||||
sustained state, e.g. thumb down to thumb down for N seconds
|
||||
extend proximityBetweenJointsCheck to any object3D or from 1 object3D to a class of entities (which themselves are object3D)
|
||||
generalize showGestureDebug to any joint, not just thumb-tip of right hand
|
||||
|
||||
*/
|
||||
|
||||
// consider which gestures are more inclusive, more minimalist to be more accessible
|
||||
|
||||
targetGesture = {"microgesture":{"type":"glyph","action":"Extension","context":["Contact","Air"],"parameters":{"pressure":{"start":null,"end":null,"type":"no_end"},"amplitude":{"start":null,"end":null,"type":"no_end"},"time":{"start":null,"end":null,"leftType":"none","rightType":"bigger"}},"actuator":[["thumb"]],"phalanx":[]}}
|
||||
// supports both hands
|
||||
|
||||
otherTargetGesture = {"microgesture":{"type":"seq","quantificators":{"x":[[["thumb"],["index"],["middle"],["ring"],["pinky"]],[["thumb"],["index"],["middle"],["ring"],["pinky"]]],"y":[]},"seq":{"type":"and","operands":[{"type":"glyph","action":"Any","context":["Air","Contact"],"parameters":{"pressure":{"start":null,"end":null,"type":"no_end"},"amplitude":{"start":null,"end":null,"type":"no_end"},"time":{"start":null,"end":null,"leftType":"none","rightType":"bigger"}},"actuator":[["x0"]],"contact":{"type":"contact","action":"Contact","parameters":{"pressure":{"start":null,"end":null,"type":"no_end"},"amplitude":{"start":null,"end":null,"type":"no_end"},"time":{"start":null,"end":null,"leftType":"none","rightType":"bigger"}},"actuator":[["x1"]]},"phalanx":[]},{"type":"glyph","action":"Any","context":["Air","Contact"],"parameters":{"pressure":{"start":null,"end":null,"type":"no_end"},"amplitude":{"start":null,"end":null,"type":"no_end"},"time":{"start":null,"end":null,"leftType":"none","rightType":"bigger"}},"actuator":[["x1"]],"contact":{"type":"contact","action":"Contact","parameters":{"pressure":{"start":null,"end":null,"type":"no_end"},"amplitude":{"start":null,"end":null,"type":"no_end"},"time":{"start":null,"end":null,"leftType":"none","rightType":"bigger"}},"actuator":[["x0"]]},"phalanx":[]}]}}}
|
||||
// name = closed gap touch
|
||||
// text description = Press the specified fingers together.
|
||||
// different from "finger pinch" which is just between thumb and another finger, at specified locations
|
||||
|
||||
// from https://lig-microglyph.imag.fr
|
||||
|
||||
const fingersNames = ["index-finger", "middle-finger", "ring-finger", "pinky-finger","thumb"]
|
||||
const tips = fingersNames.map( f => f+"-tip" )
|
||||
const thumbParts = ["metacarpal", "phalanx-proximal", "phalanx-distal"] // no phalanx-intermediate for thumb
|
||||
const fingerParts = thumbParts.concat(["phalanx-intermediate"])
|
||||
const fingers = tips.concat( thumbParts.map( f => fingersNames.at(-1)+"-"+f ), fingerParts.flatMap( fp => fingersNames.slice(0,4).map( fn => fn+"-"+fp) ) )
|
||||
const allJointsNames = ["wrist"].concat( fingers ) // also has wrist, no fingers
|
||||
// console.log( allJointsNames.sort() )
|
||||
|
||||
function shortVec3(v){ return {x:v.x.toFixed(3), y:v.y.toFixed(3), z:v.z.toFixed(3)} } ;
|
||||
|
||||
// assumes joints, could be generalized to any Object3D
|
||||
function proximityBetweenJointsCheck(joints){
|
||||
const thresholdDistance = .008
|
||||
// contacts even while hands resting
|
||||
// 2cm : 8
|
||||
// 1cm : 4
|
||||
// 9mm : 2
|
||||
// 8mm : 0 ... but also prevents some contacts, e.g. finger tips accross fingers
|
||||
// consequently would have to identify which contacts take place at rest
|
||||
// might be from within same finger and thus potentially to filter out when "next" to each other joint
|
||||
// e.g. finger tip could physiologically touch own metacarpal but no phalanx
|
||||
// BUT it can for the same finger on the other hand
|
||||
|
||||
let contacts = []
|
||||
|
||||
let combinations = joints.flatMap( (v, i) => joints.slice(i+1).map( w => [v, w] ))
|
||||
// from https://stackoverflow.com/a/43241287/1442164
|
||||
|
||||
combinations.map( j => {
|
||||
let rt = j[0].position
|
||||
let lt = j[1].position
|
||||
//console.log( 'checking: ', rt, lt )
|
||||
let dist = rt.distanceTo(lt)
|
||||
if ( dist < thresholdDistance ) {
|
||||
contacts.push( {dist: dist.toFixed(3), a:j[0].name, ah: j[0].parent.parent.el.id, b:j[1].name, bh: j[1].parent.parent.el.id } )
|
||||
// assumes a bone, could check first on type, otherwise can have different behavior
|
||||
// could add the timestamp and position value at that moment
|
||||
}
|
||||
})
|
||||
|
||||
return contacts
|
||||
// getting up to 45 contacts checking 5 finger tips on each hand, which is correct for C10,2
|
||||
}
|
||||
|
||||
// could also attach the value then show next to the joint
|
||||
let debugValue = {}
|
||||
|
||||
function addDebbugGraph(){
|
||||
el = document.createElement("a-box")
|
||||
el.id = "debuggraph"
|
||||
el.setAttribute("scale", "1 .3 .01")
|
||||
el.setAttribute("position", "0 1.4 -1")
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
}
|
||||
|
||||
// used an array of points, e.g. pos.x over time, thus every 50ms xTimeSeries.push(pos.x)
|
||||
function drawPoints(points){
|
||||
if (debugValue.length<10) return
|
||||
let canvas = document.createElement('canvas');
|
||||
canvas.width = 1000;
|
||||
canvas.height = 100 * Object.values( points).length
|
||||
|
||||
const ctx = canvas.getContext("2d")
|
||||
ctx.fillStyle = "white";
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
// might want to append (and thus track status) in in order to show the result live
|
||||
// or "just" take the last 10 elements of array
|
||||
// middle should be 0... as we can go negative on that axis
|
||||
//points.slice(-10).map( (p,n) => {
|
||||
let verticalOffsetSize = 50
|
||||
Object.values( points).map( (v,i) => {
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(0, 0)
|
||||
let values = v
|
||||
if (v.length > 100) values = v.slice(-100)
|
||||
ctx.strokeStyle = "black";
|
||||
values.map( (p,n) => {
|
||||
let value = Math.floor( 100-1+p*100 )
|
||||
ctx.lineTo(n*10, value+i*verticalOffsetSize)
|
||||
ctx.moveTo(n*10, value+i*verticalOffsetSize)
|
||||
if (value>100-10 && value<100+10) {
|
||||
console.log('customgesture', value)
|
||||
AFRAME.scenes[0].emit('customgesture')
|
||||
ctx.strokeStyle = "green";
|
||||
}
|
||||
|
||||
})
|
||||
ctx.stroke()
|
||||
})
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(0, 100-10)
|
||||
ctx.lineTo(canvas.width, 100-10)
|
||||
ctx.moveTo(0, 100+10)
|
||||
ctx.lineTo(canvas.width, 100+10)
|
||||
ctx.strokeStyle = "red";
|
||||
ctx.stroke()
|
||||
let el = document.getElementById("debuggraph")
|
||||
el.setAttribute("src", canvas.toDataURL() ) // somehow works on other canvas...
|
||||
// el.object3D.children[0].material.needsUpdate = true
|
||||
//console.log( el.src ) // works but does not update
|
||||
return el
|
||||
}
|
||||
|
||||
// gesture(s) to detect, callback on detection, by default debugging via console or new debuggraph
|
||||
// should also emit event
|
||||
|
||||
// might need some form of hierarchy, so that composable gestures don't overlap or re-use components from other gestures
|
||||
// e.g. if there is a fingertip to metacarpal gesture for the index, don't re-write the same for the little finger
|
||||
// same for other hand, i.e. left vs right
|
||||
// could be computationally interesting too, e.g. stop checking for a gesture if part of it failed already, e.g. stop checking for a gesture if part of it failed already
|
||||
|
||||
|
||||
AFRAME.registerComponent('cube-pull', {
|
||||
init: function () {
|
||||
this.tick = AFRAME.utils.throttleTick(this.tick, 50, this);
|
||||
},
|
||||
tick: function (t, dt) {
|
||||
const myScene = AFRAME.scenes[0].object3D
|
||||
if (!myScene.getObjectByName("l_handMeshNode") ) return
|
||||
const wrist = myScene.getObjectByName("r_handMeshNode").parent.getObjectByName("wrist")
|
||||
let sum = Math.abs(wrist.rotation.y) + Math.abs(wrist.rotation.y) + Math.abs(wrist.rotation.z)
|
||||
console.log( sum )
|
||||
if ( sum < .3 ) cubetest.setAttribute("position", AFRAME.utils.coordinates.stringify( wrist.position ) ) // doesn't look good, cube on wrist is moving quite a bit too
|
||||
// could emit event too
|
||||
// could check if all joints have close to 0 rotation on ...
|
||||
// are roughly on the same y-plane of the wrist (facing up or down)
|
||||
}
|
||||
})
|
||||
|
||||
AFRAME.registerComponent('verticalflatpalmrighthand', {
|
||||
schema: {
|
||||
command: {type: 'string'},
|
||||
},
|
||||
init: function () {
|
||||
this.tick = AFRAME.utils.throttleTick(this.tick, 50, this);
|
||||
window.lastGesture = Date.now() // to initialize
|
||||
},
|
||||
tick: function (t, dt) {
|
||||
const myScene = AFRAME.scenes[0].object3D
|
||||
if (!myScene.getObjectByName("l_handMeshNode") ) return
|
||||
const wrist = myScene.getObjectByName("r_handMeshNode").parent.getObjectByName("wrist")
|
||||
let sum = Math.abs(wrist.rotation.y) + Math.abs(wrist.rotation.y) + Math.abs(wrist.rotation.z)
|
||||
console.log( sum )
|
||||
//document.querySelector('[isoterminal]').emit("send", [sum + (window.lastGesture+1000>now)]) // +"\n"]) // problematic for special commands
|
||||
//document.querySelector('[isoterminal]').emit("send", ["\n"]) // kind of horizontal
|
||||
if ( sum < .3 ) {
|
||||
// spams the terminal
|
||||
// could emit event too
|
||||
let now = Date.now()
|
||||
if ( now - window.lastGesture > 1000 ){
|
||||
document.querySelector('[isoterminal]').emit("send", [this.data.command]) // +"\n"]) // problematic for special commands
|
||||
window.lastGesture = now
|
||||
AFRAME.scenes[0].emit('gesture', {date:now, type:'vertical flat palm', value:sum})
|
||||
}
|
||||
// no event if inhibited due to refractory period
|
||||
}
|
||||
if ( sum > 1 ) {
|
||||
let now = Date.now()
|
||||
if ( now - window.lastGesture > 1000 ){
|
||||
document.querySelector('[isoterminal]').emit("send", ["\n"]) // kind of horizontal
|
||||
window.lastGesture = now
|
||||
AFRAME.scenes[0].emit('gesture', {date:now, type:'horizontal flat palm', value:sum})
|
||||
}
|
||||
// no event if inhibited due to refractory period
|
||||
}
|
||||
// could check if all joints have close to 0 rotation on ...
|
||||
// are roughly on the same y-plane of the wrist (facing up or down)
|
||||
}
|
||||
})
|
||||
|
||||
AFRAME.registerComponent('gestures', {
|
||||
init: function () {
|
||||
this.tick = AFRAME.utils.throttleTick(this.tick, 50, this);
|
||||
// maybe every 50ms is too often, or not often enough, to check
|
||||
},
|
||||
// consider also tock, cf https://aframe.io/docs/1.7.0/core/component.html#before-after
|
||||
tick: function (t, dt) {
|
||||
// consider here the order or hierarchy
|
||||
// optimisation? reconciliation? cascading?
|
||||
|
||||
// example of context, e.g. using distance of wrist to a target object, or time, or any other condition
|
||||
|
||||
// could be defined else as long as it respect a specific format, like filters/converters/etc
|
||||
// starting with emiting an event, e.g.
|
||||
// AFRAME.scenes[0].emit('gesture', {date:now, type:'horizontal flat palm', value:sum})
|
||||
// or context (unsure if truly has to be separated)
|
||||
// AFRAME.scenes[0].emit('gesturecontext', {date:now, type:'right wrist in volume of target' })
|
||||
|
||||
// detect gesture A
|
||||
// emit event
|
||||
// detect gesture B
|
||||
// emit event
|
||||
// detect gesture C
|
||||
// emit event
|
||||
},
|
||||
})
|
||||
|
||||
AFRAME.registerComponent('gesture-listneres', {
|
||||
events: {
|
||||
gesture : function (event) {
|
||||
console.log( 'gesture captured:', event.detail )
|
||||
},
|
||||
gesturecontext : function (event) {
|
||||
console.log( 'gesture context captured:', event.detail )
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
AFRAME.registerComponent('positional-context', {
|
||||
schema: {
|
||||
target: {type: 'selector'},
|
||||
attribute: {type: 'string'},
|
||||
value: {type: 'string'},
|
||||
threshold: {type: 'float'}
|
||||
},
|
||||
init: function () {
|
||||
this.tick = AFRAME.utils.throttleTick(this.tick, 500, this);
|
||||
},
|
||||
tick: function (t, dt) {
|
||||
const myScene = AFRAME.scenes[0].object3D
|
||||
if (!myScene.getObjectByName("l_handMeshNode") ) return
|
||||
const wrist = myScene.getObjectByName("r_handMeshNode").parent.getObjectByName("wrist").position
|
||||
// console.log ( this.data.target.object3D.position, this.data.threshold, wrist.distanceTo( this.data.target.object3D.position ) < this.data.threshold )
|
||||
if ( wrist.distanceTo( this.data.target.object3D.position ) < this.data.threshold ){
|
||||
// could emit event too
|
||||
AFRAME.scenes[0].setAttribute(this.data.attribute, "command:"+ this.data.value)
|
||||
// wrong... this should still delegate instead to a gesture (or gestures) that would THEN conditionally pass the command
|
||||
AFRAME.scenes[0].emit('gesturecontext', {date:now, type:'right wrist in volume of target' })
|
||||
// could be used to check for enter/leave based on previous state until now
|
||||
} else {
|
||||
AFRAME.scenes[0].removeAttribute(this.data.attribute)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout( _ => {
|
||||
// username based to isolate testing
|
||||
if (username && username == "cubepull") {
|
||||
AFRAME.scenes[0].setAttribute("cube-pull", "")
|
||||
}
|
||||
// multi-users as multi-gestures?
|
||||
|
||||
// cascading gestures
|
||||
|
||||
console.log ( window.location, window.location.search.includes("xrsh") )
|
||||
//if ( window.location.search.includes("xrsh") ) {
|
||||
if ( window.location.host.includes("fabien.benetou.fr") ) {
|
||||
// URL modified by XRSH
|
||||
// if (username && username == "xrsh") {
|
||||
let el = document.createElement("a-sphere")
|
||||
el.id = "contextsphere"
|
||||
el.setAttribute("radius", "0.3") // fails on .3 or 0.3
|
||||
//el.setAttribute("scale", "0.3)
|
||||
el.setAttribute("wireframe", "true")
|
||||
el.setAttribute("position", "0 1.4 -1")
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
|
||||
console.log( 1337 )
|
||||
let cube = document.createElement("a-box")
|
||||
cube.setAttribute("target", "") // no effect, probably over written by XRSH
|
||||
cube.setAttribute("color", "green")
|
||||
cube.id = "cubetest"
|
||||
cube.setAttribute("scale", ".1 .1 .1")
|
||||
cube.setAttribute("position", "0 1.4 -1")
|
||||
AFRAME.scenes[0].appendChild(cube)
|
||||
|
||||
AFRAME.scenes[0].setAttribute("positional-context", "target:#contextsphere; threshold:0.3; attribute:verticalflatpalmrighthand; value: ls -l\\n;")
|
||||
|
||||
AFRAME.scenes[0].setAttribute('gesture-listneres','')
|
||||
// gesture to
|
||||
// go back in history (then down again)
|
||||
// to execute
|
||||
/*
|
||||
// enter
|
||||
document.querySelector('[isoterminal]').emit("send", ["\n"])
|
||||
|
||||
// arrow keyup
|
||||
document.querySelector('[isoterminal]').emit("send", ["\x1b[A"])
|
||||
|
||||
// arrow keydown
|
||||
document.querySelector('[isoterminal]').emit("send", ["\x1b[B"])
|
||||
*/
|
||||
|
||||
}
|
||||
// that can also be visible, e.g. wireframe
|
||||
if (username && username == "cubepullwithincontext") {
|
||||
|
||||
let cube = addCubeWithAnimations()
|
||||
cube.setAttribute("target", "")
|
||||
//cube.setAttribute("visible", "false")
|
||||
|
||||
el = document.createElement("a-sphere")
|
||||
el.id = "contextsphere"
|
||||
el.setAttribute("radius", .3)
|
||||
el.setAttribute("wireframe", "true")
|
||||
el.setAttribute("position", "0 1.4 -1")
|
||||
AFRAME.scenes[0].appendChild(el)
|
||||
|
||||
AFRAME.scenes[0].setAttribute("positional-context", "target:#contextsphere; threshold:0.3; attribute:cube-pull;")
|
||||
}
|
||||
// that can also be visible, e.g. wireframe
|
||||
|
||||
// could do so with example of index finger tip within range of targets, if so make a visual change
|
||||
// on within cube, off if outside of it
|
||||
// could change the cube color to show the difference too
|
||||
|
||||
// try perf on Quest1
|
||||
}, 1000 )
|
||||
|
||||
// should be a component instead...
|
||||
setTimeout( _ => {
|
||||
//const myScene = AFRAME.scenes[0].object3D
|
||||
/*
|
||||
setInterval( i => {
|
||||
if (!myScene.getObjectByName("l_handMeshNode") ) return
|
||||
const wrist = myScene.getObjectByName("r_handMeshNode").parent.getObjectByName("wrist")
|
||||
let sum = Math.abs(wrist.rotation.y) + Math.abs(wrist.rotation.y) + Math.abs(wrist.rotation.z)
|
||||
console.log( sum )
|
||||
if ( sum < .3 ) cubetest.setAttribute("position") = wrist.position // doesn't look good, cube on wrist is moving quite a bit too
|
||||
// could check if all joints have close to 0 rotation on ...
|
||||
// are roughly on the same y-plane of the wrist (facing up or down)
|
||||
}, 500 )
|
||||
*/
|
||||
/*
|
||||
gestureThumbEndingAnyContact = setInterval( i => {
|
||||
if (!myScene.getObjectByName("l_handMeshNode") ) return
|
||||
// potential shortcuts :
|
||||
const leftHandJoints = myScene.getObjectByName("l_handMeshNode").parent.children.filter( e => e.type == "Bone")
|
||||
const rightHandJoints = myScene.getObjectByName("r_handMeshNode").parent.children.filter( e => e.type == "Bone")
|
||||
const allHandsJoints = leftHandJoints.concat( rightHandJoints )
|
||||
|
||||
let posA = myScene.getObjectByName("r_handMeshNode").parent.getObjectByName("thumb-tip").position
|
||||
let contactPointsToThumbA = leftHandJoints
|
||||
.concat( rightHandJoints[0].parent.children.filter( e => e.name != 'thumb-tip' ) ) // right hand except thumb tip
|
||||
.map( e => e.position.distanceTo(posA) ).filter( d => d < .02 ) // threshold of 2cm distance (must be bigger than thumb-tip to previous join position)
|
||||
// relatively compact description and maybe relatively computively cheap
|
||||
let pos = myScene.getObjectByName("l_handMeshNode").parent.getObjectByName("thumb-tip").position
|
||||
let contactPointsToThumb = rightHandJoints
|
||||
.concat( leftHandJoints[0].parent.children.filter( e => e.name != 'thumb-tip' ) ) // right hand except thumb tip
|
||||
.map( e => e.position.distanceTo(pos) ).filter( d => d < .02 ) // threshold of 2cm distance (must be bigger than thumb-tip to previous join position)
|
||||
if (contactPointsToThumb.length+contactPointsToThumbA.length < 1) console.log('no contact'); else console.log('thumb tip in contact with same hand or other hand')
|
||||
// on contact could also return the join number/names
|
||||
}, 500 )
|
||||
*/
|
||||
|
||||
/*
|
||||
testAvegageValue = setInterval( i => {
|
||||
if (!myScene.getObjectByName("r_handMeshNode") ) return
|
||||
let rt = myScene.getObjectByName("r_handMeshNode").parent.getObjectByName("thumb-tip");
|
||||
debugValue.x.push( rt.position.x )
|
||||
let v = debugValue.x
|
||||
const windowSize = 10 // otherwise too long, e.g 100x500ms gives 5s average
|
||||
if (v.length > windowSize) {
|
||||
values = v.slice(-windowSize)
|
||||
let avg = ( values.reduce( (acc,c) => acc+c )/windowSize) .toFixed(3)
|
||||
console.log( avg )
|
||||
}
|
||||
}, 50 )
|
||||
*/
|
||||
|
||||
/*
|
||||
showContactPoints = setInterval( i => {
|
||||
|
||||
if (!myScene.getObjectByName("r_handMeshNode") ) return
|
||||
let targetJoints = []
|
||||
tips.map( t => targetJoints.push( myScene.getObjectByName("r_handMeshNode").parent.getObjectByName(t) ) )
|
||||
tips.map( t => targetJoints.push( myScene.getObjectByName("l_handMeshNode").parent.getObjectByName(t) ) )
|
||||
// tips only
|
||||
let contacts = proximityBetweenJointsCheck(targetJoints)
|
||||
if (contacts.length) {
|
||||
console.log( "contacts:", contacts )
|
||||
// {dist: dist.toFixed(3), a:j[0].name, ah: j[0].parent.parent.el.id, b:j[1].name, bh: j[1].parent.parent.el.id }
|
||||
contacts.map( c => {
|
||||
// show value or even just a temporary object there
|
||||
let a = document.getElementById(c.ah).object3D.getObjectByName(c.a)
|
||||
let b = document.getElementById(c.bh).object3D.getObjectByName(c.b)
|
||||
const geometry = new THREE.BoxGeometry( .01, .01, .01 )
|
||||
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } )
|
||||
const cube = new THREE.Mesh( geometry, material )
|
||||
a.add( cube )
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
*/
|
||||
|
||||
/*
|
||||
showGestureDistanceDebugJoints = setInterval( i => {
|
||||
|
||||
if (!myScene.getObjectByName("r_handMeshNode") ) return
|
||||
let targetJoints = []
|
||||
tips.map( t => targetJoints.push( myScene.getObjectByName("r_handMeshNode").parent.getObjectByName(t) ) )
|
||||
tips.map( t => targetJoints.push( myScene.getObjectByName("l_handMeshNode").parent.getObjectByName(t) ) )
|
||||
// console.log( targetJoints ) looks fine
|
||||
//console.log( "contacts:", proximityBetweenJointsCheck(targetJoints)
|
||||
// tips only
|
||||
let targetJointsFull = []
|
||||
allJointsNames.map( t => targetJointsFull.push( myScene.getObjectByName("r_handMeshNode").parent.getObjectByName(t) ) )
|
||||
allJointsNames.map( t => targetJointsFull.push( myScene.getObjectByName("l_handMeshNode").parent.getObjectByName(t) ) )
|
||||
let contacts = proximityBetweenJointsCheck(targetJointsFull)
|
||||
if (contacts.length) console.log( "contacts:", contacts )
|
||||
})
|
||||
*/
|
||||
|
||||
/*
|
||||
showGestureDistanceDebug = setInterval( i => {
|
||||
if (!myScene.getObjectByName("r_handMeshNode") ) return
|
||||
let rt = myScene.getObjectByName("r_handMeshNode").parent.getObjectByName("thumb-tip").position
|
||||
let lt = myScene.getObjectByName("l_handMeshNode").parent.getObjectByName("thumb-tip").position
|
||||
if ( rt.distanceTo(lt) < .1 )
|
||||
console.log( 'lt close to rt')
|
||||
else
|
||||
console.log( rt.distanceTo(lt) )
|
||||
})
|
||||
*/
|
||||
|
||||
/*
|
||||
showGestureDebug = setInterval( i => {
|
||||
if (!myScene.getObjectByName("r_handMeshNode") ) return
|
||||
let rt = myScene.getObjectByName("r_handMeshNode").parent.getObjectByName("thumb-tip");
|
||||
//console.log( shortVec3( rt.position ), shortVec3( rt.rotation ) )
|
||||
// could do for the 2x25 values... but then becomes unreadible, hence why showing sparklines could help
|
||||
// can be done on HUD
|
||||
|
||||
if (!debugValue.x){
|
||||
debugValue.x = []
|
||||
debugValue.y = []
|
||||
debugValue.z = []
|
||||
|
||||
debugValue.a = []
|
||||
debugValue.b = []
|
||||
debugValue.c = []
|
||||
}
|
||||
|
||||
debugValue.x.push( rt.position.x )
|
||||
debugValue.y.push( rt.position.y )
|
||||
debugValue.z.push( rt.position.z )
|
||||
|
||||
debugValue.a.push( rt.rotation.x )
|
||||
debugValue.b.push( rt.rotation.y )
|
||||
debugValue.c.push( rt.rotation.z )
|
||||
|
||||
let el = document.getElementById("debuggraph")
|
||||
if (!el) addDebbugGraph()
|
||||
drawPoints( debugValue )
|
||||
}, 50 )
|
||||
*/
|
||||
}, 1000)
|
||||
// waiting for the scene to be loaded, could be component proper too...
|
||||
452
data/hands_saved_positions.skeleton.json
Normal file
452
data/hands_saved_positions.skeleton.json
Normal file
@@ -0,0 +1,452 @@
|
||||
[
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "wrist",
|
||||
"pos": {
|
||||
"x": 0.28700000047683716,
|
||||
"y": 1.5313005447387695,
|
||||
"z": -0.31846386194229126
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "index-finger-tip",
|
||||
"pos": {
|
||||
"x": 0.23399999737739563,
|
||||
"y": 1.4166620969772339,
|
||||
"z": -0.4364088177680969
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "middle-finger-tip",
|
||||
"pos": {
|
||||
"x": 0.24400000274181366,
|
||||
"y": 1.3861708641052246,
|
||||
"z": -0.423475056886673
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "ring-finger-tip",
|
||||
"pos": {
|
||||
"x": 0.24300000071525574,
|
||||
"y": 1.3814098834991455,
|
||||
"z": -0.3979734182357788
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "pinky-finger-tip",
|
||||
"pos": {
|
||||
"x": 0.24400000274181366,
|
||||
"y": 1.3847439289093018,
|
||||
"z": -0.3584907352924347
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "thumb-tip",
|
||||
"pos": {
|
||||
"x": 0.21400000154972076,
|
||||
"y": 1.4739584922790527,
|
||||
"z": -0.42194756865501404
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "thumb-metacarpal",
|
||||
"pos": {
|
||||
"x": 0.26499998569488525,
|
||||
"y": 1.5168437957763672,
|
||||
"z": -0.3615916073322296
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "thumb-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": 0.2460000067949295,
|
||||
"y": 1.5055427551269531,
|
||||
"z": -0.3844451904296875
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "thumb-phalanx-distal",
|
||||
"pos": {
|
||||
"x": 0.2290000021457672,
|
||||
"y": 1.486434817314148,
|
||||
"z": -0.4070701003074646
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "index-finger-metacarpal",
|
||||
"pos": {
|
||||
"x": 0.2750000059604645,
|
||||
"y": 1.5119044780731201,
|
||||
"z": -0.3552985191345215
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "middle-finger-metacarpal",
|
||||
"pos": {
|
||||
"x": 0.27799999713897705,
|
||||
"y": 1.5035990476608276,
|
||||
"z": -0.34147751331329346
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "ring-finger-metacarpal",
|
||||
"pos": {
|
||||
"x": 0.2809999883174896,
|
||||
"y": 1.494507074356079,
|
||||
"z": -0.3282739222049713
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "pinky-finger-metacarpal",
|
||||
"pos": {
|
||||
"x": 0.27799999713897705,
|
||||
"y": 1.4903544187545776,
|
||||
"z": -0.3213633894920349
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "index-finger-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": 0.2800000011920929,
|
||||
"y": 1.4699841737747192,
|
||||
"z": -0.395828515291214
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "middle-finger-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": 0.2849999964237213,
|
||||
"y": 1.456400990486145,
|
||||
"z": -0.37852251529693604
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "ring-finger-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": 0.2809999883174896,
|
||||
"y": 1.450176477432251,
|
||||
"z": -0.35925453901290894
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "pinky-finger-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": 0.27300000190734863,
|
||||
"y": 1.4483333826065063,
|
||||
"z": -0.33909013867378235
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "index-finger-phalanx-distal",
|
||||
"pos": {
|
||||
"x": 0.25200000405311584,
|
||||
"y": 1.4281232357025146,
|
||||
"z": -0.42995569109916687
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "middle-finger-phalanx-distal",
|
||||
"pos": {
|
||||
"x": 0.25999999046325684,
|
||||
"y": 1.4023517370224,
|
||||
"z": -0.41331741213798523
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "ring-finger-phalanx-distal",
|
||||
"pos": {
|
||||
"x": 0.2590000033378601,
|
||||
"y": 1.3969733715057373,
|
||||
"z": -0.38702914118766785
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "pinky-finger-phalanx-distal",
|
||||
"pos": {
|
||||
"x": 0.25600001215934753,
|
||||
"y": 1.4019904136657715,
|
||||
"z": -0.3513104021549225
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "index-finger-phalanx-intermediate",
|
||||
"pos": {
|
||||
"x": 0.27000001072883606,
|
||||
"y": 1.4414960145950317,
|
||||
"z": -0.41945958137512207
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "middle-finger-phalanx-intermediate",
|
||||
"pos": {
|
||||
"x": 0.2759999930858612,
|
||||
"y": 1.420892596244812,
|
||||
"z": -0.40130749344825745
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "ring-finger-phalanx-intermediate",
|
||||
"pos": {
|
||||
"x": 0.27300000190734863,
|
||||
"y": 1.416131615638733,
|
||||
"z": -0.3758058547973633
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "r_handMeshNode",
|
||||
"joint": "pinky-finger-phalanx-intermediate",
|
||||
"pos": {
|
||||
"x": 0.26600000262260437,
|
||||
"y": 1.418898582458496,
|
||||
"z": -0.3469381630420685
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "wrist",
|
||||
"pos": {
|
||||
"x": -0.28700000047683716,
|
||||
"y": 1.5313005447387695,
|
||||
"z": -0.31846386194229126
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "index-finger-tip",
|
||||
"pos": {
|
||||
"x": -0.23399999737739563,
|
||||
"y": 1.4166620969772339,
|
||||
"z": -0.4364088177680969
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "middle-finger-tip",
|
||||
"pos": {
|
||||
"x": -0.24400000274181366,
|
||||
"y": 1.3861708641052246,
|
||||
"z": -0.423475056886673
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "ring-finger-tip",
|
||||
"pos": {
|
||||
"x": -0.24300000071525574,
|
||||
"y": 1.3814098834991455,
|
||||
"z": -0.3979734182357788
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "pinky-finger-tip",
|
||||
"pos": {
|
||||
"x": -0.24400000274181366,
|
||||
"y": 1.3847439289093018,
|
||||
"z": -0.3584907352924347
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "thumb-tip",
|
||||
"pos": {
|
||||
"x": -0.21400000154972076,
|
||||
"y": 1.4739584922790527,
|
||||
"z": -0.42194756865501404
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "thumb-metacarpal",
|
||||
"pos": {
|
||||
"x": -0.26499998569488525,
|
||||
"y": 1.5168437957763672,
|
||||
"z": -0.3615916073322296
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "thumb-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": -0.2460000067949295,
|
||||
"y": 1.5055427551269531,
|
||||
"z": -0.3844451904296875
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "thumb-phalanx-distal",
|
||||
"pos": {
|
||||
"x": -0.2290000021457672,
|
||||
"y": 1.486434817314148,
|
||||
"z": -0.4070701003074646
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "index-finger-metacarpal",
|
||||
"pos": {
|
||||
"x": -0.2750000059604645,
|
||||
"y": 1.5119044780731201,
|
||||
"z": -0.3552985191345215
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "middle-finger-metacarpal",
|
||||
"pos": {
|
||||
"x": -0.27799999713897705,
|
||||
"y": 1.5035990476608276,
|
||||
"z": -0.34147751331329346
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "ring-finger-metacarpal",
|
||||
"pos": {
|
||||
"x": -0.2809999883174896,
|
||||
"y": 1.494507074356079,
|
||||
"z": -0.3282739222049713
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "pinky-finger-metacarpal",
|
||||
"pos": {
|
||||
"x": -0.27799999713897705,
|
||||
"y": 1.4903544187545776,
|
||||
"z": -0.3213633894920349
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "index-finger-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": -0.2800000011920929,
|
||||
"y": 1.4699841737747192,
|
||||
"z": -0.395828515291214
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "middle-finger-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": -0.2849999964237213,
|
||||
"y": 1.456400990486145,
|
||||
"z": -0.37852251529693604
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "ring-finger-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": -0.2809999883174896,
|
||||
"y": 1.450176477432251,
|
||||
"z": -0.35925453901290894
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "pinky-finger-phalanx-proximal",
|
||||
"pos": {
|
||||
"x": -0.27300000190734863,
|
||||
"y": 1.4483333826065063,
|
||||
"z": -0.33909013867378235
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "index-finger-phalanx-distal",
|
||||
"pos": {
|
||||
"x": -0.25200000405311584,
|
||||
"y": 1.4281232357025146,
|
||||
"z": -0.42995569109916687
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "middle-finger-phalanx-distal",
|
||||
"pos": {
|
||||
"x": -0.25999999046325684,
|
||||
"y": 1.4023517370224,
|
||||
"z": -0.41331741213798523
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "ring-finger-phalanx-distal",
|
||||
"pos": {
|
||||
"x": -0.2590000033378601,
|
||||
"y": 1.3969733715057373,
|
||||
"z": -0.38702914118766785
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "pinky-finger-phalanx-distal",
|
||||
"pos": {
|
||||
"x": -0.25600001215934753,
|
||||
"y": 1.4019904136657715,
|
||||
"z": -0.3513104021549225
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "index-finger-phalanx-intermediate",
|
||||
"pos": {
|
||||
"x": -0.27000001072883606,
|
||||
"y": 1.4414960145950317,
|
||||
"z": -0.41945958137512207
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "middle-finger-phalanx-intermediate",
|
||||
"pos": {
|
||||
"x": -0.2759999930858612,
|
||||
"y": 1.420892596244812,
|
||||
"z": -0.40130749344825745
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "ring-finger-phalanx-intermediate",
|
||||
"pos": {
|
||||
"x": -0.27300000190734863,
|
||||
"y": 1.416131615638733,
|
||||
"z": -0.3758058547973633
|
||||
}
|
||||
},
|
||||
{
|
||||
"hand": "l_handMeshNode",
|
||||
"joint": "pinky-finger-phalanx-intermediate",
|
||||
"pos": {
|
||||
"x": -0.26600000262260437,
|
||||
"y": 1.418898582458496,
|
||||
"z": -0.3469381630420685
|
||||
}
|
||||
}
|
||||
]
|
||||
195
data/ht25_annotatedbibliography_spatial_json_viewer_example.html
Executable file
195
data/ht25_annotatedbibliography_spatial_json_viewer_example.html
Executable file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="https://fabien.benetou.fr/pub/home/future_of_text_demo/engine/dependencies/webdav.js"></script>
|
||||
<script type="module">
|
||||
import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.180.0/build/three.module.js';
|
||||
window.THREE = THREE
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id=search>
|
||||
Content search : <input onkeyup="search()" id=fulltextsearch></input>
|
||||
<button onclick="fulltextsearch.value=''">clear</button>
|
||||
<br>
|
||||
minimum timestamp : <input onkeyup="searchByDate()" id=timesstampsearch></input>
|
||||
<button onclick="timesstampsearch.value=''">clear</button>
|
||||
<br>
|
||||
<span id=found style=visibility:hidden>(<span id=foundnumber></span> item(s) found)</span>
|
||||
</div>
|
||||
|
||||
<div id=content></div>
|
||||
|
||||
<script>
|
||||
// insert screenshots (could probably do the same way, i.e. filereader then webdav upload
|
||||
const webdavURL = "https://webdav.benetou.fr";
|
||||
const subdirWebDAV = "/fotsave/fot_sloan_companion_public/"
|
||||
var webdavClient = window.WebDAV.createClient(webdavURL)
|
||||
|
||||
// const eventSourceConverted = new EventSource( `https://ntfy.benetou.fr/convertedwebdav/sse` )
|
||||
// to use for live updates
|
||||
|
||||
const prefix = 'q3_demo_ht25_annotatedbibliography_spatial_savingDataDemo_q3_annotatedbibliography_spatial_ht25_'
|
||||
const extension ='.json'
|
||||