fix error in package.json files

pull/134/merge
nightwing 2015-02-08 08:13:07 +04:00
rodzic b0108959bc
commit 3752564d62
43 zmienionych plików z 832 dodań i 15721 usunięć

226
LICENSE
Wyświetl plik

@ -1,239 +1,99 @@
Cloud9 Software Development Kit Non-commercial License Agreement
1. Introduction
1.1 The Cloud9 Software Development Kit (referred to in this License Agreement
as the "SDK" and specifically including the Cloud9 system files, the Cloud9
computer software source code, Cloud9s Ace editor plugin and Cloud9s
terminal plugin) is licensed to you subject to the terms of this Non-commercial
License Agreement.
1.1 The Cloud9 Software Development Kit (referred to in this License Agreement as the "SDK" and specifically including the Cloud9 system files, the Cloud9 computer software source code, Cloud9s Ace editor plugin and Cloud9s terminal plugin) is licensed to you subject to the terms of this Non-commercial License Agreement.
1.2 Any software provided along with the SDK (such as some of the files in the
node_modules directory) that is associated with a separate license agreement is
licensed to you under the terms of that separate license agreement.
1.2 Any software provided along with the SDK (such as some of the files in the node_modules directory) that is associated with a separate license agreement is licensed to you under the terms of that separate license agreement.
This License Agreement forms a legally binding contract between you and Cloud9
in relation to your use of the SDK.
This License Agreement forms a legally binding contract between you and Cloud9 in relation to your use of the SDK.
1.2 “Cloud9” refers to Cloud9 IDE, Inc, registered Delaware corporation with
principal place of business 1663 McAllister Street #B, San Francisco, CA 94115,
United States.
1.2 “Cloud9” refers to Cloud9 IDE, Inc, registered Delaware corporation with principal place of business 1663 McAllister Street #B, San Francisco, CA 94115, United States.
2. Accepting this license agreement
2.1 In order to use the SDK, you must first agree to this License Agreement. You
may not use the SDK if you do not accept this License Agreement.
2.1 In order to use the SDK, you must first agree to this License Agreement. You may not use the SDK if you do not accept this License Agreement.
2.2 You agree to be bound by the terms of this SDK License by installing,
copying, downloading, accessing or otherwise using the SDK.
2.2 You agree to be bound by the terms of this SDK License by installing, copying, downloading, accessing or otherwise using the SDK.
2.3 You may not use the SDK and may not accept the License Agreement if you are
a person barred from receiving the SDK under the laws of the United States or
other countries including the country in which you are resident or from which
you use the SDK.
2.3 You may not use the SDK and may not accept the License Agreement if you are a person barred from receiving the SDK under the laws of the United States or other countries including the country in which you are resident or from which you use the SDK.
2.4 If you are agreeing to be bound by this License Agreement on behalf of your
employer or other entity, you represent and warrant that you have full legal
authority to bind your employer or such entity to this License Agreement. If you
do not have the requisite authority, you may not accept the License Agreement or
use the SDK on behalf of your employer or other entity.
2.4 If you are agreeing to be bound by this License Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to this License Agreement. If you do not have the requisite authority, you may not accept the License Agreement or use the SDK on behalf of your employer or other entity.
3. The Cloud9 SDK
3.1 Cloud9 grants to you a non-exclusive, non-commercial, non-transferable,
personal license to do the following, all subject to the terms of this license:
3.1 Cloud9 grants to you a non-exclusive, non-commercial, non-transferable, personal license to do the following, all subject to the terms of this license:
Copy and modify any SDK source code, and include such copies and modifications
in software that you create (“Derived Software”), and include SDK object
code in Derived Software;
Copy and modify any SDK source code, and include such copies and modifications in software that you create (“Derived Software”), and include SDK object code in Derived Software;
Use SDK source code, SDK object code, and Derived Software for your own
personal, noncommercial use;
Use SDK source code, SDK object code, and Derived Software for your own personal, noncommercial use;
Distribute Derived Software and SDK documentation to others, provided that any
distribution is for noncommercial purposes only, is without charge or fee or
consideration of any kind, and that every recipient of the distribution agree to
and is bound by the terms of this SDK License.
Distribute Derived Software and SDK documentation to others, provided that any distribution is for noncommercial purposes only, is without charge or fee or consideration of any kind, and that every recipient of the distribution agree to and is bound by the terms of this SDK License.
3.2 You agree that Cloud9 or third parties own all legal right, title and
interest in and to the SDK, including any Intellectual Property Rights that
subsist in the SDK. "Intellectual Property Rights" means any and all rights
under patent law, copyright law, trade secret law, trademark law, and any and
all other proprietary rights. Cloud9 reserves all rights not expressly granted
to you.
3.2 You agree that Cloud9 or third parties own all legal right, title and interest in and to the SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law, and any and all other proprietary rights. Cloud9 reserves all rights not expressly granted to you.
3.3 You may not use the SDK for any purpose not expressly permitted by this
License Agreement. You do not have the right to:
3.3 You may not use the SDK for any purpose not expressly permitted by this License Agreement. You do not have the right to:
Reverse engineer or in any other way attempt to reproduce the operation of the
code in the SDK, or defeat or circumvent any security features of any code in
the SDK;
Use anything in the SDK or any Derived Software for any commercial purpose,
including without limitation for provision of programming, hosting, or any other
services for others;
Distribute anything in the SDK or any Derived Software to any other party that
is not bound by the terms of this SDK License;
Make any copies of anything in the SDK without including all copyright, license,
and other legal notices with the copy;
Transfer the SDK, this SDK License, or any part thereof, to any other party. Any
attempt at such a transfer is void.
Reverse engineer or in any other way attempt to reproduce the operation of the code in the SDK, or defeat or circumvent any security features of any code in the SDK;
Use anything in the SDK or any Derived Software for any commercial purpose, including without limitation for provision of programming, hosting, or any other services for others;
Distribute anything in the SDK or any Derived Software to any other party that is not bound by the terms of this SDK License;
Make any copies of anything in the SDK without including all copyright, license, and other legal notices with the copy;
Transfer the SDK, this SDK License, or any part thereof, to any other party. Any attempt at such a transfer is void.
3.4 Use, reproduction and distribution of components of the SDK licensed under a
separate license agreement are governed solely by the terms of that separate
license agreement and not this License Agreement.
3.4 Use, reproduction and distribution of components of the SDK licensed under a separate license agreement are governed solely by the terms of that separate license agreement and not this License Agreement.
3.5 You agree that the form and nature of the SDK that Cloud9 provides may
change without prior notice to you and that future versions of the SDK may be
incompatible with applications developed on previous versions of the SDK. You
agree that Cloud9 may stop (permanently or temporarily) providing the SDK (or
any features within the SDK) to you or to users generally at Cloud9's sole
discretion, without prior notice to you.
3.5 You agree that the form and nature of the SDK that Cloud9 provides may change without prior notice to you and that future versions of the SDK may be incompatible with applications developed on previous versions of the SDK. You agree that Cloud9 may stop (permanently or temporarily) providing the SDK (or any features within the SDK) to you or to users generally at Cloud9's sole discretion, without prior notice to you.
3.6 Nothing in this License Agreement gives you a right to use any of Cloud9's
trade names, trademarks, service marks, logos, domain names, or other
distinctive brand features.
3.6 Nothing in this License Agreement gives you a right to use any of Cloud9's trade names, trademarks, service marks, logos, domain names, or other distinctive brand features.
3.7 You agree that you will not remove, obscure, or alter any proprietary rights
notices (including copyright and trademark notices) that may be affixed to or
contained within the SDK.
3.7 You agree that you will not remove, obscure, or alter any proprietary rights notices (including copyright and trademark notices) that may be affixed to or contained within the SDK.
4. Privacy and Information
4.1 In order to continually innovate and improve the SDK, Cloud9 may collect
certain usage statistics from the software including but not limited to a unique
identifier, associated IP address, version number of the software, and
information on which tools and/or services in the SDK are being used and how
they are being used. Before any of this information is collected, the SDK will
notify you and seek your consent. If you withhold consent, the information will
not be collected.
4.1 In order to continually innovate and improve the SDK, Cloud9 may collect certain usage statistics from the software including but not limited to a unique identifier, associated IP address, version number of the software, and information on which tools and/or services in the SDK are being used and how they are being used. Before any of this information is collected, the SDK will notify you and seek your consent. If you withhold consent, the information will not be collected.
4.2 The data collected is examined in the aggregate to improve the SDK and is
maintained in accordance with Cloud9's Privacy Policy.
4.2 The data collected is examined in the aggregate to improve the SDK and is maintained in accordance with Cloud9's Privacy Policy.
5. Your developer credentials
5.1 You agree that you are responsible for maintaining the confidentiality of
any developer credentials that may be issued to you by Cloud9 or which you may
choose yourself and that you will be solely responsible for all applications
that are developed under your developer credentials.
5.1 You agree that you are responsible for maintaining the confidentiality of any developer credentials that may be issued to you by Cloud9 or which you may choose yourself and that you will be solely responsible for all applications that are developed under your developer credentials.
6. Third party applications
6.1 If you use the SDK to run applications developed by a third party or that
access data, content or resources provided by a third party, you agree that
Cloud9 is not responsible for those applications, data, content, or resources.
You understand that all data, content or resources which you may access through
such third party applications are the sole responsibility of the person from
which they originated and that Cloud9 is not liable for any loss or damage that
you may experience as a result of the use or access of any of those third party
applications, data, content, or resources.
6.1 If you use the SDK to run applications developed by a third party or that access data, content or resources provided by a third party, you agree that Cloud9 is not responsible for those applications, data, content, or resources. You understand that all data, content or resources which you may access through such third party applications are the sole responsibility of the person from which they originated and that Cloud9 is not liable for any loss or damage that you may experience as a result of the use or access of any of those third party applications, data, content, or resources.
6.2 You should be aware the data, content, and resources presented to you
through such a third party application may be protected by intellectual property
rights which are owned by the providers (or by other persons or companies on
their behalf). You may not modify, rent, lease, loan, sell, distribute or create
derivative works based on these data, content, or resources (either in whole or
in part) unless you have been specifically given permission to do so by the
relevant owners.
6.2 You should be aware the data, content, and resources presented to you through such a third party application may be protected by intellectual property rights which are owned by the providers (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on these data, content, or resources (either in whole or in part) unless you have been specifically given permission to do so by the relevant owners.
6.3 You acknowledge that your use of such third party applications, data,
content, or resources may be subject to separate terms between you and the
relevant third party. In that case, this License Agreement does not affect your
legal relationship with these third parties.
6.3 You acknowledge that your use of such third party applications, data, content, or resources may be subject to separate terms between you and the relevant third party. In that case, this License Agreement does not affect your legal relationship with these third parties.
7. Termination of this license agreement
7.1 This License Agreement will continue to apply until terminated by either you
or Cloud9 as set out below.
7.1 This License Agreement will continue to apply until terminated by either you or Cloud9 as set out below.
7.2 If you want to terminate this License Agreement, you may do so by ceasing
your use of the SDK and any relevant developer credentials.
7.2 If you want to terminate this License Agreement, you may do so by ceasing your use of the SDK and any relevant developer credentials.
7.3 Cloud9 may at any time, terminate this License Agreement with you if:
a. you do not abide by the provisions of this License Agreement; or
b. at any time upon 72 hours notice to you; or
c. at any time upon post of a notice of termination to Cloud9s website. In
such event, you must destroy all copies of the SDK and any Derived Software.
Termination of this SDK License shall terminate your rights and all obligations
of Cloud9 under this SDK License, but the remaining provisions shall survive
termination.
c. at any time upon post of a notice of termination to Cloud9s website. In such event, you must destroy all copies of the SDK and any Derived Software. Termination of this SDK License shall terminate your rights and all obligations of Cloud9 under this SDK License, but the remaining provisions shall survive termination.
8. DISCLAIMER OF WARRANTIES
8.1 THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SDK AND ANY DERIVED
SOFTWARE REMAINS WITH YOU, THE USER. CLOUD9 EXPRESSLY DISCLAIMS (I) ANY WARRANTY
FOR THE SDK AND ANY DERIVED SOFTWARE, AND (II) ANY COMMON LAW DUTIES WITH REGARD
TO SDK AND ANY DERIVED SOFTWARE, INCLUDING DUTIES OF LACK OF NEGLIGENCE AND LACK
OF WORKMANLIKE EFFORT.
8.1 THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SDK AND ANY DERIVED SOFTWARE REMAINS WITH YOU, THE USER. CLOUD9 EXPRESSLY DISCLAIMS (I) ANY WARRANTY FOR THE SDK AND ANY DERIVED SOFTWARE, AND (II) ANY COMMON LAW DUTIES WITH REGARD TO SDK AND ANY DERIVED SOFTWARE, INCLUDING DUTIES OF LACK OF NEGLIGENCE AND LACK OF WORKMANLIKE EFFORT.
8.2 THE SDK AND ANY INFORMATION AVAILABLE IN CONNECTION THEREWITH ARE PROVIDED
ON AN "AS IS" AND "AS AVAILABLE" BASIS, "WITH ALL FAULTS" AND WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT.
8.2 THE SDK AND ANY INFORMATION AVAILABLE IN CONNECTION THEREWITH ARE PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS, "WITH ALL FAULTS" AND WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
8.3 ANY WARRANTY AGAINST INFRINGEMENT THAT MAY BE PROVIDED IN SECTION 2-312(3)
OF THE UNIFORM COMMERCIAL CODE AND/OR IN ANY OTHER COMPARABLE STATE STATUTE IS
EXPRESSLY DISCLAIMED. ALSO, THERE IS NO WARRANTY OF TITLE, INTERFERENCE WITH
YOUR ENJOYMENT, OR AUTHORITY IN CONNECTION WITH THE SDK OR ANY DERIVED SOFTWARE
OR INFORMATION AVAILABLE IN CONNECTION THEREWITH. THIS SECTION WILL APPLY TO THE
MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW.
8.3 ANY WARRANTY AGAINST INFRINGEMENT THAT MAY BE PROVIDED IN SECTION 2-312(3) OF THE UNIFORM COMMERCIAL CODE AND/OR IN ANY OTHER COMPARABLE STATE STATUTE IS EXPRESSLY DISCLAIMED. ALSO, THERE IS NO WARRANTY OF TITLE, INTERFERENCE WITH YOUR ENJOYMENT, OR AUTHORITY IN CONNECTION WITH THE SDK OR ANY DERIVED SOFTWARE OR INFORMATION AVAILABLE IN CONNECTION THEREWITH. THIS SECTION WILL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW.
9. LIMITATION OF LIABILITY AND EXCLUSIVE REMEDY
9.1 NEITHER CLOUD9, ITS LICENSORS, NOR THEIR AFFILIATES SHALL BE LIABLE IN ANY
WAY FOR LOSS OR DAMAGE OF ANY KIND RESULTING FROM THE USE OR INABILITY TO USE
THE SDK OR ANY DERIVED SOFTWARE INCLUDING, BUT NOT LIMITED TO, LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL
DAMAGES OR LOSSES.
9.1 NEITHER CLOUD9, ITS LICENSORS, NOR THEIR AFFILIATES SHALL BE LIABLE IN ANY WAY FOR LOSS OR DAMAGE OF ANY KIND RESULTING FROM THE USE OR INABILITY TO USE THE SDK OR ANY DERIVED SOFTWARE INCLUDING, BUT NOT LIMITED TO, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES.
9.2 IN NO EVENT WILL CLOUD9 BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
CONSEQUENTIAL, SPECIAL, PUNITIVE, EXEMPLARY DAMAGES, OR ANY OTHER DAMAGES
ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SDK, ANY DERIVED SOFTWARE, ANY
INFORMATION AVAILABLE IN CONNECTION THEREWITH, OR THE DELAY OR INABILITY TO USE
THE SDK, ANY DERIVED SOFTWARE, OR ANY INFORMATION, EVEN IN THE EVENT OF FAULT,
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, BREACH OF CONTRACT, OR BREACH OF
ANY WARRANTY AND EVEN IF CLOUD9 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
9.2 IN NO EVENT WILL CLOUD9 BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL, PUNITIVE, EXEMPLARY DAMAGES, OR ANY OTHER DAMAGES ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SDK, ANY DERIVED SOFTWARE, ANY INFORMATION AVAILABLE IN CONNECTION THEREWITH, OR THE DELAY OR INABILITY TO USE THE SDK, ANY DERIVED SOFTWARE, OR ANY INFORMATION, EVEN IN THE EVENT OF FAULT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, BREACH OF CONTRACT, OR BREACH OF ANY WARRANTY AND EVEN IF CLOUD9 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
THESE LIMITATIONS AND EXCLUSIONS REGARDING DAMAGES APPLY EVEN IF ANY REMEDY
FAILS. YOU ACKNOWLEDGE AND AGREE THAT YOUR SOLE AND EXCLUSIVE REMEDY FOR ANY
DISPUTE WITH CLOUD9 WITH REGARD TO THE SDK IS TO DISCONTINUE USE OF THE SDK AND
ANY DERIVED SOFTWARE. BECAUSE SOME STATES OR JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR THE LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL
DAMAGES, IN SUCH STATES OR JURISDICTIONS, CLOUD9, ITS LICENSORS, AND THEIR
AFFILIATES LIABILITY SHALL BE LIMITED TO THE FULL EXTENT PERMITTED BY LAW.
THESE LIMITATIONS AND EXCLUSIONS REGARDING DAMAGES APPLY EVEN IF ANY REMEDY FAILS. YOU ACKNOWLEDGE AND AGREE THAT YOUR SOLE AND EXCLUSIVE REMEDY FOR ANY DISPUTE WITH CLOUD9 WITH REGARD TO THE SDK IS TO DISCONTINUE USE OF THE SDK AND ANY DERIVED SOFTWARE. BECAUSE SOME STATES OR JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR THE LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, IN SUCH STATES OR JURISDICTIONS, CLOUD9, ITS LICENSORS, AND THEIR AFFILIATES LIABILITY SHALL BE LIMITED TO THE FULL EXTENT PERMITTED BY LAW.
10. Indemnification
10.1 You agree to defend, indemnify and hold harmless Cloud9, its licensors and
their affiliates from all liabilities, claims and expenses, including attorneys'
fees, that arise from or in connection with breach of this Agreement, use of the
SDK or any Derived Software, including, but not limited to, the creation,
distribution, promotion and use of any Derived Software. Cloud9 reserves the
right to assume the exclusive defense and control of any matter subject to
indemnification by you.
10.1 You agree to defend, indemnify and hold harmless Cloud9, its licensors and their affiliates from all liabilities, claims and expenses, including attorneys' fees, that arise from or in connection with breach of this Agreement, use of the SDK or any Derived Software, including, but not limited to, the creation, distribution, promotion and use of any Derived Software. Cloud9 reserves the right to assume the exclusive defense and control of any matter subject to indemnification by you.
11. Changes to the license agreement
11.1 Cloud9 may make changes to the License Agreement as it distributes new
versions of the SDK. When these changes are made, Cloud9 will make a new version
of the License Agreement available on the website where the SDK is made
available.
11.1 Cloud9 may make changes to the License Agreement as it distributes new versions of the SDK. When these changes are made, Cloud9 will make a new version of the License Agreement available on the website where the SDK is made available.
12. Applicable law, jurisdiction
12.1 This License Agreement, and your relationship with Cloud9 under this
License Agreement, shall be governed by the laws of the State of California
without regard to its conflict of laws provisions. You and Cloud9 agree to
submit to the exclusive jurisdiction of the courts located within the county of
Santa Clara, California to resolve any legal matter arising from this License
Agreement. Notwithstanding this, you agree that Cloud9 shall still be allowed to
apply for injunctive remedies.
12.1 This License Agreement, and your relationship with Cloud9 under this License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Cloud9 agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from this License Agreement. Notwithstanding this, you agree that Cloud9 shall still be allowed to apply for injunctive remedies.
13. General legal terms
13.1 This SDK License sets forth all rights for the user of the SDK and is the
entire agreement between the parties. This SDK License supersedes any other
communications with respect to the SDK. You agree that this SDK License is not
intended to confer and does not confer any rights or remedies upon any person
other than the parties to this SDK License. No provision hereof shall be deemed
waived unless such waiver shall be in writing and signed by Cloud9. If any
provision of this SDK License is held invalid or unenforceable, the remainder of
this SDK License shall continue in full force and effect, and such provision
shall be reformed only to the extent necessary to make it valid and enforceable.
The parties confirm that it is their wish that this Agreement has been written
in the English language only (or an equivalent type of urgent legal relief) in
any jurisdiction.
13.1 This SDK License sets forth all rights for the user of the SDK and is the entire agreement between the parties. This SDK License supersedes any other communications with respect to the SDK. You agree that this SDK License is not intended to confer and does not confer any rights or remedies upon any person other than the parties to this SDK License. No provision hereof shall be deemed waived unless such waiver shall be in writing and signed by Cloud9. If any provision of this SDK License is held invalid or unenforceable, the remainder of this SDK License shall continue in full force and effect, and such provision shall be reformed only to the extent necessary to make it valid and enforceable. The parties confirm that it is their wish that this Agreement has been written in the English language only (or an equivalent type of urgent legal relief) in any jurisdiction.
13.2 EXPORT RESTRICTIONS. YOU ACKNOWLEDGE THAT THE SDK IS OF U.S. ORIGIN. YOU
AGREE TO COMPLY WITH ALL APPLICABLE INTERNATIONAL AND NATIONAL LAWS THAT APPLY
TO THESE PRODUCTS, INCLUDING THE U.S. EXPORT ADMINISTRATION REGULATIONS, AS WELL
AS END-USER, END-USE AND DESTINATION RESTRICTIONS BY U.S. AND OTHER GOVERNMENTS.
13.2 EXPORT RESTRICTIONS. YOU ACKNOWLEDGE THAT THE SDK IS OF U.S. ORIGIN. YOU AGREE TO COMPLY WITH ALL APPLICABLE INTERNATIONAL AND NATIONAL LAWS THAT APPLY TO THESE PRODUCTS, INCLUDING THE U.S. EXPORT ADMINISTRATION REGULATIONS, AS WELL AS END-USER, END-USE AND DESTINATION RESTRICTIONS BY U.S. AND OTHER GOVERNMENTS.

Wyświetl plik

@ -1,5 +1,5 @@
Cloud9 3.0 SDK for Plugin Development
=======================================
========================================
This is the core repository for the Cloud9 v3 SDK. The SDK allows you to run a version of Cloud9 that allows you to develop plugins and create a custom IDE based on Cloud9.
@ -18,13 +18,14 @@ We also have a tutorial for how to get started working on the core plugins. [Che
We have several documentation resources for you:
<table>
<tr><th>SDK documentation</th><td>http://cloud9-sdk.readme.io/v0.1/docs</td></tr>
<tr><th>SDK documentation</th><td>https://TOBEFILLEDIN</td></tr>
<tr><th>API documentation</th><td>http://docs.c9.io/api</td></tr>
<tr><th>User documentation</th><td>http://docs.c9.io</td></tr>
<tr><th>User docs repo</th><td>https://github.com/c9/docs.c9.io</td></tr>
</table>
Please joing the mailinglist to get support or give support to the growing community of plugin developers:
https://groups.google.com/forum/#!forum/cloud9-sdk
https://groups.google.com/forum/#!forum/cloud9-plugin-development
#### Installation ####
@ -75,6 +76,4 @@ To protect the interests of the Cloud9 contributors and users we require contrib
1. [The Individual CLA](https://docs.google.com/a/c9.io/forms/d/1MfmfrxqD_PNlNsuK0lC2KSelRLxGLGfh_wEcG0ijVvo/viewform): use this version if you're working on the Cloud9 SDK or open source plugins in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
2. [The Corporate CLA](https://docs.google.com/a/c9.io/forms/d/1vFejn4111GdnCNuQ6BfnJDaxdsUEMD4KCo1ayovAfu0/viewform): have your corporate lawyer review and submit this if your company is going to be contributing to the Cloud9 SDK and/or open source plugins.
If you want to contribute to the Cloud9 SDK and/or open source plugins please go to the online form, fill it out and submit it.
Happy coding, Cloud9
If you want to contribute to the Cloud9 SDK and/or open source plugins please go to the online form, fill it out and submit it.

Wyświetl plik

@ -7,9 +7,6 @@ var APIHOST = process.env.C9_APIHOST || "api.c9.io"; // "api.c9.io";
var APIURL = APIHOST.indexOf("localhost") > -1
? "http://" + APIHOST
: "https://" + APIHOST;
var AUTHURL = APIHOST.indexOf("localhost") > -1
? "http://" + APIHOST
: "https://" + APIHOST.replace(/api\./, "");
return [
"./c9.core/ext",
@ -27,10 +24,7 @@ return [
},
"./c9.vfs.client/vfs.cli",
"./c9.cli/cli",
{
packagePath: "./c9.cli/auth.bootstrap",
authUrl: AUTHURL
},
"./c9.cli/auth.bootstrap",
{
packagePath: "./c9.cli.publish/publish",
projectId: PID,

Wyświetl plik

@ -0,0 +1,158 @@
var join = require("path").join;
module.exports = function(options) {
var config = require("./client-default")(options);
return module.exports.makeLocal(config, options);
};
module.exports.makeLocal = function(config, options) {
var c9Ws = options.remoteWorkspace; // true when opening c9 workspace as local
var root = options.workspaceDir;
var nodeBin = options.nodeBin || ["node"];
var settingDir = options.settingDir || options.installPath;
if (!c9Ws) {
// Local version
options.local = true;
options.projectName = root.substr(root.lastIndexOf("/") + 1);
options.debug = 2;
options.env = "local";
}
for (var i = config.length - 1; i >= 0; i--) {
// if (config[i].packagePath == "plugins/c9.cli.bridge/bridge")
// config[i].port = 55556;
if (config[i].packagePath == "plugins/c9.ide.welcome/welcome" && !c9Ws) {
config[i].intro =
"Welcome to your brand new Cloud9. Use this welcome screen "
+ "to tweak the look &amp; feel of the Cloud9 user interface. "
+ "If you prefer a more advanced IDE experience, you can choose "
+ "to change the layout below. "
+ "\n\n"
+ "On the right you can find videos and documentation for Cloud9 "
+ "IDE. Happy Coding!";
}
// else if (config[i].packagePath == "plugins/c9.ide.login/login") {
// config.splice(i, 1);
// }
else if (config[i].packagePath == "plugins/c9.ide.run/run" && !c9Ws) {
config[i].runnerPath = join(settingDir, "/runners");
}
else if (config[i].packagePath == "plugins/c9.ide.ui/menus") {
config[i].autoInit = false;
}
else if (config[i].packagePath == "plugins/c9.ide.save/autosave") {
config[i].slowChangeTimeout = 500;
}
else if (config[i].packagePath == "plugins/c9.ide.run.build/build" && !c9Ws) {
config[i].builderPath = join(settingDir, "/builders");
}
else if (config[i].packagePath == "plugins/c9.ide.editors/metadata" && !c9Ws) {
config[i].path = join(settingDir, "/metadata");
config[i].changeCheckInterval = 2000;
}
else if (config[i].packagePath == "plugins/c9.ide.feedback/feedback") {
config[i].screenshotSupport = false;
}
// else if (config[i].packagePath == "plugins/c9.ide.feedback/feedback") {
// config[i] = {
// packagePath : "plugins/c9.ide.help/help",
// staticPrefix : options.staticPrefix + "/plugins/c9.ide.help"
// };
// }
else if (config[i].packagePath == "plugins/c9.core/c9") {
config[i].local = true;
}
else if (config[i].packagePath == "plugins/c9.ide.clipboard/html5")
config[i].packagePath = "plugins/c9.ide.local/clipboard";
else if (config[i].packagePath == "plugins/c9.ide.configuration/configure")
config[i].pathFromFavorite = true;
else if (config[i].packagePath == "plugins/c9.core/settings" && !c9Ws) {
// todo: Don't show console when opening a file?
// config[i].template = ;
config[i].projectConfigPath = join(settingDir, "");
config[i].userConfigPath = join(settingDir, "");
config[i].stateConfigPath = join(settingDir, "");
} else if (config[i].packagePath == "plugins/c9.ide.log/log" && !c9Ws) {
config[i].source = "desktop";
} else if (config[i].packagePath == "plugins/c9.ide.info/info" && c9Ws) {
config[i].packagePath = "plugins/c9.ide.local/info";
} else if (config[i].packagePath == "plugins/c9.ide.ui/menus" && c9Ws) {
config[i].autoInit = false;
} else if (config[i].packagePath == "plugins/c9.ide.tree/tree") {
config[i].defaultExpanded = !config.hosted;
}
}
// Add local modules
var includes = [{
packagePath: "plugins/c9.ide.local/local",
options: options,
}, {
packagePath: "plugins/c9.ide.local/windowframe",
staticPrefix: options.staticPrefix + "/plugins/c9.ide.local"
}, {
packagePath: "plugins/c9.ide.local/update",
host: options.update && options.update.host || "localhost", // "update.c9.io",
port: options.update && options.update.port || "8888", // "443"
path: options.update && options.update.path,
protocol: options.update && options.update.protocol,
installPath: options.correctedInstallPath,
bashBin: options.bashBin,
nodeBin: nodeBin
}, {
packagePath: "plugins/c9.ide.local/projectmanager"
}, {
packagePath: "plugins/c9.ide.local/open"
}, {
packagePath: "plugins/c9.ide.local/nativemenus"
}, !c9Ws && {
packagePath: "plugins/c9.ide.local/info",
installPath: options.correctedInstallPath,
settingDir: settingDir,
cookie: options.user.cookie,
user: {
id: options.user.id,
name: options.user.name,
fullname: options.user.fullname,
email: options.user.email,
pubkey: options.user.pubkey
},
project: {
id: options.project.id,
name: options.project.name,
contents: options.project.contents,
descr: options.project.descr
}
}].filter(Boolean);
var excludes = c9Ws ? {} : {
"plugins/c9.ide.newresource/open": true,
"plugins/c9.ide.info/info": true,
// "plugins/c9.ide.login/login": true,
"plugins/c9.ide.collab/connect": true,
"plugins/c9.ide.collab/collab": true,
"plugins/c9.ide.collab/collabpanel": true,
"plugins/c9.ide.collab/workspace": true,
"plugins/c9.ide.collab/util": true,
"plugins/c9.ide.collab/ot/document": true,
"plugins/c9.ide.collab/cursor_layer": true,
"plugins/c9.ide.collab/author_layer": true,
"plugins/c9.ide.collab/timeslider/timeslider": true,
"plugins/c9.ide.notifications/notifications": true,
"plugins/c9.ide.collab/members/members_panel": true,
"plugins/c9.ide.collab/share/share": true,
"plugins/c9.ide.collab/members/members": true,
"plugins/c9.ide.collab/chat/chat": true,
"plugins/c9.ide.feedback/nps": true,
"plugins/c9.ide.download/download": true
};
config = config.concat(includes).filter(function (p) {
return !excludes[p] && !excludes[p.packagePath];
});
return config;
};

15
node_modules/ace_tree/LICENSE wygenerowano vendored
Wyświetl plik

@ -1,15 +0,0 @@
Copyright (C) 2015, Ajax.org B.V.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
See <http://www.gnu.org/licenses/>.

2
node_modules/ace_tree/package.json wygenerowano vendored
Wyświetl plik

@ -2,5 +2,7 @@
"name": "ace_tree",
"version": "0.1.0",
"devDependencies": {
"asyncjs": "0.0.x",
"amd-loader": "~0.0.4"
}
}

12
node_modules/ace_tree/todo.md wygenerowano vendored 100644
Wyświetl plik

@ -0,0 +1,12 @@
todo
now
* [x] mouse handler
* [x] default commands
future
* [ ] multiple selection
* [ ] variable line heights
* [ ] profile
* [ ] cleanup
* [ ] sort items?

26
node_modules/kaefer/lib/client.js wygenerowano vendored
Wyświetl plik

@ -86,29 +86,27 @@ var connectClient = module.exports = function(connectEio, options) {
});
}
var timer;
function reconnect(delay) {
if (isReconnecting && typeof delay !== "number")
function reconnect() {
if (isReconnecting)
return;
reconnectSocket.setSocket(null);
connectAttempts += 1;
if (typeof delay !== "number") {
if (connectAttempts < 10) {
delay = 250;
}
else {
delay = Math.min(60000, 250 * Math.pow(2, connectAttempts - 10));
}
var delay = 250;
if (connectAttempts > 10) {
delay = 10 * 1000;
}
else if (connectAttempts > 5) {
delay = 5 * 1000;
}
else if (connectAttempts > 3) {
delay = 1 * 1000;
}
isReconnecting = true;
console.log("Schedule re-connect in: " + delay);
socket.emit("reconnectDelay", { delay: delay });
clearTimeout(timer);
timer = setTimeout(function() {
setTimeout(function() {
isReconnecting = false;
connect();
}, delay);

Wyświetl plik

@ -40,6 +40,7 @@
"through": "2.2.0",
"tmp": "~0.0.20",
"uglify-js": "2.4.16",
"ui": "",
"ws": "0.4.31"
},
"optionalDependencies": {
@ -58,12 +59,12 @@
"c9.ide.language.javascript.tern": "#3d678a103a",
"c9.ide.language.javascript.infer": "#1ae097af44",
"c9.ide.language.jsonalyzer": "#45a20496be",
"c9.ide.collab": "#fabc22dda7",
"c9.ide.collab": "#08536cf0fe",
"c9.ide.local": "#d5c324ee5b",
"c9.ide.find": "#be3bca94b7",
"c9.ide.find.infiles": "#462928475c",
"c9.ide.find.replace": "#fe41fa768d",
"c9.ide.run.debug": "#9a05fadc55",
"c9.ide.run.debug": "#b734a2a47f",
"c9.ide.ace.emmet": "#e5f1a92ac3",
"c9.ide.ace.gotoline": "#4d1a93172c",
"c9.ide.ace.keymaps": "#422e83553b",
@ -73,7 +74,7 @@
"c9.ide.ace.stripws": "#34426a03d1",
"c9.ide.behaviors": "#f5aaf10aff",
"c9.ide.closeconfirmation": "#a28bfd8272",
"c9.ide.configuration": "#b8470f4107",
"c9.ide.configuration": "#8627b7d37d",
"c9.ide.dialog.wizard": "#a588b64050",
"c9.ide.fontawesome": "#781602c5d8",
"c9.ide.format": "#1ae38e60e6",

Wyświetl plik

@ -20,5 +20,3 @@ curl -XPOST -k -v -u timjrobinson:password https://api.c9.dev/projects/90/instal
Example install command:
NODE_TLS_REJECT_UNAUTHORIZED=0 C9_APIHOST=api.c9.dev C9_PID=90 c9 install <name>
NODE_TLS_REJECT_UNAUTHORIZED=0 C9_APIHOST=api.cloud9beta.com c9 install <name>

Wyświetl plik

@ -539,11 +539,9 @@ define(function(require, exports, module) {
form.append('options', JSON.stringify(json.plugins));
form.append('package', fs.createReadStream(zipFilePath));
var path = "/packages/" + json.name
+ "/versions?access_token="
+ encodeURIComponent(auth.accessToken);
var path = "/packages/" + json.name + "/versions?access_token=" + auth.accessToken;
var host = APIHOST.split(":")[0]
var port = parseInt(APIHOST.split(":")[1]) || null;
var port = parseInt(APIHOST.split(":")[1] || 80);
var request = http.request({
agent: false,
@ -652,11 +650,8 @@ define(function(require, exports, module) {
var gzPath = join(os.tmpDir(), name + "@" + version + ".tar.gz");
var file = fs.createWriteStream(gzPath);
var path = "/packages/" + name + "/versions/" + version
+ "/download?access_token="
+ encodeURIComponent(auth.accessToken);
var host = APIHOST.split(":")[0];
var port = parseInt(APIHOST.split(":")[1]) || null;
var host = APIHOST.split(":")[0]
var port = parseInt(APIHOST.split(":")[1] || 80);
var request = http.get({
agent: false,
@ -664,7 +659,8 @@ define(function(require, exports, module) {
host: host,
port: port,
auth: BASICAUTH,
path: path
path: "/packages/" + name + "/versions/" + version
+ "/download?access_token=" + auth.accessToken
}, function(response){
response.pipe(file);
});

Wyświetl plik

@ -15,7 +15,7 @@ define(function(require, exports, module) {
var plugin = new Plugin("Ajax.org", main.consumes);
// TODO read from options
var AUTHURL = options.authUrl;
var AUTHURL = "https://c9.dev";
var AUTHPATH = process.env.HOME + "/.c9/.auth";
var lastToken;

Wyświetl plik

@ -57,7 +57,7 @@ define(function(require, module, exports) {
}, plugin);
vfs.on("disconnect", function(reason) {
setStatus(state & ~STORAGE & ~PROCESS & ~NETWORK);
setStatus(status & ~STORAGE & ~PROCESS & ~NETWORK);
emit("disconnect");
}, plugin);
@ -67,7 +67,7 @@ define(function(require, module, exports) {
}, plugin);
vfs.on("error", function(message) {
setStatus(state & ~STORAGE & ~PROCESS);
setStatus(status & ~STORAGE & ~PROCESS);
// TODO: Don't display all errors?
if (emit("showerrormessage", message) !== false) {
console.error(

Wyświetl plik

@ -888,8 +888,8 @@ define(function(require, exports, module) {
* @fires newListener
**/
on: function(eventName, callback, plugin){
// if (!declaredEvents[eventName])
// console.warn("Missing event description or unknown event '" + eventName + "' for plugin '" + name + "'", new Error().stack);
if (!declaredEvents[eventName])
console.warn("Missing event description or unknown event '" + eventName + "' for plugin '" + name + "'", new Error().stack);
event.on(eventName, callback, plugin);
},
@ -900,8 +900,8 @@ define(function(require, exports, module) {
* @param {Function} callback the function called when the event is fired
**/
once: function(eventName, callback){
// if (!declaredEvents[eventName])
// console.warn("Missing event description or unknown event '" + eventName + "' for plugin '" + name + "'");
if (!declaredEvents[eventName])
console.warn("Missing event description or unknown event '" + eventName + "' for plugin '" + name + "'");
event.once(eventName, callback);
},

Wyświetl plik

@ -71,11 +71,6 @@ function plugin(options, imports, register) {
email: req.user.email
};
}
else if (req.session) {
customData.user = {
id: req.session.uid
};
}
raygunClient.send(err, customData, function() {}, {
host: parsedUrl.hostname,

Wyświetl plik

@ -151,7 +151,7 @@ define(function(require, exports, module) {
settings.set("user/general/@skin", e.value);
};
var setTheme = function(e) {
[rb1, rb2, rb5].some(function(rb) {
[rb1, rb2, rb3, rb4, rb5].some(function(rb) {
if (rb.value == e.value) {
rb.select();
return true;

Wyświetl plik

@ -168,9 +168,6 @@ define(function(require, exports, module) {
get accessToken() { return accessToken; },
set accessToken(v) { accessToken = v; loggedIn = true;},
/**
*
*/
login: login,
/**

Wyświetl plik

@ -1,23 +1,18 @@
.errorlabel, .disconnectlabel{
.errorlabel{
position: absolute;
left: 0;
right: 0;
top: 0;
z-index: 10000000;
/*text-align: center;*/
text-align: center;
pointer-events: none;
.font-smoothing(@error-font-smoothing);
}
.errorlabel.anim, .disconnectlabel.anim{
.errorlabel.anim{
transition: top 0.2s;
-moz-transition: top 0.2s; /* Gecko */
-webkit-transition: top 0.2s; /* Safari */
}
.errorlabel.fade-in{
transition: opacity 0.2s;
-moz-transition: opacity 0.2s; /* Gecko */
-webkit-transition: opacity 0.2s; /* Safari */
}
.errorlabel div{
background: @error-background;
padding: @error-padding;
@ -31,9 +26,6 @@
max-width: 100%;
pointer-events: auto;
}
.errorlabel.fade-in div{
border-radius: 3px;
}
.errorlabel u.close{
.image-2x("@{image-path}/@{error-close-image}", 42px, 28px);
background-position: @error-close-idle-position;
@ -41,7 +33,7 @@
height: 14px;
position: absolute;
right: 8px;
top: 6px;
top: 8px;
cursor: pointer;
}
.errorlabel u.close:hover{
@ -53,25 +45,4 @@
.errorlabel div span{
border-bottom: 1px dotted rgb(255, 174, 174);
cursor: help;
}
.disconnectlabel{
z-index: 10000001;
}
.disconnectlabel div{
background: @disconnect-background;
padding: @disconnect-padding;
color: @disconnect-color;
border-radius: 0 0 3px 3px;
box-shadow: @disconnect-box-shadow;
line-height: 1.4;
display: inline-block;
position: relative;
word-wrap: break-word;
text-align: center;
width: 300px;
pointer-events: auto;
}
.disconnectlabel u{
cursor: pointer;
}

Wyświetl plik

@ -12,72 +12,22 @@ define(function(require, exports, module) {
/***** Initialization *****/
var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter();
var topPx = 0;
var error, hideTimeout;
var lastCookie = 0;
var offset = 0;
var error, hideTimeout, disconnect;
var DISCONNECTDELAY = 1000;
var loaded = false;
function load() {
if (loaded) return false;
loaded = true;
ui.insertCss(require("text!./error.css"),
options.staticPrefix, plugin);
}
function initDisconnectEvents(vfs){
var timer;
vfs.once("connect", function(){
vfs.connection.on("reconnectDelay", function(e){
clearInterval(timer);
var delay = e.delay;
if (delay > 999) {
timer = setInterval(function(){
if (vfs.connected)
return clearInterval(timer);
delay -= 1000;
showDisconnect({ delay: delay });
if (delay <= 0)
clearInterval(timer);
}, 1000);
}
showDisconnect(e);
});
});
vfs.on("connect", function(){
hideDisconnect();
});
vfs.on("disconnect", function(){
// setTimeout(function(){
// showDisconnect();
// }, DISCONNECTDELAY);
});
vfs.on("connecting", function(){
showDisconnect({ connecting: true });
});
plugin.on("retryConnect", function(){
vfs.connection.reconnect(0);
});
}
/***** Methods *****/
function getCenterX(){
var bartools = document.querySelector(".bartools");
if (!bartools) return 0; // For testing
var b1 = bartools.getBoundingClientRect();
var b2 = bartools.nextSibling.getBoundingClientRect();
return b1.left + b1.width + ((b2.left - b1.left - b1.width)/2);
}
function show(message, timeout) {
// Error message container
if (!error) {
@ -113,21 +63,18 @@ define(function(require, exports, module) {
error.innerHTML = "<div><u class='close'></u>"
+ messageString + "</div>";
error.style.opacity = 0;
error.style.display = "block";
error.style.top = (offset - (error.offsetHeight - 10 + topPx)) + "px";
error.firstChild.style.marginLeft = Math.max(0, (getCenterX() - (error.firstChild.offsetWidth / 2))) + "px";
error.style.top = (-1 * error.offsetHeight - 10 + topPx) + "px";
// Start anim
setTimeout(function() {
error.className = "errorlabel anim " + (offset > 0 ? "fade-in" : "");
error.style.top = (offset + topPx) + "px";
error.style.opacity = 1;
error.className = "errorlabel anim";
error.style.top = topPx + "px";
}, 10);
clearTimeout(hideTimeout);
if (!(timeout < 0))
hideTimeout = setTimeout(hide, timeout || 15000);
setTimeout(hide, timeout || 15000);
});
return ++lastCookie;
@ -142,96 +89,19 @@ define(function(require, exports, module) {
if (!error || error.style.display === "none")
return callback && callback();
error.className = "errorlabel anim " + (offset > 0 ? "fade-in" : "");
if (offset > 0)
error.style.opacity = 0;
else
error.style.top = (-1 * error.offsetHeight - 10 + topPx) + "px";
error.className = "errorlabel anim";
error.style.top = (-1 * error.offsetHeight - 10 + topPx) + "px";
setTimeout(function() {
error.style.display = "none";
callback && callback();
}, 220);
}
function showDisconnect(options){
// Error message container
if (!disconnect) {
disconnect = document.body.appendChild(document.createElement("div"));
disconnect.className = "disconnectlabel";
disconnect.addEventListener("mouseup", function(e) {
if (e.target.tagName == "U")
emit("retryConnect");
});
}
var message;
if (!options || options.delay < 1000 || options.connecting)
message = "Reconnecting...";
else if (options.delay)
message = "Reconnecting in " + Math.ceil(options.delay/1000)
+ " seconds."
+ (options.delay < 2001 ? "" : " <u>Retry Now.</u>");
else
message = "Reconnecting...";
disconnect.innerHTML = "<div>" + message + "</div>";
disconnect.firstChild.style.marginLeft
= Math.max(0, (getCenterX() - 150)) + "px";
if (disconnect.style.display == "block")
return;
disconnect.style.display = "block";
disconnect.style.top = (-1 * disconnect.offsetHeight - 10 + topPx) + "px";
// Start anim
setTimeout(function() {
disconnect.className = "disconnectlabel anim";
disconnect.style.top = (topPx) + "px";
}, 10);
offset = 28;
// document.querySelector(".c9-offline").addEventListener("click", function(){
// alert("Offline Notication", "You are currently offline.",
// "This indicator notifies you that Cloud9 is unable to reach "
// + "the server. This usually happens because you are offline. "
// + "Some features will be disabled until the "
// + "network connection becomes available again. "
// + "This notication could also show when the server is "
// + "unreachable due to other reasons. Sometimes a refresh of "
// + "the tab will fix an issue. Please e-mail "
// + "support@c9.io for further problem resolution.");
// }, false);
}
function hideDisconnect(cookie, callback) {
if (!disconnect || disconnect.style.display === "none")
return callback && callback();
disconnect.className = "disconnectlabel anim";
disconnect.style.top = (-1 * disconnect.offsetHeight - 10 + topPx) + "px";
setTimeout(function() {
disconnect.style.display = "none";
callback && callback();
}, 220);
offset = 0;
}
/***** Lifecycle *****/
plugin.on("load", function() {
load();
});
plugin.on("unload", function() {
topPx = 0;
lastCookie = 0;
offset = 0;
error = null;
hideTimeout = null;
});
/***** Register and define API *****/
@ -246,19 +116,6 @@ define(function(require, exports, module) {
get top(){ return topPx; },
set top(value){ topPx = value; },
get vfs(){ throw new Error("Permission Denied"); },
set vfs(v){ initDisconnectEvents(v); },
/**
*
*/
showDisconnect: showDisconnect,
/**
*
*/
hideDisconnect: hideDisconnect,
/**
* Displays an error message in the main error reporting UI.
* @param {String} message The message to display.

Wyświetl plik

@ -301,7 +301,6 @@ define(function(require, exports, module) {
setTimeout(function() {
ace.treeEditor.endRename(false);
});
return disable;
}
}
@ -413,8 +412,6 @@ define(function(require, exports, module) {
if (!item.name) return;
var groupName = item.group || "General";
if (groupName == "ignore") return;
var group = groups[groupName];
if (!group)
root.push(group = groups[groupName] = {
@ -456,7 +453,7 @@ define(function(require, exports, module) {
}
function editUserKeys(tab) {
// preferences.hide();
preferences.hide();
var keys = settings.getJson("user/key-bindings") || [];
var value = "// Edit this keymap file and save to apply.\n[\n";
@ -470,7 +467,7 @@ define(function(require, exports, module) {
}).join(",\n");
if (!keys.length)
value += ' // { "command": "nexttab", "keys": ["Ctrl-Tab"] }';
value += ' // { "command": "nexttab", "keys": ["Alt-`", "Ctrl-Tab"] }';
value += "\n]";

Wyświetl plik

@ -8,11 +8,11 @@ define(function(require, exports, module) {
function main(options, imports, register) {
var c9 = imports.c9;
var alert = imports["dialog.alert"].show;
var Plugin = imports.Plugin;
var question = imports["dialog.question"];
var settings = imports.settings;
var commands = imports.commands;
var alert = imports["dialog.alert"].show;
var question = imports["dialog.question"];
var preload = imports["layout.preload"];
var anims = imports.anims;
var ui = imports.ui;
@ -126,6 +126,33 @@ define(function(require, exports, module) {
img.src = options.staticPrefix + "/images/" + p;
});
var hideOffline;
c9.on("stateChange", function(e) {
// Online
if (e.state & c9.NETWORK && e.state & c9.STORAGE) {
hideOffline && hideOffline();
}
// Offline
else if (!hideOffline || hideOffline.hasClosed()) {
hideOffline = notify("<div class='c9-offline'>No internet "
+ "connection detected. Cloud9 will automatically try to "
+ "reconnect when it detects an internet connection."
+ "</div>", true, 1000);
document.querySelector(".c9-offline").addEventListener("click", function(){
alert("Offline Notication", "You are currently offline.",
"This indicator notifies you that Cloud9 is unable to reach "
+ "the server. This usually happens because you are offline. "
+ "Some features will be disabled until the "
+ "network connection becomes available again. "
+ "This notication could also show when the server is "
+ "unreachable due to other reasons. Sometimes a refresh of "
+ "the tab will fix an issue. Please e-mail "
+ "support@c9.io for further problem resolution.");
}, false);
}
});
window.addEventListener("resize", resize, false);
window.addEventListener("focus", resize, false);
@ -515,21 +542,6 @@ define(function(require, exports, module) {
window.removeEventListener("resize", resize);
if (removeTheme) removeTheme();
logobar = null;
removeTheme = null;
theme = null;
c9console = null;
menus = null;
tabManager = null;
panels = null;
userLayout = null;
ignoreTheme = null;
notify = null;
hideFlagUpdate = null;
activeFindArea = null;
defaultFindArea = null;
activating = null;
});
/***** Register and define API *****/

Wyświetl plik

@ -632,12 +632,6 @@
@error-close-hover-position: -14px -14px;
@error-close-active-position: -28px -14px;
// Disconnect Dialog
@disconnect-background: #D8B112;
@disconnect-color: @error-color;
@disconnect-padding: @error-padding;
@disconnect-box-shadow: @error-box-shadow;
// Offline Dialog
@offline-gradient: linear-gradient(top, rgb(60, 112, 153) 0%, rgb(61, 97, 126) 100%);
@offline-border-bottom: 1px solid rgba(0, 0, 0, 0.61);

Wyświetl plik

@ -632,12 +632,6 @@
@error-close-hover-position: -14px -14px;
@error-close-active-position: -28px -14px;
// Disconnect Dialog
@disconnect-background: #D8B112;
@disconnect-color: @error-color;
@disconnect-padding: @error-padding;
@disconnect-box-shadow: @error-box-shadow;
// Offline Dialog
@offline-gradient: linear-gradient(top, rgb(60, 112, 153) 0%, rgb(61, 97, 126) 100%);
@offline-border-bottom: 1px solid rgba(0, 0, 0, 0.61);

Wyświetl plik

@ -632,12 +632,6 @@
@error-close-hover-position: -14px -14px;
@error-close-active-position: -28px -14px;
// Disconnect Dialog
@disconnect-background: #D8B112;
@disconnect-color: @error-color;
@disconnect-padding: @error-padding;
@disconnect-box-shadow: @error-box-shadow;
// Offline Dialog
@offline-gradient: linear-gradient(top, #3d9ac4 0%, #3d9ac4 100%);
@offline-border-bottom: 0;

Wyświetl plik

@ -632,12 +632,6 @@
@error-close-hover-position: -14px -14px;
@error-close-active-position: -28px -14px;
// Disconnect Dialog
@disconnect-background: #D8B112;
@disconnect-color: @error-color;
@disconnect-padding: @error-padding;
@disconnect-box-shadow: @error-box-shadow;
// Offline Dialog
@offline-gradient: linear-gradient(top, rgb(60, 112, 153) 0%, rgb(61, 97, 126) 100%);
@offline-border-bottom: 1px solid rgba(0, 0, 0, 0.61);

Wyświetl plik

@ -632,12 +632,6 @@
@error-close-hover-position: -14px -14px;
@error-close-active-position: -28px -14px;
// Disconnect Dialog
@disconnect-background: #D8B112;
@disconnect-color: @error-color;
@disconnect-padding: @error-padding;
@disconnect-box-shadow: @error-box-shadow;
// Offline Dialog
@offline-gradient: linear-gradient(top, rgb(60, 112, 153) 0%, rgb(61, 97, 126) 100%);
@offline-border-bottom: 1px solid rgba(0, 0, 0, 0.61);

Wyświetl plik

@ -156,14 +156,14 @@
.console>.hbox>.console_close_btn{
width: 26px !important;
height: 30px !important;
margin: 11px -4px 0px 3px !important;
margin: 4px -4px 0px 3px !important;
box-sizing: border-box;
}
.console>.hbox>.divider_console{
display: none;
}
.console>.hbox>.btn_console{
margin: 7px 0px 0px 0px !important;
margin: 0px 0px 0px 0px !important;
border-radius: 0;
width: 26px !important;
height: 31px !important;

Wyświetl plik

@ -0,0 +1,36 @@
.c9-menu-btn.titlebar{
position: absolute;
z-index: 100000000;
right: 24px;
top: 1px;
height: 19px;
}
.c9-menu-btn.titlebar:not(.c9-menu-btnDown){
height: 18px;
border-bottom: 1px solid black;
}
.fullscreen>.btnName{
display: none;
}
.btnName.c9-menu-btnIcon{
text-indent: -2000px;
overflow: hidden;
}
.btnName{
padding: @menu-name-button-padding;
margin-left: @menu-name-button-diff !important;
}
.btnName.c9-menu-btnmenuDown{
margin-left: 0 !important;
}
.btnName .icon{
background-size: @menu-name-button-icon-width @menu-name-button-icon-height !important;
top: @menu-name-button-icon-top !important;
left: @menu-name-button-icon-left !important;
width: @menu-name-button-icon-width;
height: @menu-name-button-icon-height;
border-radius: @menu-name-button-icon-border-radius;
}

Wyświetl plik

@ -0,0 +1,194 @@
define(function(require, exports, module) {
main.consumes = [
"Plugin", "ui", "menus", "info", "layout", "http", "util",
"vfs.endpoint", "auth", "dialog.alert", "c9"
];
main.provides = ["login"];
return main;
function main(options, imports, register) {
var Plugin = imports.Plugin;
var ui = imports.ui;
var c9 = imports.c9;
var menus = imports.menus;
var layout = imports.layout;
var http = imports.http;
var util = imports.util;
var info = imports.info;
var auth = imports.auth;
var alert = imports["dialog.alert"].show;
var vfsEndpoint = imports["vfs.endpoint"];
/***** Initialization *****/
var ideBaseUrl = options.ideBaseUrl;
var dashboardUrl = options.dashboardUrl;
var accountUrl = options.accountUrl;
var lastUser, mnuUser;
var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter();
var loaded = false;
function load() {
if (loaded) return false;
loaded = true;
info.getUser(function(err, user) {
updateButton({user: user});
});
auth.on("relogin", onReLogin);
}
/***** Methods *****/
function updateButton(e) {
var user = e.user;
if (lastUser && lastUser.id == user.id)
return;
plugin.cleanUp();
info.on("change", updateButton, plugin);
createButton(user);
lastUser = user;
emit.sticky("ready", { name: user.fullname, id: user.id }, plugin);
}
function createButton(user) {
var name = "user_" + user.id;
// todo cleanup seems to not work well
// without this menu is empty after logging out and back in
if (lastUser)
menus.remove("user_" + lastUser.id);
menus.remove(name);
var parent = layout.findParent(plugin);
// Insert CSS
ui.insertCss(require("text!./login.css"), plugin);
// Create Menu
mnuUser = new ui.menu();
plugin.addElement(mnuUser);
// Add named button
var icon = util.getGravatarUrl(user.email, 32, "");
menus.addItemByPath(name + "/", mnuUser, 110000, plugin);
// Add Divider
ui.insertByIndex(parent, new ui.divider({
skin: "c9-divider-double",
"class" : "extrasdivider"
}), 870, plugin);
// Add sub menu items
var c = 500;
menus.addItemByPath(name + "/Dashboard", new ui.item({
onclick: function() { window.open(dashboardUrl); }
}), c += 100, plugin);
menus.addItemByPath(name + "/Account", new ui.item({
onclick: function() { window.open(accountUrl); }
}), c += 100, plugin);
menus.addItemByPath(name + "/Home", new ui.item({
onclick: function() { window.open(ideBaseUrl); }
}), c += 100, plugin);
if (!options.noLogout) {
menus.addItemByPath(name + "/~", new ui.divider(), c += 100, plugin);
menus.addItemByPath(name + "/Log out", new ui.item({
onclick: function() {
if (!c9.local)
return signout();
auth.logout(function() {
info.login(true);
});
}
}), c += 100, plugin);
}
var button = menus.get(name).item;
button.setAttribute("class", "btnName");
button.setAttribute("icon", icon);
button.setAttribute("iconsize", "16px 16px");
button.setAttribute("tooltip", user.fullname);
button.setAttribute("caption", user.fullname);
ui.insertByIndex(parent, button, 600, plugin);
if (c9.local) {
function minimize(){
apf.document.documentElement.appendChild(button);
ui.setStyleClass(button.$ext, "titlebar");
}
function restore(){
ui.insertByIndex(parent, button, 870, plugin);
ui.setStyleClass(button.$ext, "", ["titlebar"]);
}
menus.on("minimize", minimize, plugin);
menus.on("restore", restore, plugin);
if (menus.minimized)
minimize();
}
}
function signout() {
vfsEndpoint.clearCache();
auth.logout(function() { location.href = ideBaseUrl; });
}
function onReLogin() {
if (!c9.local) {
alert("Logged out",
"You have been logged in as a different user",
"Please hit OK to reload the IDE.",
function() {
vfsEndpoint.clearCache();
auth.logout(function() {
document.location.reload();
});
});
}
}
/***** Lifecycle *****/
plugin.on("load", function() {
load();
});
plugin.on("enable", function() {
});
plugin.on("disable", function() {
});
plugin.on("unload", function() {
loaded = false;
});
/***** Register and define API *****/
/**
*
**/
plugin.freezePublicAPI({
get menu(){ return mnuUser; },
_events: [
/**
* @event ready
*/
"ready"
],
createButton: createButton,
updateButton: updateButton
});
register(null, {
login: plugin
});
}
});

Wyświetl plik

@ -46,9 +46,9 @@ define(function(require, exports, module) {
menus.addItemByPath("Tools/Developer", null, 100100, plugin);
menus.addItemByPath("Tools/Developer/Start in Debug Mode", new ui.item({
onclick: function(){
var url = location.href + (location.href.indexOf("?") > -1
var url = location.href + (location.href.indexOf("?") > -1)
? "&debug=2"
: "?debug=2");
: "?debug=2";
window.open(url);
}
}), 100100, plugin);
@ -139,12 +139,10 @@ define(function(require, exports, module) {
watch("~/.c9/plugins/" + pluginPath);
var cfg = options.plugins[path];
var host = vfs.baseUrl + "/";
var base = join(String(c9.projectId),
"plugins", auth.accessToken);
cfg.packagePath = host + join(base, pluginPath.replace(/^plugins\//, ""));
cfg.staticPrefix = host + join(base, name);
cfg.packagePath = join(vfs.baseUrl, c9.projectId, "plugins",
auth.accessToken, pluginPath.replace(/^plugins\//, ""));
cfg.staticPrefix = join(vfs.baseUrl, c9.projectId, "plugins",
auth.accessToken, name);
cfg.apikey = "0000000000000000000000000000=";
config.push(cfg);

Wyświetl plik

@ -66,11 +66,9 @@ define(function(require, exports, module) {
names.push(name);
var path = options.packagePath + ".js";
var host = vfs.baseUrl + "/";
var base = join(String(c9.projectId), "plugins", auth.accessToken);
options.packagePath = host + join(base, path.replace(/^plugins\//, ""));
options.staticPrefix = host + join(base, name);
var base = join(vfs.baseUrl, c9.projectId, "plugins", auth.accessToken);
options.packagePath = join(base, path.replace(/^plugins\//, ""));
options.staticPrefix = join(base, name);
if (!options.setup) {
wait++;

Wyświetl plik

@ -171,7 +171,7 @@ define(function(require, exports, module) {
var position = options.position;
var node, childNodes;
if (options.setting && !options.path)
if (!options.setting && options.path)
options.path = options.setting;
if (debug)

Wyświetl plik

@ -1,134 +0,0 @@
define(function(require, exports, module) {
function parseXml(xmlStr) {
return (new DOMParser()).parseFromString(xmlStr, "text/xml");
}
function attributes(list) {
var map = {};
for (var i = 0; i < list.length; i++) {
var attr = list[i];
map[attr.name] = attr.value;
}
return list.length && map;
}
function node2Json(node) {
var children;
if (node.nodeType == node.ELEMENT_NODE) {
children = [];
var list = node.childNodes;
for (var i = 0; i < list.length; i++) {
var ch = node2Json(list[i]);
ch && children.push(ch);
}
} else if (node.nodeType == node.TEXT_NODE) {
return node.data.trim();
} else if (node.nodeType == node.DOCUMENT_NODE) {
return node2Json(node.documentElement);
} else {
return;
}
var json = {name: node.nodeName}; // node.localName}
var props = attributes(node.attributes);
if (props) json.props = props;
if (children.length) json.children = children;
return json;
}
function xml2Json(node) {
if (typeof node == "string")
node = parseXml(node);
return node2Json(node);
}
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var useragent = require("ace/lib/useragent");
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var CommandManager = require("ace/commands/command_manager").CommandManager;
var Node = function() {
this.children = [];
this.childNodes = this.children;
this.firstChild =
this.lastChild =
this.parentNode =
this.nextSibling =
this.previousSibling = null;
};
(function() {
oop.implement(this, EventEmitter);
this.appendChild = function(node) {
return this.insertBefore(node);
};
this.insertBefore = function(node, beforeNode) {
if (beforeNode == node)
return node;
if (!this || this == node)
throw new Error("Invalid insertBefore call");
var children = this.childNodes;
// if (node.parentNode == this)
// children[index]
if (node.parentNode)
node.removeNode();
var index = beforeNode ? children.indexOf(beforeNode) : children.length;
node.parentNode = this;
if (beforeNode) {
children.splice(index, 0, node);
} else {
children.push(node);
}
node.previousSibling = children[index - 1];
node.nextSibling = children[index + 1];
if (node.previousSibling)
node.previousSibling.nextSibling = node;
else
this.firstChild = children[0];
if (node.nextSibling)
node.nextSibling.previousSibling = node;
else
this.lastChild = children[this.childNodes.length - 1];
return node;
};
this.removeChild = function(node) {
var children = this.childNodes;
var index = children.indexOf(node);
if (index == -1) return;
children.splice(index, 1);
var prev = node.previousSibling;
var next = node.nextSibling;
if (prev)
prev.nextSibling = next;
if (next)
next.previousSibling = prev;
node.parentNode =
node.nextSibling =
node.previousSibling = null;
};
this.remove = function() {
if (this.parentNode)
this.parentNode.removeChild(this);
};
}).call(Node.prototype);
});

Wyświetl plik

@ -1,994 +0,0 @@
define(function(require, module, exports) {
return function(apf) {
var $setTimeout = setTimeout;
var $setInterval = setInterval;
/**
* A container that stacks its children vertically.
*
* #### Example
*
* ```xml, demo
* <a:application xmlns:a="http://ajax.org/2005/aml">
* <!-- startcontent -->
* <a:vbox width="100">
* <a:button height="28" edge="5">Button 1</a:button>
* <a:button height="28" edge="5">Button 2</a:button>
* <a:button height="28" edge="5">Button 3</a:button>
* </a:vbox>
* <!-- endcontent -->
* </a:application>
* ```
*
* @class apf.vbox
* @layout
* @define vbox
*
*
* @see element.hbox
*
* @author Ruben Daniels (ruben AT ajax DOT org)
* @version %I%, %G%
* @since 0.9
* @layout
*/
/**
* A container that stacks its children horizontally.
*
* #### Example
*
* ```xml, demo
* <a:application xmlns:a="http://ajax.org/2005/aml">
* <!-- startcontent -->
* <a:hbox height="29" width="300" lean="right" margin="5 0 0 0">
* <a:button width="100" edge="5">Button 1</a:button>
* <a:button width="100">Button 2</a:button>
* <a:button width="100">Button 3</a:button>
* </a:hbox>
* <!-- endcontent -->
* </a:application>
* ```
*
*
* #### Remarks
*
* Firefox has some issues:
*
* 1. Sometimes it's necessary to put a fixed width to have it calculate the right
* height value.
* 2. Using flex="1" on non fixed height/width tree's will give unexpected results.
*
*
*
* @class apf.hbox
* @inherits apf.GuiElement
* @define hbox
* @layout
*
* @see element.vbox
* @author Ruben Daniels (ruben AT ajax DOT org)
* @version %I%, %G%
* @since 0.9
*/
apf.hbox = function(struct, tagName) {
this.$init(tagName || "hbox", apf.NODE_VISIBLE, struct);
};
apf.vbox = function(struct, tagName) {
this.$init(tagName || "vbox", apf.NODE_VISIBLE, struct);
};
(function(){
this.minwidth = 0;
this.minheight = 0;
// *** Properties and Attributes *** //
this.$focussable = false;
this.$useLateDom = true;
this.$box = true;
this.$layout = true;
var input = {"INPUT":1, "SELECT":1, "TEXTAREA":1};
/**
* @attribute {String} [padding=2] Sets or gets the space between each element.
*/
/**
* @attribute {Boolean} reverse Sets or gets whether the sequence of the elements is in reverse order.
*/
/**
* @attribute {String} [edge="5,5,5,5"] Sets or gets the space between the container and the elements, space seperated in pixels for each side. Similar to CSS in the sequence (_.i.e._. `top right bottom left`).
*
* #### Example
*
* ```xml
* <a:vbox edge="10 10 40 10" />
* ```
*/
// @todo Doc
/**
* @attribute {String} pack
*
* Possible values include:
*
* - `"start"`:
* - `"center"`:
* - `"end"`:
*/
/**
* @attribute {Boolean} align
*
* Possible values include:
*
* - `"start"`:
* - `"center"`:
* - `"end"`:
* - `"stretch"`:
*/
this.$booleanProperties["splitters"] = true;
this.$supportedProperties.push("padding", "reverse", "edge", "pack", "align", "splitters");
this.$propHandlers["padding"] = function(value) {
this.padding = parseInt(value);
var node, nodes = this.childNodes, elms = [];
for (var i = 0, l = nodes.length; i < l; i++) {
if ((node = nodes[i]).nodeFunc == apf.NODE_VISIBLE
&& node.$ext && node.visible !== false)
elms.push(node);
}
if (!elms.length)
return;
for (var last, b, el, i = elms.length - 2; i >= 0; i--) {
b = (el = elms[i]).margin && apf.getBox(el.margin) || [0,0,0,0];
if ((!last || !last.$splitter) && !el.$splitter) {
b[this.$vbox ? 2 : 1] += this.padding;
if (!apf.hasFlexibleBox && i != 0 && this.align == "stretch" && this.$vbox)
b[0] += this.padding;
}
el.$ext.style.margin = b.join("px ") + "px";
last = el;
}
b = (el = elms[elms.length - 1]).margin && apf.getBox(el.margin) || [0,0,0,0];
el.$ext.style.margin = b.join("px ") + "px";
if (!apf.hasFlexibleBox)
this.$resize();
}
this.$propHandlers["reverse"] = function(value) {
if (apf.hasFlexibleBox)
this.$int.style[apf.CSSPREFIX + "BoxDirection"] = value ? "reverse" : "normal";
else {
//@todo
}
};
this.$propHandlers["edge"] = function(value) {
var el = !apf.hasFlexibleBox && this.$vbox ? this.$ext : this.$int;
el.style.padding = (this.$edge = apf.getBox(value)).join("px ") + "px";
if (!apf.hasFlexibleBox)
this.$resize();
};
this.$propHandlers["pack"] = function(value) {
if (apf.hasFlex) {
if (value == "start" || value == "end")
value = "flex-" + value;
this.$int.style.justifyContent = value || "flex-start";
} else if (apf.hasFlexibleBox) {
this.$int.style[apf.CSSPREFIX + "BoxPack"] = value || "start";
} else if (this.$amlLoaded) {
if (this.$vbox) {
this.$int.style.verticalAlign = value == "center" ? "middle" : (value == "end" ? "bottom" : "top");
}
else {
this.$int.style.textAlign = "";
var nodes = this.childNodes;
for (var i = 0, l = nodes.length; i < l; i++) {
if ((node = nodes[i]).nodeFunc != apf.NODE_VISIBLE || !node.$amlLoaded) //|| node.visible === false
continue;
node.$ext.style.textAlign = apf.getStyle(node.$ext, "textAlign") || "left";
}
this.$int.style.textAlign = value == "center" ? "center" : (value == "end" ? "right" : "left");
}
}
};
//@todo change overflow when height/width changes depending on $vbox
this.$propHandlers["align"] = function(value) {
if (apf.hasFlex) {
if (value == "start" || value == "end")
value = "flex-" + value;
this.$int.style.alignItems = value || "stretch"; // flex-start
}
else if (apf.hasFlexibleBox) {
this.$int.style[apf.CSSPREFIX + "BoxAlign"] = value || "stretch";
//@todo this should probably be reinstated
var stretch = !value || value == "stretch";
var nodes = this.childNodes;
var size = this.$vbox ? "width" : "height";
var isInFixed = false, loopNode = this;
while (!isInFixed && loopNode) {
isInFixed = loopNode[size] || loopNode.anchors || (loopNode.$vbox ? loopNode.top && loopNode.bottom : loopNode.left && loopNode.right);
if (!loopNode.flex)
break;
loopNode = loopNode.parentNode || loopNode.$parentNode;
}
for (var i = 0, l = nodes.length; i < l; i++) {
if (!(node = nodes[i]).$ext || node.$ext.nodeType != 1)
continue;
//(this[size] || this.anchors || (this.$vbox ? this.top && this.bottom : this.left && this.right)
if (stretch && !node[size]) //(node.$altExt ||
node.$ext.style[size] = (input[node.$ext.tagName]
? "100%" : "auto");
else if (node[size])
handlers["true"][size].call(node, node[size]);
}
}
else if (this.$amlLoaded) {
var stretch = !value || value == "stretch";
if (!this.$vbox) {
var nodes = this.childNodes;
for (var i = 0, l = nodes.length; i < l; i++) {
if ((node = nodes[i]).nodeFunc != apf.NODE_VISIBLE || !node.$amlLoaded) //|| node.visible === false
continue;
node.$ext.style.verticalAlign = value == "center" ? "middle" : (value == "end" ? "bottom" : "top");
}
}
else {
var el = !apf.hasFlexibleBox && this.$vbox ? this.$ext : this.$int;
el.style.textAlign = "";
var node, nodes = this.childNodes;
for (var i = 0, l = nodes.length; i < l; i++) {
if ((node = nodes[i]).nodeFunc != apf.NODE_VISIBLE || !node.$amlLoaded) //|| node.visible === false
continue;
if (node.visible !== false) {
node.$ext.style.display = value == "stretch" ? "block" : "inline-block";
node.$br.style.display = value == "stretch" ? "none" : "";
}
node.$ext.style.textAlign = apf.getStyle(node.$ext, "textAlign") || "left";
}
el.style.textAlign = value == "center" ? "center" : (value == "end" ? "right" : "left");
}
}
};
function visibleHandler(e) {
if (this.parentNode.splitters && !this.$splitter) {
if (!e.value) {
if (this.nextSibling && this.nextSibling.$splitter)
this.nextSibling.removeNode();
else if (this.previousSibling && this.previousSibling.$splitter)
this.previousSibling.removeNode();
}
else {
var isLast = isLastVisibleChild(this);
if (!isLast) {
if (!this.nextSibling.$splitter && !this.nextSibling.nosplitter
&& !isFirstVisibleChild(this) && !this.nosplitter) {
this.parentNode.insertBefore(
this.ownerDocument.createElementNS(apf.ns.aml, "splitter"),
this.nextSibling);
}
}
else if (this.previousSibling && !this.previousSibling.$splitter
&& !this.previousSibling.nosplitter) {
this.parentNode.insertBefore(
this.ownerDocument.createElementNS(apf.ns.aml, "splitter"),
this);
}
}
}
//@todo this can be more optimized by calcing if it WAS the last vis child.
if (this.parentNode.$propHandlers["padding"]) {// && isLastVisibleChild(this)) {
this.parentNode.$propHandlers["padding"]
.call(this.parentNode, this.parentNode.padding);
}
apf.layout.forceResize(this.parentNode.$int);
if (apf.hasFlexibleBox) {
if (this.$altExt)
this.$altExt.style.display = e.value
? apf.CSS_DISPLAY_FLEX
: "none";
return;
}
if (e.value) {
this.$ext.style.display = this.parentNode.$vbox
&& this.parentNode.align == "stretch" ? "block" : "inline-block";
if (this.$br)
this.$br.style.display = this.parentNode.align == "stretch" ? "none" : "";
}
else {
if (this.$br)
this.$br.style.display = "none";
}
this.parentNode.$resize();
}
function resizeHandler(){
if (!this.flex) {
if (this.$isRszHandling || this.$lastSizeChild &&
this.$lastSizeChild[0] == this.$ext.offsetWidth &&
this.$lastSizeChild[1] == this.$ext.offsetHeight)
return;
/*if (this.$skipResizeOnce)
delete this.$skipResizeOnce;
else*/
this.parentNode.$resize(true);
this.$lastSizeChild = [this.$ext.offsetWidth, this.$ext.offsetHeight];
}
}
var handlers = {
//Handlers for flexible box layout
"true" : {
"optimize" : function(value) {
this.optimize = apf.isTrue(value);
},
"width" : function(value) {
//@todo this should check the largest and only allow that one
//if (this.parentNode.$vbox && this.parentNode.align == "stretch")
//return;
(this.$altExt || this.$ext).style.width = !apf.isNot(value)
? (parseFloat(value) == value
? value + "px"
: value)
: "";
},
"height" : function(value) {
//@todo this should check the largest and only allow that one
//if (!this.parentNode.$vbox && this.parentNode.align == "stretch")
//return;
(this.$altExt || this.$ext).style.height = !apf.isNot(value)
? (parseFloat(value) == value
? value + "px"
: value)
: (apf.isGecko && this.flex && this.parentNode.$vbox ? "auto" : "");
},
"margin" : function(value) {
var b = apf.getBox(value);
if (!isLastVisibleChild(this))
b[this.parentNode.$vbox ? 2 : 1] += this.parentNode.padding;
this.$ext.style.margin = b.join("px ") + "px";
},
"flex" : function(value) {
this.flex = value = parseInt(value);
if (value) {
if (!this.optimize && !this.$altExt) {
this.$altExt = this.$ext.ownerDocument.createElement("div");
this.parentNode.$int.replaceChild(this.$altExt, this.$ext);
this.$altExt.appendChild(this.$ext);
this.$altExt.style.boxSizing = "border-box";
this.$altExt.style.display = apf.CSS_DISPLAY_FLEX;
this.$altExt.style[apf.CSSPREFIX + "BoxOrient"] = "vertical";
this.$ext.style[apf.CSS_FLEX_PROP] = 1;
var size = this.parentNode.$vbox ? "height" : "width";
//var osize = this.parentNode.$vbox ? "width" : "height";
if (!this.preventforcezero)
this.$altExt.style[size] = "0px";
}
(this.$altExt || this.$ext).style[apf.CSS_FLEX_PROP] = parseInt(value) || 1;
}
else if (this.$altExt) {
this.parentNode.$int.replaceChild(this.$ext, this.$altExt);
this.$ext.style[apf.CSS_FLEX_PROP] = "";
delete this.$altExt;
}
}
},
//Handlers for older browsers
"false" : {
"width" : function(value) {
//@todo this should check the largest and only allow that one
//if (this.parentNode.$vbox && this.parentNode.align == "stretch")
//return;
this.$ext.style.width = value
? (parseFloat(value) == value
? Math.max(0, value - apf.getWidthDiff(this.$ext)) + "px"
: value)
: "";
},
"height" : function(value) {
//@todo this should check the largest and only allow that one
//if (this.parentNode.localName == "hbox" && this.parentNode.align == "stretch")
//return;
this.$ext.style.height = value
? (parseFloat(value) == value
? Math.max(0, value - apf.getHeightDiff(this.$ext)) + "px"
: value)
: "";
},
"margin" : function(value) {
var b = apf.getBox(value);
if (this.padding) {
if (!isLastVisibleChild(this))
b[this.parentNode.$vbox ? 2 : 1] += this.padding;
if (this != this.parentNode.firstChild && this.parentNode.align == "stretch" && this.parentNode.$vbox) //@todo
b[0] += this.padding;
}
this.$ext.style.margin = b.join("px ") + "px";
},
"flex" : function(value) {
this.flex = parseInt(value);
if (this.$amlLoaded)
this.parentNode.$resize(true);
}
}
}
function isFirstVisibleChild(amlNode) {
var firstChild = amlNode.parentNode.firstChild;
while (firstChild && (firstChild.nodeFunc != apf.NODE_VISIBLE
|| firstChild.visible === false
|| firstChild.visible == 2 && apf.isFalse(firstChild.getAttribute("visible")))) {
firstChild = firstChild.nextSibling;
}
return firstChild && firstChild == amlNode;
}
function isLastVisibleChild(amlNode) {
var lastChild = amlNode.parentNode.lastChild;
while (lastChild && (lastChild.nodeFunc != apf.NODE_VISIBLE
|| lastChild.visible === false
|| lastChild.visible == 2 && apf.isFalse(lastChild.getAttribute("visible")))) {
lastChild = lastChild.previousSibling;
}
return lastChild && lastChild == amlNode;
}
//@todo move this to enableTable, disableTable
this.register = function(amlNode, insert) {
if (amlNode.$altExt) //@todo hack, need to re-arch layouting
return;
amlNode.$propHandlers["left"] =
amlNode.$propHandlers["top"] =
amlNode.$propHandlers["right"] =
amlNode.$propHandlers["bottom"] = apf.K;
var propHandlers = handlers[apf.hasFlexibleBox];
for (var prop in propHandlers) {
amlNode.$propHandlers[prop] = propHandlers[prop];
}
if (amlNode.nodeFunc == apf.NODE_VISIBLE) {
if (apf.hasFlexibleBox) {
//input elements are not handled correctly by firefox and webkit
if (amlNode.$ext.tagName == "INPUT" || input[amlNode.$ext.tagName]) {
var doc = amlNode.$ext.ownerDocument;
amlNode.$altExt = doc.createElement("div");
amlNode.parentNode.$int.replaceChild(amlNode.$altExt, amlNode.$ext);
amlNode.$altExt.style.boxSizing = "border-box";
amlNode.$altExt.appendChild(amlNode.$ext);
var d = apf.getDiff(amlNode.$ext);
//amlNode.$altExt.style.padding = "0 " + d[0] + "px " + d[1] + "px 0";
amlNode.$altExt.style.height = "100%";
amlNode.$altExt.style.width = "0";
amlNode.$altExt.style.lineHeight = 0;
amlNode.$altExt.style.margin = "-1px 0 0 0";
amlNode.$ext.style.width = "100%";
amlNode.$ext.style.height = "100%";
amlNode.$ext.style.top = "1px";
amlNode.$ext.style.position = "relative";
}
else {
if (apf.getStyle(amlNode.$ext, "display") == "inline")
amlNode.$ext.style.display = "block"; //@todo undo
//This is nice for positioning elements in the context of an hbox/vbox
//if (apf.getStyle(amlNode.$ext, "position") == "absolute")
//amlNode.$ext.style.position = "relative"; //@todo undo
}
amlNode.$ext.style.boxSizing = "border-box";
}
else {
if (this.$vbox) {
amlNode.$br = this.$int.insertBefore(amlNode.$ext.ownerDocument.createElement("br"), amlNode.$ext.nextSibling);
if (amlNode.visible === false)
amlNode.$br.style.display = "none";
}
else {
if (amlNode.visible !== false) {
amlNode.$ext.style.display = "inline-block";
}
this.$int.style.whiteSpace = "";
amlNode.$ext.style.whiteSpace = apf.getStyle(amlNode.$ext, "whiteSpace") || "normal";
this.$int.style.whiteSpace = "nowrap";
}
this.$int.style.fontSize = "0";
if (!amlNode.$box) {
var fontSize = apf.getStyle(amlNode.$ext, "fontSize");
if (fontSize == "0px") {
amlNode.$ext.style.fontSize = "";
var pNode = this.$int.parentNode;
while (apf.getStyle(pNode, "fontSize") == "0px") {
pNode = pNode.parentNode;
}
fontSize = apf.getStyle(pNode, "fontSize");
}
amlNode.$ext.style.fontSize = fontSize;//apf.getStyle(amlNode.$ext, "fontSize") || "normal";
}
amlNode.addEventListener("resize", resizeHandler);
}
amlNode.addEventListener("prop.visible", visibleHandler);
this.$noResize = true;
if (amlNode.height)
propHandlers.height.call(amlNode, amlNode.height);
if (amlNode.width)
propHandlers.width.call(amlNode, amlNode.width);
if (amlNode.margin)
propHandlers.margin.call(amlNode, amlNode.margin);
if (amlNode.flex)
propHandlers.flex.call(amlNode, amlNode.flex);
//Ie somehow sets the visible flags in between registration
var isLast = isLastVisibleChild(amlNode);
if (isLast || insert) {
this.$propHandlers["padding"].call(this, this.padding);
this.$propHandlers["align"].call(this, this.align);
if (!apf.hasFlexibleBox)
this.$propHandlers["pack"].call(this, this.pack);
if (amlNode.visible !== false) //insert && - removed because for new nodes that are being attached to the tree insert is not set
visibleHandler.call(amlNode, {value: true});
//@todo this needs more work
if (insert && amlNode.previousSibling) {
var prev = amlNode.previousSibling;
while (prev && (prev.nodeType != 1 || prev.localName == "splitter"))
prev = prev.previousSibling;
if (prev)
visibleHandler.call(prev, {value: true});
}
}
else if (this.splitters && !amlNode.$splitter && amlNode.visible !== false && !amlNode.nosplitter) {
if (amlNode.$ext.nextSibling != (amlNode.nextSibling
&& (amlNode.nextSibling.$altExt || amlNode.nextSibling.$ext))) {
var _self = this;
setTimeout(function(){
_self.insertBefore(
_self.ownerDocument.createElementNS(apf.ns.aml, "splitter"),
amlNode.nextSibling);
});
}
else {
this.insertBefore(
this.ownerDocument.createElementNS(apf.ns.aml, "splitter"),
amlNode.nextSibling);
}
}
delete this.$noResize;
if (!apf.hasFlexibleBox && isLast)
this.$resize();
}
}
this.unregister = function(amlNode) {
if (!amlNode.$propHandlers)
return;
amlNode.$propHandlers["left"] =
amlNode.$propHandlers["top"] =
amlNode.$propHandlers["right"] =
amlNode.$propHandlers["bottom"] = null;
var propHandlers = handlers[apf.hasFlexibleBox];
for (var prop in propHandlers) {
delete amlNode.$propHandlers[prop];
}
//Clear css properties and set layout
if (amlNode.nodeFunc == apf.NODE_VISIBLE) {
if (amlNode.flex) {
var flex = amlNode.flex;
propHandlers.flex.call(amlNode, 0);
amlNode.flex = flex;
}
if (apf.hasFlexibleBox) {
amlNode.$ext.style.boxSizing = "";
}
else {
amlNode.$ext.style.verticalAlign = "";
amlNode.$ext.style.textAlign = "";
amlNode.$ext.style.whiteSpace = "";
if (amlNode.$br) {
amlNode.$br.parentNode.removeChild(amlNode.$br);
delete amlNode.$br;
//amlNode.$ext.style.fontSize = "";
}
amlNode.removeEventListener("resize", resizeHandler);
}
amlNode.removeEventListener("prop.visible", visibleHandler);
amlNode.$ext.style.display = amlNode.visible ? "block" : "none";
if (amlNode.margin)
amlNode.$ext.style.margin = "";
if (amlNode.width)
amlNode.$ext.style.width = "";
if (this.splitters && !amlNode.$splitter) {
if (amlNode.nextSibling && amlNode.nextSibling.$splitter)
amlNode.nextSibling.removeNode();
if (isLastVisibleChild(amlNode) && amlNode.previousSibling
&& amlNode.previousSibling.$splitter)
amlNode.previousSibling.removeNode();
}
}
}
/*
this.addEventListener("DOMNodeInsertedIntoDocument", function(e) {
this.register(this.parentNode);
});
*/
// *** DOM Hooks *** //
this.addEventListener("DOMNodeRemoved", function(e) {
if (e.$doOnlyAdmin || e.currentTarget == this)
return;
if (e.relatedNode == this) {
this.unregister(e.currentTarget);
//e.currentTarget.$setLayout();
}
});
this.addEventListener("DOMNodeInserted", function(e) {
if (e.currentTarget == this) {
if (this.visible)
this.$ext.style.display = apf.CSS_DISPLAY_FLEX; //Webkit issue
return;
}
if (e.currentTarget.nodeType != 1
|| e.currentTarget.nodeFunc != apf.NODE_VISIBLE)
return;
if (e.relatedNode == this && !e.$isMoveWithinParent) {
e.currentTarget.$setLayout(this.localName, true);
if (e.currentTarget.$altExt) {
return false;
}
}
});
function myVisibleHandler(e) {
if (e.value)
this.$int.style.display = apf.CSS_DISPLAY_FLEX;
}
function myHeightHandler(e) {
clearInterval(this.$heighttimer);
if (e.value || this.align != "stretch") {
delete this.$heighttimer;
}
else if (!this.$heighttimer) {
var _self = this;
this.$heighttimer = $setInterval(function(){
if (_self.$amlDestroyed)
return;
var nodes = _self.childNodes;
for (var $int, i = 0, l = nodes.length; i < l; i++) {
if (!($int = (node = nodes[i]).$int || node.$container))
continue;
if (Math.min($int.scrollHeight, node["maxheight"] || 10000) > $int.offsetHeight)
return _self.$resize(true);
}
if (_self.flex)
clearInterval(this.$heighttimer);
}, this.flex ? 1 : 500);
}
}
this.$draw = function(){
var doc = this.$pHtmlNode.ownerDocument;
this.$ext = this.$pHtmlNode.appendChild(doc.createElement("div"));
if (this.getAttribute("style"))
this.$ext.setAttribute("style", this.getAttribute("style"));
this.$ext.className = this.localName;
this.$vbox = this.localName == "vbox";
this.$int = !apf.hasFlexibleBox && this.$vbox //@todo reparenting for gecko needs some admin work
? this.$ext.appendChild(doc.createElement("div"))
: this.$ext;
this.$ext.host = this;
if (!apf.hasFlexibleBox && this.$vbox) {
this.$int.style.display = "inline-block";
this.$int.style.width = "100%";
}
if (apf.hasFlex) {
this.$display = "-" + apf.CSSPREFIX +"-box";
this.$int.style.display = this.$int.style.display || apf.CSS_DISPLAY_FLEX;
this.$int.style.flexDirection = this.localName == "hbox" ? "" : "column";
this.$int.style.alignItems = "stretch";
this.addEventListener("prop.visible", myVisibleHandler);
}
else if (apf.hasFlexibleBox) {
this.$display = "-" + apf.CSSPREFIX +"-box";
this.$int.style.display = apf.CSS_DISPLAY_FLEX;
this.$int.style[apf.CSSPREFIX + "BoxOrient"] = this.localName == "hbox" ? "horizontal" : "vertical";
this.$int.style[apf.CSSPREFIX + "BoxAlign"] = "stretch";
this.addEventListener("prop.visible", myVisibleHandler);
}
else {
if (!this.$vbox) {
this.$int.style.whiteSpace = "nowrap";
this.addEventListener("prop.height", myHeightHandler);
}
var spacer = (!apf.hasFlexibleBox && this.$vbox ? this.$ext : this.$int)
.appendChild(doc.createElement("strong"));
spacer.style.height = "100%";
spacer.style.display = "inline-block";
//spacer.style.marginLeft = "-4px";
spacer.style.verticalAlign = "middle";
this.addEventListener("resize", this.$resize);
}
if (this.getAttribute("class"))
apf.setStyleClass(this.$ext, this.getAttribute("class"));
this.$originalMin = [this.minwidth || 0, this.minheight || 0];
};
this.$resize = function(force) {
if (!this.$amlLoaded || this.$noResize)
return;
//Protection for stretch re-resizing
if (force !== true && this.$lastSize &&
this.$lastSize[0] == this.$int.offsetWidth &&
this.$lastSize[1] == this.$int.offsetHeight)
return;
if (!apf.window.vManager.check(this, this.$uniqueId, this.$resize))
return;
this.$noResize = true;
this.$lastSize = [this.$int.offsetWidth, this.$int.offsetHeight];
//this.$ext.style.border = "1px solid " + (["red", "green", "blue", "orange", "pink", "yellow"])[Math.round(Math.random() * 5)];
/*if (this.$table.offsetWidth >= this.$ext.offsetWidth)
this.$ext.style.minWidth = (this.minwidth = Math.max(0, this.$table.offsetWidth
- apf.getWidthDiff(this.$ext))) + "px";
else {
this.$ext.style.minWidth = "";
this.minwidth = this.$originalMin[0];
}
if (this.$table.offsetHeight >= this.$ext.offsetHeight)
this.$ext.style.minHeight = (this.minheight = Math.max(0, this.$table.offsetHeight
- apf.getHeightDiff(this.$ext))) + "px";
else {
this.$ext.style.minHeight = "";
this.minheight = this.$originalMin[1];
}*/
//if (!this.$vbox) alert("here");
var total = 0;
var size = this.$vbox ? "width" : "height";
var minsize = this.$vbox ? "minWidth" : "minHeight";
var osize = this.$vbox ? "height" : "width";
var scroll = this.$vbox ? "scrollWidth" : "scrollHeight";
var offset = this.$vbox ? "offsetWidth" : "offsetHeight";
var ooffset = this.$vbox ? "offsetHeight" : "offsetWidth";
var getDiff = this.$vbox ? "getWidthDiff" : "getHeightDiff";
var ogetDiff = this.$vbox ? "getHeightDiff" : "getWidthDiff";
var inner = this.$vbox ? "getHtmlInnerWidth" : "getHtmlInnerHeight";
var oinner = this.$vbox ? "getHtmlInnerHeight" : "getHtmlInnerWidth";
var borders = this.$vbox ? "getVerBorders" : "getHorBorders";
var nodes = this.childNodes, hNodes = [], fW = 0, max = 0;
for (var node, i = 0; i < nodes.length; i++) {
if ((node = nodes[i]).nodeFunc != apf.NODE_VISIBLE || node.visible === false || !node.$amlLoaded)
continue;
hNodes.push(node);
if (!node[size]) {
//if (!node.$skipResizeOnce) node.$skipResizeOnce = 1;
//else node.$skipResizeOnce++;
//node.$skipResizeOnce = 1
//node.$ext.style[size] = ""; //@todo this is a sucky way of measuring
var m = node.margin && apf.getBox(node.margin);
if (m && this.$vbox) m.unshift();
var mdiff = (m ? m[0] + m[2] : 0);
max = Math.max(max, mdiff + Math.min(node.$ext[scroll] + apf[borders](node.$ext), node["max" + size] || 10000));
}
if (parseInt(node.flex))
total += parseFloat(node.flex);
else {
var m = node.margin && apf.getBox(node.margin);
if (m && !this.$vbox) m.shift();
fW += node.$ext[ooffset] + (m ? m[0] + m[2] : 0); //this.padding +
}
}
if (!max && this[size]) {
max = this[size]
//- (this.$vbox ? this.$edge[0] + this.$edge[2] : this.$edge[1] + this.$edge[3]);
- apf[ogetDiff](this.$ext);
}
/*
&& (this[size] || this.flex)
*/
if (this.align == "stretch") {
//var hasSize = this[size] || this.flex;
var l = hNodes.length;
var pH = max;//this.$int[offset] - apf[getDiff](this.$int);// - (2 * this.padding);
for (var i = 0; i < l; i++) {
node = hNodes[i];
if (!node[size] && !this.$vbox || this.$vbox && input[node.$ext.tagName]) {
var m = node.margin && apf.getBox(node.margin);
if (m && this.$vbox) m.unshift();
var mdiff = (m ? m[0] + m[2] : 0);
/*shouldClear = !this[size] && !this.flex && node.$ext.offsetHeight == (pH - mdiff);
if (shouldClear)
node.$ext.style[size] = "";
else
node.$ext.style[size] = Math.max(0, pH - apf[getDiff](node.$ext) - mdiff) + "px";
node.$setResizeHeight = !shouldClear;*/
//!this[size] && !this.flex
if (max && Math.min(node.$ext[scroll], node["max" + size] || 10000) != max)
node.$ext.style[size] = Math.max(0, max - apf[getDiff](node.$ext) - mdiff) + "px";
else
node.$ext.style[size] = "";
/*node.$ext.style[size] = !this[size] && !this.flex && node.$ext.offsetHeight == pH - mdiff
? ""
: Math.max(0, pH - apf[getDiff](node.$ext) - mdiff) + "px";*/
}
}
}
//Flexing
if (total > 0) {
if (this.$vbox)
this.$int.style.height = "100%";
this.$int.style.overflow = "hidden";
var splitterCount = this.$aml.querySelectorAll("splitter").length * 2;
var rW = this.$int[ooffset] - apf[ogetDiff](this.$int) - fW
- ((hNodes.length - 1 - splitterCount) * this.padding);// - (2 * this.edge);
var lW = rW, done = 0;
for (var i = 0, l = hNodes.length; i < l; i++) {
if ((node = hNodes[i]).flex) {
var v = (i % 2 == 0 ? Math.floor : Math.ceil)((rW / total) * parseInt(node.flex));
done += parseInt(node.flex);
var m = node.margin && apf.getBox(node.margin);
if (m && !this.$vbox) m.shift();
node.$ext.style[osize] = Math.max(0, (done == total ? lW : v) - apf[ogetDiff](node.$ext) - (m ? m[0] + m[2] : 0)) + "px";
lW -= v;
}
}
}
else {
if (this.$vbox)
this.$int.style.height = "";
this.$int.style.overflow = "";
}
this.$noResize = false;
/*this.$noResize = true;
var _self = this;
setTimeout(function(){
_self.$noResize = false;
});*/
}
this.$loadAml = function(x) {
if (this.padding == undefined)
this.padding = 0;
//this.$propHandlers.padding.call(this, this.padding = 0);
if (this.edge == undefined)
this.$propHandlers.edge.call(this, this.edge = 0);
if (this.pack == undefined)
this.$propHandlers.pack.call(this, this.edge = "start");
if (this.align == undefined)
this.align = "stretch";
//this.$propHandlers.align.call(this, this.align = "stretch");
if (!apf.hasFlexibleBox && !this.$vbox && !this.height && this.align == "stretch")
myHeightHandler.call(this, {});
};
}).call(apf.vbox.prototype = new apf.GuiElement());
apf.hbox.prototype = apf.vbox.prototype;
apf.aml.setElement("hbox", apf.hbox);
apf.aml.setElement("vbox", apf.vbox);
};
});

Wyświetl plik

@ -1,5 +1,5 @@
define(["require", "module", "exports", "./lib/menu/menu",
"./lib/page", "./lib/dropdown", "./lib/splitbox", "./lib/flexbox"],
define(["require", "module", "exports", "ui/menu/menu",
"ui/page", "ui/dropdown", "ui/splitbox", "ui/flexbox"],
function(require, module, exports) {
main.consumes = ["ext"];
main.provides = ["apf"]
@ -17034,10 +17034,10 @@ apf.config.$inheritProperties["validgroup"] = 1;
require("./lib/dropdown")(apf);
require("ui/dropdown")(apf);
require("./lib/splitbox")(apf);
require("ui/splitbox")(apf);
@ -37110,9 +37110,9 @@ apf.aml.setProcessingInstruction("livemarkup", apf.LiveMarkupPi);
require("./lib/menu/menu")(apf);
require("./lib/flexbox")(apf);
require("./lib/page")(apf);
require("ui/menu/menu")(apf);
require("ui/flexbox")(apf);
require("ui/page")(apf);

Wyświetl plik

@ -0,0 +1,283 @@
(function(global) {
"use strict";
var token = "";
var auth = global.auth = function(options) {
// can only be called once
global.auth = null;
var onLoad = options.onLoad;
var preload = options.preload || noop;
var authorized = options.authorized || noop;
var background = options.background || noop;
importCssString("html.fulliframe, body.fulliframe {\
overflow: hidden;\
margin: auto;\
height: 100%;\
width: 100%;\
}");
function noop(callback) { callback(); }
if (onLoad) {
auth.parallel([
background,
auth.serial([
auth.parallel([
preload,
login
]),
authorized,
])
])(done);
}
function login(callback, errback) {
var oauth = new Auth(options.clientId, options.authorizationUrl, options.loginHint);
oauth.authorize(true, function(err, _token) {
if (err)
return iframeLogin();
token = _token.access_token;
callback(null, token);
});
function iframeLogin() {
errback && errback();
oauth.authorize(false, function(err, _token) {
if (err) return callback(err);
token = _token.access_token;
callback(null, token);
});
}
return function cancel() {
oauth.cancel();
};
}
function done(err) {
onLoad(err, token);
}
return {
login: login
};
};
function bindScript(script) {
if (typeof script == "function")
return script;
else
return loadScript.bind(null, script, token);
}
auth.serial = function(list) {
return function(callback) {
serial(list.map(bindScript), callback);
};
};
auth.parallel = function(list) {
return function(callback) {
parallel(list.map(bindScript), callback);
};
};
function loadScript(path, token, callback) {
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
var s = document.createElement('script');
var and = path.indexOf("?") >= 0 ? "&" : "?";
s.src = path + (token ? and + "access_token=" + encodeURIComponent(token) : "");
head.appendChild(s);
s.onload = s.onreadystatechange = function(_, isAbort) {
if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
s = s.onload = s.onreadystatechange = null;
if (!isAbort)
callback();
}
};
}
// copied from ace/lib/dom
function importCssString(cssText) {
var style;
if (document.createStyleSheet) {
style = document.createStyleSheet();
style.cssText = cssText;
} else {
style = document.createElementNS
? document.createElementNS("http://www.w3.org/1999/xhtml", "style")
: document.createElement("style");
style.appendChild(document.createTextNode(cssText));
(document.head || document.getElementsByTagName("head")[0] || document.documentElement).appendChild(style);
}
}
function serial(handlers, callback) {
(function loop(i) {
if (i >= handlers.length) return callback();
handlers[i](function(err) {
if (err) return callback(err);
loop(i+1);
});
})(0);
}
function parallel(handlers, callback) {
var hadErr = false;
var count = 0;
handlers.forEach(function(handler) {
handler(function(err) {
if (hadErr) return;
if (err) {
hadErr = true;
return callback(err);
}
count += 1;
if (count == handlers.length)
return callback();
});
});
}
// install exactly one global listener
var listeners = {};
window.addEventListener("message", function(e) {
var token = e.data.token;
if (token) {
for (var url in listeners) {
if (url.indexOf(e.origin) === 0) {
var callback = listeners[url][token.state];
delete listeners[url][token.state];
if (callback) callback(null, token);
// make sure later listeners can't steal the token
e.data.token = null;
break;
}
}
}
}, true);
function Auth(clientId, authorizationUrl, loginHint) {
this.clientId = clientId;
this.authorizationUrl = authorizationUrl;
this.loginHint = loginHint;
listeners[authorizationUrl] = {};
}
Auth.prototype.authorize = function(immediate, callback) {
if (typeof immediate == "function")
return this.authorize({}, immediate);
immediate = immediate || false;
var that = this;
this.state = uid(15);
var url = this.authorizationUrl +
"?response_type=postmessage" +
"&client_id=" + encodeURIComponent(this.clientId) +
"&state=" + encodeURIComponent(this.state) +
"&style=overlay";
if (this.loginHint)
url += "&login_hint=" + encodeURIComponent(this.loginHint || "");
if (immediate)
url += "&immediate=1";
var frame = this._createFrame(url, immediate);
var timeout = immediate ? 3000 : 0;
if (timeout) {
var timer = setTimeout(function() {
that._unpoll();
callback(new Error("Login timed out"));
}, timeout);
}
this._removeFrame = function() {
clearTimeout(timer);
frame.parentNode.removeChild(frame);
document.documentElement.className = document.documentElement.className.replace(/\bfulliframe\b/, "");
document.body.className = document.body.className.replace(/\bfulliframe\b/, "");
that._removeFrame = null;
};
this._poll(function(err, token) {
if (that._removeFrame)
that._removeFrame();
if (err)
return callback(err);
if (token.error) {
err = new Error(token.error);
err.code = token.error_code;
return callback(err);
}
that.token = token;
return callback(null, token);
});
};
Auth.prototype.cancel = function() {
this._unpoll();
if (this._removeFrame)
this._removeFrame();
};
Auth.prototype._createFrame = function(url, hidden) {
var frame = document.createElement("iframe");
frame.setAttribute("src", url);
frame.setAttribute("frameborder", "0");
if (hidden) {
frame.style.width = "1000px";
frame.style.height = "1000px";
frame.style.left = "-10000px";
}
else {
frame.style.width = "100%";
frame.style.height = "100%";
frame.style.zIndex = "300000";
document.documentElement.className += " fulliframe";
document.body.className += " fulliframe";
}
frame.style.position = "absolute";
document.body.appendChild(frame);
return frame;
};
Auth.prototype._poll = function(callback) {
listeners[this.authorizationUrl][this.state] = callback;
};
Auth.prototype._unpoll = function() {
delete listeners[this.authorizationUrl][this.state];
};
function uid(length) {
var buf = new Uint8Array(new ArrayBuffer(length));
(window.crypto || window.msCrypto).getRandomValues(buf);
return btoa(Array.prototype.reduce.call(buf, function(s, c) {
return s + String.fromCharCode(c);
}, "")).slice(0, length);
}
})(this);

Wyświetl plik

@ -30,9 +30,8 @@ define(function(require, exports, module) {
var Plugin = imports.Plugin;
var auth = imports.auth;
var vfsEndpoint = imports["vfs.endpoint"];
var errorDialog = imports["dialog.error"];
var showError = errorDialog.show;
var hideError = errorDialog.hide;
var showError = imports["dialog.error"].show;
var hideError = imports["dialog.error"].hide;
var showAlert = imports["dialog.alert"].show;
var eio = require("engine.io");
@ -50,9 +49,6 @@ define(function(require, exports, module) {
var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter();
// Give reference to vfs to plugin
errorDialog.vfs = plugin;
var buffer = [];
var installChecked = false;
var withInstall = options.withInstall;
@ -334,22 +330,6 @@ define(function(require, exports, module) {
});
plugin.on("unload", function(){
loaded = false;
id = null;
buffer = [];
installChecked = false;
region = null;
vfsBaseUrl = null;
homeUrl = null;
projectUrl = null;
pingUrl = null;
serviceUrl = null;
eioOptions = null;
consumer = null;
vfs = null;
showErrorTimer = null;
showErrorTimerMessage = null;
lastError = null;
});
/***** Register and define API *****/

Wyświetl plik

@ -19,11 +19,9 @@ function Vfs(vfs, master, options) {
this.vfs = vfs;
this.master = master;
this.debug = options.debug || false;
this.logger = options.logger || {log: function(){}};
this.readonly = options.readonly || false;
this.public = options.public || false;
this.vfsOptions = options.vfsOptions || {};
this.pid = this.vfsOptions.pid;
var extendToken = options.extendToken;
this.homeDir = options.homeDir;
@ -169,12 +167,6 @@ Vfs.prototype._createEngine = function(vfs, options) {
that.socket.disconnect();
that.socket = socket;
socket.on('close', function (reason, description) {
var logMetadata = {collab: options.collab, reason: reason, description: description, id: that.id, sid: socket.id, pid: that.pid};
console.log("Socket closed", logMetadata);
logMetadata.message = "Socket closed";
that.logger.log(logMetadata);
});
var transport = new smith.EngineIoTransport(socket, true);
var worker = new VfsWorker(vfs);
@ -193,10 +185,7 @@ Vfs.prototype._createEngine = function(vfs, options) {
}
worker.on("disconnect", function() {
var logMetadata = {collab: options.collab, id: that.id, sid: socket.id, pid: that.pid};
console.log("VFS socket disconnect:", logMetadata);
logMetadata.message = "VFS socket disconnect";
that.logger.log(logMetadata);
console.log("VFS socket disconnect:", options.collab, that.id, socket.id);
if (options.collab) {
if (collabApi)
return disposeCollabClient();

Wyświetl plik

@ -1,80 +0,0 @@
#!/bin/bash -ex
cd `dirname $0`/..
SOURCE=`pwd`
uname="$(uname -a)"
os=
arch="$(uname -m)"
case "$uname" in
Linux\ *) os=linux ;;
Darwin\ *) os=darwin ;;
SunOS\ *) os=sunos ;;
FreeBSD\ *) os=freebsd ;;
CYGWIN*) os=windows ;;
MINGW*) os=windows ;;
esac
case "$uname" in
*x86_64*) arch=x64 ;;
*i*86*) arch=x86 ;;
*armv6l*) arch=arm-pi ;;
esac
if ! [[ -f ~/.c9/installed ]] && ! [[ $os == "windows" ]]; then
curl https://raw.githubusercontent.com/c9/install/master/install.sh | bash
fi
installC9Package() {
name=$1
REPO=https://github.com/c9/$name
echo "checking out $REPO"
if ! [[ -d ./plugins/$name ]]; then
mkdir -p ./plugins/$name
fi
pushd ./plugins/$name
if ! [[ -d .git ]]; then
git init
# git remote rm origin || true
git remote add origin $REPO
fi
version=`node -e 'console.log((require("../../package.json").c9plugins["'$name'"].substr(1) || "origin/master"))'`;
rev=`git rev-parse --revs-only $version`
if [ "$rev" == "" ]; then
git fetch origin
fi
status=`git status --porcelain --untracked-files=no`
if [ "$status" == "" ]; then
git reset $version --hard
else
echo "$name contains uncommited changes. Skipping..."
fi
popd
}
c9packages=(`node -e 'console.log(Object.keys(require("./package.json").c9plugins).join(" "))'`);
count=${#c9packages[@]}
i=0
for m in ${c9packages[@]}; do echo $m;
i=$(($i + 1))
echo "updating plugin $i of $count"
installC9Package $m || true
done
# deps=`node -e 'console.log(Object.keys(require("./package.json").dependencies).join(" "))'`;
# for m in $deps; do echo $m;
# npm install $m || true
# done
npm install || true
echo "Success!"
echo "run 'node server.js -p 8181 -l 0.0.0.0' to launch Cloud9"