Commit 059580ec authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

Move Crib Loader out of the homepage

parent 635b83cd
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>CribJS Header</title>
<!-- renderjs -->
<script src="../lib/rsvp.js" type="text/javascript"></script>
<script src="../lib/renderjs.js" type="text/javascript"></script>
<script src="../lib/jszip.js" type="text/javascript"></script>
<script src="../lib/mimetype.js" type="text/javascript"></script>
<script src="../lib/webtorrent.min.js" type="text/javascript"></script>
<script src="./gadget_global.js" type="text/javascript"></script>
<!-- Custom -->
<script src="./gadget_cribjs_page_crib_loader.js" type="text/javascript"></script>
</head>
<body>
<div class="nav_content save_load container">
<div class="nav_content container">
<h1>CribJS Loader</h1>
<p>Load your Crib from here</p>
</div>
<div data-gadget-url="./gadget_zip_loader.html"
data-gadget-scope="zip_loader"
data-gadget-sandbox="public"></div>
</div>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, console */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS) {
"use strict";
rJS(window)
.ready(function (g) {
g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.start_deferred = RSVP.defer();
});
})
//////////////////////////////////////////////
// acquired methods
//////////////////////////////////////////////
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.allowPublicAcquisition("getUrlFor", function (argument_list) {
return this.getUrlFor(argument_list[0]);
})
.declareAcquiredMethod("crib_sw_get", "crib_sw_get")
.allowPublicAcquisition("crib_sw_get", function (argument_list) {
return this.crib_sw_get(argument_list[0]);
})
.declareAcquiredMethod("crib_sw_put", "crib_sw_put")
.allowPublicAcquisition("crib_sw_put", function (argument_list) {
return this.crib_sw_put(argument_list[0], argument_list[1]);
})
.declareMethod('render', function (options) {
var gadget = this;
if (options === undefined)
options = {};
gadget.props.options = options;
return new RSVP.Queue()
.push(function () {
return gadget.props.start_deferred.resolve();
})
.push(function () {
return gadget.getDeclaredGadget("zip_loader");
})
.push(function (zip_loader) {
return zip_loader.render();
});
});
}(window, rJS));
\ No newline at end of file
......@@ -32,13 +32,6 @@
data-gadget-scope="app_list"
data-gadget-sandbox="public"></div>
</div>
<div class="nav_content container">
<h1>CribJS Loader</h1>
<p>Load your Crib from here</p>
</div>
<div data-gadget-url="./gadget_zip_loader.html"
data-gadget-scope="zip_loader"
data-gadget-sandbox="public"></div>
<div class="nav_content container">
<h2>Start Editing this Site In another Crib</h2>
<a class="edit-url btn btn-primary" type="text" size="60" href="">Start Editing This Site Now</a>
......
......@@ -53,7 +53,6 @@
encodeURIComponent(edit_base + "#page=editor&url=" +
"index.html" + "&crib_enable_url=" + site + "/crib-enable.html");
gadget.props.element.querySelector("a.edit-url").href = edit_url;
// Handle main title
return new RSVP.Queue()
.push(function () {
return gadget.getUrlFor({
......@@ -64,14 +63,12 @@
.push(function (link) {
gadget.props.element.querySelector(".edit-this").href = link;
return RSVP.all([
gadget.getDeclaredGadget("app_list"),
gadget.getDeclaredGadget("zip_loader")
gadget.getDeclaredGadget("app_list")
]);
})
.push(function (gadget_list) {
return RSVP.all([
gadget_list[0].render(),
gadget_list[1].render()
gadget_list[0].render()
]);
})
.push(function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment