Stackedit/js/main.js

64 lines
1.6 KiB
JavaScript
Raw Normal View History

2013-04-05 17:44:10 +00:00
// RequireJS configuration
2013-04-02 18:42:47 +00:00
requirejs.config({
2013-04-07 15:22:13 +00:00
waitSeconds: 0,
2013-05-13 23:26:55 +00:00
paths: {
2013-05-27 19:45:33 +00:00
"jquery": "lib/jquery",
"underscore": "lib/underscore",
"jgrowl": "lib/jgrowl",
"lib/MathJax": '../lib/MathJax/MathJax.js?config=TeX-AMS_HTML'
2013-05-13 23:26:55 +00:00
},
2013-04-02 18:42:47 +00:00
shim: {
2013-05-27 22:13:41 +00:00
'underscore': {
2013-05-27 19:45:33 +00:00
exports: '_'
},
2013-05-27 22:13:41 +00:00
'jgrowl': {
deps: ['jquery'],
2013-05-27 19:45:33 +00:00
exports: 'jQuery.jGrowl'
},
2013-05-27 22:13:41 +00:00
'lib/jquery-ui': ['jquery'],
'lib/bootstrap': ['jquery'],
2013-05-27 19:45:33 +00:00
'lib/layout': ['lib/jquery-ui'],
'lib/Markdown.Extra': ['lib/Markdown.Converter', 'lib/prettify'],
'lib/Markdown.Editor': ['lib/Markdown.Converter']
2013-04-02 18:42:47 +00:00
}
});
2013-04-05 17:44:10 +00:00
2013-05-28 23:41:09 +00:00
// Defines the logger object
var logger = {
debug: function() {},
log: function() {},
info: function() {},
warn: function() {},
error: function() {}
};
// Use http://.../?console to print logs in the console
if (location.search.indexOf("console") !== -1) {
logger = console;
}
// RequireJS entry point. By requiring synchronizer and publisher, we are actually loading all the modules
2013-05-27 19:45:33 +00:00
require([
"jquery",
"core",
"synchronizer",
"publisher"
], function($, core) {
2013-03-24 19:42:15 +00:00
$(function() {
2013-05-28 23:41:09 +00:00
2013-04-10 18:14:59 +00:00
// If browser has detected a new application cache.
2013-04-14 21:21:49 +00:00
if (window.applicationCache) {
window.applicationCache.addEventListener('updateready', function(e) {
if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
window.applicationCache.swapCache();
window.location.reload();
}
}, false);
}
2013-05-27 19:45:33 +00:00
2013-05-28 23:41:09 +00:00
// Here, all the modules are loaded and the DOM is ready
2013-05-27 19:45:33 +00:00
core.setReady();
2013-03-24 19:42:15 +00:00
});
2013-05-27 19:45:33 +00:00
2013-04-02 18:42:47 +00:00
});