forked from meemoo/meemooapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
188 lines (173 loc) · 6.25 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE html>
<html>
<!-- <html manifest="iframework.appcache"> -->
<head>
<meta charset="utf-8" />
<title>meemoo/iframework: hackable web apps</title>
</head>
<body>
<footer style="font-size: 10px; font-family: Monaco, monospace;">
<span id="debug-info"></span>
<a href="http://meemoo.org/" target="_blank">meemoo</a> »
<a href="https://github.com/meemoo/iframework" target="_blank">source</a>
<span id="iframework-info"></span>
<noscript>» This web app uses JavaScript (and plenty of it).</noscript>
</footer>
<script src="libs/yepnope.min.js"></script>
<script type="text/javascript">
(function(){
"use strict";
// This tests to see if the browser can do data clone for postMessage
// We'll assume that if it can do that it can handle the rest
// Adapted from http://thecssninja.com/demo/sclones/
if(!!window.postMessage) {
try {
// Safari 5.1 will sometimes throw an exception and sometimes won't, lolwut?
// When it doesn't we capture the message event and check the
// internal [[Class]] property of the message being passed through.
// Safari will pass through DOM nodes as Null, gotcha.
window.onmessage = function(e){
var safariCompatible = Object.prototype.toString.call(e.data).indexOf("Null") !== -1 ? true : false;
if (!window.Iframework) {
meemooInitialize(safariCompatible);
}
// Only keep the onmessage function for the one test
window.onmessage = null;
};
// Spec states you can't transmit DOM nodes and it will throw an error
// postMessage implimentations that support cloned data will throw.
window.postMessage(document.createElement("a"),"*");
} catch(e) {
var validCompatible = e.DATA_CLONE_ERR ? true : false;
meemooInitialize(validCompatible);
}
} else {
meemooInitialize(false);
}
function meemooInitialize(compatible) {
if (window.Iframework){
// Already initialized
return false;
}
if (!compatible) {
document.getElementById("iframework-info").innerHTML = "» You need a modern browser to run this. ";
document.getElementById("iframework-info").innerHTML += '<a href="#" onclick="_meemooInitialize(true);return false;">Try anyway?</a>';
window._meemooInitialize = meemooInitialize;
return false;
}
document.getElementById("iframework-info").innerHTML = "» 1/2: Loading libraries...";
/*
* Remeber to debug with ?DEBUG
*/
var debug = (window.location.search && window.location.search === "?DEBUG");
/*
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
var debugLibs = [
// Libs
'libs/jquery.js',
'libs/jquery-ui/jquery-ui.js',
// CSS
'libs/jquery-ui/jquery-ui.css',
'http://fonts.googleapis.com/css?family=Nova+Flat&.css',
'iframework.css'
];
var buildLibs = [
// Libs
'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js',
// CSS
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css',
'http://fonts.googleapis.com/css?family=Nova+Flat&.css',
'iframework.css'
];
var debugFiles = [
// Libs
'libs/jquery.hotkeys.js',
'libs/underscore.js',
'libs/backbone.js',
'libs/backbone.localStorage.js',
// Iframework
'src/iframework.js',
'src/eventshistory.js',
'src/local-app.js',
'src/local-app-view.js',
'src/graph.js',
'src/graph-view.js',
'src/node.js',
'src/node-view.js',
'src/node-box.js',
'src/node-box-view.js',
'src/node-box-iframe.js',
'src/node-box-iframe-view.js',
'src/port.js',
'src/port-view.js',
'src/module.js',
'src/module-view.js',
'src/edge.js',
'src/edge-view.js',
'src/router.js',
// native nodes
// 'src/nodes/image.js',
// 'src/nodes/image/combine.js',
// load examples
'src/examples/module-library.js',
'src/examples/apps.js'
];
var buildFiles = [
// Iframework
'build/meemoo-iframework.min.js',
// load examples
'src/examples/module-library.js',
'src/examples/apps.js'
];
if (debug) {
document.getElementById("debug-info").innerHTML = "DEBUG » ";
}
yepnope([
{
// Try the CDN stuff first
load: (debug ? debugLibs : buildLibs),
complete: function(){
if (!window.jQuery) {
// CDN offline?
yepnope("libs/jquery.js");
yepnope("libs/jquery-ui/jquery-ui.js");
yepnope("libs/jquery-ui/jquery-ui.css");
}
document.getElementById("iframework-info").innerHTML = "» 2/2: Loading Meemoo...";
}
},
{
// Load all of the src/ files, or just the minified one
load: (debug ? debugFiles : buildFiles),
complete: function(){
// All loaded
if (window.Iframework) {
document.getElementById("iframework-info").innerHTML = "» Loaded!";
window.setTimeout(function(){
document.getElementById("iframework-info").innerHTML = "";
}, 1500);
// Start
Iframework.allLoaded();
} else {
document.getElementById("iframework-info").innerHTML = "» Something didn't work (;_;)";
}
}
}
]);
}
})();
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-274009-19']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>