Stackedit/js/main.js

90 lines
2.2 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-06-02 00:38:23 +00:00
waitSeconds: 0,
paths: {
"jquery": "libs/jquery",
"underscore": "libs/underscore",
"jgrowl": "libs/jgrowl",
"libs/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-06-02 00:38:23 +00:00
'underscore': {
2013-05-27 19:45:33 +00:00
exports: '_'
},
2013-05-27 22:13:41 +00:00
'jgrowl': {
2013-06-02 00:38:23 +00:00
deps: [
'jquery'
],
2013-05-27 19:45:33 +00:00
exports: 'jQuery.jGrowl'
},
2013-06-02 00:38:23 +00:00
'libs/jquery-ui': [
'jquery'
],
'libs/bootstrap': [
'jquery'
],
'libs/jquery.waitforimages': [
'jquery'
],
2013-06-03 22:19:52 +00:00
'libs/jquery.mousewheel': [
'jquery'
],
2013-06-02 00:38:23 +00:00
'libs/layout': [
'libs/jquery-ui'
],
'libs/Markdown.Extra': [
'libs/Markdown.Converter',
'libs/prettify'
],
'libs/Markdown.Editor': [
'libs/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 = {
2013-06-02 00:38:23 +00:00
debug: function() {
},
log: function() {
},
info: function() {
},
warn: function() {
},
error: function() {
}
2013-05-28 23:41:09 +00:00
};
2013-06-02 00:38:23 +00:00
// We can run StackEdit with http://.../?console to print logs in the console
if(location.search.match(/(\?|&)console/)) {
logger = console;
2013-05-28 23:41:09 +00:00
}
2013-06-02 00:38:23 +00:00
// RequireJS entry point. By requiring synchronizer, publisher and
// media-importer, we are actually loading all the modules
2013-05-27 19:45:33 +00:00
require([
2013-06-02 00:38:23 +00:00
"jquery",
"core",
"synchronizer",
"publisher",
"media-importer"
2013-05-27 19:45:33 +00:00
], function($, core) {
2013-06-02 00:38:23 +00:00
$(function() {
// If browser has detected a new application cache.
if(window.applicationCache) {
window.applicationCache.addEventListener('updateready', function(e) {
if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
window.applicationCache.swapCache();
window.location.reload();
}
}, false);
}
// Here, all the modules are loaded and the DOM is ready
core.setReady();
});
2013-04-02 18:42:47 +00:00
});