Beta release

This commit is contained in:
benweet 2014-04-27 21:10:30 +01:00
parent dcbd1c6ad5
commit 3c384739ee
12 changed files with 4505 additions and 6283 deletions

View File

@ -25,7 +25,7 @@ module.exports = function(grunt) {
'public/res-min/**/*.js' 'public/res-min/**/*.js'
] ]
}, },
client: ['public/**/*.js'], client: ['public/**/*.js']
}, },
requirejs: { requirejs: {
compile: { compile: {
@ -40,7 +40,7 @@ module.exports = function(grunt) {
'css/css-builder', 'css/css-builder',
'less/lessc-server', 'less/lessc-server',
'less/lessc' 'less/lessc'
], ]
} }
} }
}, },
@ -50,14 +50,14 @@ module.exports = function(grunt) {
js: { js: {
space_before_conditional: false, space_before_conditional: false,
keep_array_indentation: true, keep_array_indentation: true,
indentWithTabs: true, indentWithTabs: true
} }
} }
}, },
less: { less: {
compile: { compile: {
options: { options: {
compress: true, compress: true
}, },
files: [ files: [
{ {
@ -67,14 +67,14 @@ module.exports = function(grunt) {
'*.less' '*.less'
], ],
dest: 'public/res-min/themes', dest: 'public/res-min/themes',
ext: '.css', ext: '.css'
}, },
{ {
src: 'public/res/styles/base.less', src: 'public/res/styles/base.less',
dest: 'public/res-min/themes/base.css', dest: 'public/res-min/themes/base.css'
} }
], ]
}, }
}, },
'string-replace': { 'string-replace': {
'constants': { 'constants': {
@ -86,7 +86,7 @@ module.exports = function(grunt) {
{ {
pattern: /constants\.VERSION = .*/, pattern: /constants\.VERSION = .*/,
replacement: 'constants.VERSION = "<%= pkg.version %>";' replacement: 'constants.VERSION = "<%= pkg.version %>";'
}, }
] ]
} }
}, },
@ -103,10 +103,10 @@ module.exports = function(grunt) {
{ {
pattern: /(#DynamicResourcesBegin\n)[\s\S]*(\n#DynamicResourcesEnd)/, pattern: /(#DynamicResourcesBegin\n)[\s\S]*(\n#DynamicResourcesEnd)/,
replacement: '$1<%= resources %>$2' replacement: '$1<%= resources %>$2'
}, }
] ]
} }
}, }
}, },
copy: { copy: {
resources: { resources: {
@ -137,7 +137,7 @@ module.exports = function(grunt) {
'require.js' 'require.js'
], ],
dest: 'public/res-min/' dest: 'public/res-min/'
}, }
] ]
} }
}, },
@ -161,7 +161,7 @@ module.exports = function(grunt) {
], ],
pushTo: 'origin' pushTo: 'origin'
} }
}, }
}); });
/*************************************************************************** /***************************************************************************

View File

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
#Date Sun Apr 27 2014 13:44:57 #Date Sun Apr 27 2014 21:00:22
CACHE: CACHE:
libs/MathJax/MathJax.js?config=TeX-AMS_HTML libs/MathJax/MathJax.js?config=TeX-AMS_HTML

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,7 @@ define([
"extensions/workingIndicator", "extensions/workingIndicator",
"extensions/notifications", "extensions/notifications",
"extensions/markdownExtra", "extensions/markdownExtra",
"extensions/umlDiagrams",
"extensions/toc", "extensions/toc",
"extensions/mathJax", "extensions/mathJax",
"extensions/emailConverter", "extensions/emailConverter",

View File

@ -9,11 +9,8 @@ define([
'google-code-prettify', 'google-code-prettify',
'highlightjs', 'highlightjs',
'crel', 'crel',
'sequence-diagram',
'flow-chart',
'text!html/tooltipMarkdownExtraDiagrams.html',
'pagedown-extra' 'pagedown-extra'
], function($, _, utils, logger, Extension, markdownExtraSettingsBlockHTML, prettify, hljs, crel, sequenceDiagram, flowChart, tooltipMarkdownExtraDiagramsHTML) { ], function($, _, utils, logger, Extension, markdownExtraSettingsBlockHTML, prettify, hljs) {
var markdownExtra = new Extension("markdownExtra", "Markdown Extra", true); var markdownExtra = new Extension("markdownExtra", "Markdown Extra", true);
markdownExtra.settingsBlock = markdownExtraSettingsBlockHTML; markdownExtra.settingsBlock = markdownExtraSettingsBlockHTML;
@ -78,83 +75,15 @@ define([
var previewContentsElt; var previewContentsElt;
markdownExtra.onReady = function() { markdownExtra.onReady = function() {
previewContentsElt = document.getElementById('preview-contents'); previewContentsElt = document.getElementById('preview-contents');
utils.createTooltip(".tooltip-markdown-extra-diagrams", tooltipMarkdownExtraDiagramsHTML);
};
var onAsyncPreview = function(cb) {
cb();
};
markdownExtra.onAsyncPreview = function(cb) {
onAsyncPreview(cb);
};
var extraOptions;
markdownExtra.onInit = function() {
var sequenceDiagramEltList, flowChartEltList;
extraOptions = {
extensions: markdownExtra.config.extensions
};
function doSequenceDiagram(cb) {
if(sequenceDiagramEltList.length === 0) {
return cb();
}
var sequenceDiagramElt = sequenceDiagramEltList.pop();
try {
var diagram = sequenceDiagram.parse(sequenceDiagramElt.textContent);
var preElt = sequenceDiagramElt.parentNode;
var containerElt = crel('div', {
class: 'sequence-diagram'
});
preElt.parentNode.replaceChild(containerElt, preElt);
diagram.drawSVG(containerElt, {
theme: 'simple'
});
}
catch(e) {
}
_.delay(doSequenceDiagram, 0, cb);
}
function doFlowChart(cb) {
if(flowChartEltList.length === 0) {
return cb();
}
var flowChartElt = flowChartEltList.pop();
try {
var chart = flowChart.parse(flowChartElt.textContent);
var preElt = flowChartElt.parentNode;
var containerElt = crel('div', {
class: 'flow-chart'
});
preElt.parentNode.replaceChild(containerElt, preElt);
chart.drawSVG(containerElt, {
'line-width': 2
});
}
catch(e) {
}
_.delay(doFlowChart, 0, cb);
}
if(markdownExtra.config.diagrams) {
extraOptions.highlighter = "prettify";
var afterDiagrams = onAsyncPreview;
onAsyncPreview = function(cb) {
sequenceDiagramEltList = Array.prototype.slice.call(previewContentsElt.querySelectorAll('.prettyprint > .language-sequence'));
flowChartEltList = Array.prototype.slice.call(previewContentsElt.querySelectorAll('.prettyprint > .language-flow'));
_.delay(doSequenceDiagram, 0, function() {
_.delay(doFlowChart, 0, function() {
afterDiagrams(cb);
});
});
};
}
}; };
markdownExtra.onPagedownConfigure = function(editor) { markdownExtra.onPagedownConfigure = function(editor) {
var converter = editor.getConverter(); var converter = editor.getConverter();
var extraOptions = {
extensions: markdownExtra.config.extensions,
highlighter: "prettify"
};
if(markdownExtra.config.intraword === true) { if(markdownExtra.config.intraword === true) {
var converterOptions = { var converterOptions = {
_DoItalicsAndBold: function(text) { _DoItalicsAndBold: function(text) {
@ -173,7 +102,6 @@ define([
}); });
} }
if(markdownExtra.config.highlighter == "highlight") { if(markdownExtra.config.highlighter == "highlight") {
extraOptions.highlighter = "prettify";
var previewContentsElt = document.getElementById('preview-contents'); var previewContentsElt = document.getElementById('preview-contents');
editor.hooks.chain("onPreviewRefresh", function() { editor.hooks.chain("onPreviewRefresh", function() {
_.each(previewContentsElt.querySelectorAll('.prettyprint > code'), function(elt) { _.each(previewContentsElt.querySelectorAll('.prettyprint > code'), function(elt) {
@ -183,7 +111,6 @@ define([
}); });
} }
else if(markdownExtra.config.highlighter == "prettify") { else if(markdownExtra.config.highlighter == "prettify") {
extraOptions.highlighter = "prettify";
editor.hooks.chain("onPreviewRefresh", prettify.prettyPrint); editor.hooks.chain("onPreviewRefresh", prettify.prettyPrint);
} }
Markdown.Extra.init(converter, extraOptions); Markdown.Extra.init(converter, extraOptions);

View File

@ -3,7 +3,7 @@ define([
"utils", "utils",
"classes/Extension", "classes/Extension",
"text!html/mathJaxSettingsBlock.html", "text!html/mathJaxSettingsBlock.html",
"mathjax", "mathjax"
], function(utils, Extension, mathJaxSettingsBlockHTML) { ], function(utils, Extension, mathJaxSettingsBlockHTML) {
var mathJax = new Extension("mathJax", "MathJax", true); var mathJax = new Extension("mathJax", "MathJax", true);

View File

@ -0,0 +1,91 @@
define([
"jquery",
"underscore",
"utils",
"logger",
"classes/Extension",
"text!html/umlDiagramsSettingsBlock.html",
'crel',
'sequence-diagram',
'flow-chart'
], function($, _, utils, logger, Extension, umlDiagramsSettingsBlockHTML, crel, sequenceDiagram, flowChart) {
var umlDiagrams = new Extension("umlDiagrams", "UML Diagrams", true);
umlDiagrams.settingsBlock = umlDiagramsSettingsBlockHTML;
var eventMgr;
umlDiagrams.onEventMgrCreated = function(eventMgrParameter) {
eventMgr = eventMgrParameter;
};
var previewContentsElt;
umlDiagrams.onReady = function() {
previewContentsElt = document.getElementById('preview-contents');
};
var onAsyncPreview = function(cb) {
cb();
};
umlDiagrams.onAsyncPreview = function(cb) {
onAsyncPreview(cb);
};
umlDiagrams.onInit = function() {
var sequenceDiagramEltList, flowChartEltList;
function doSequenceDiagram(cb) {
if(sequenceDiagramEltList.length === 0) {
return cb();
}
var sequenceDiagramElt = sequenceDiagramEltList.pop();
try {
var diagram = sequenceDiagram.parse(sequenceDiagramElt.textContent);
var preElt = sequenceDiagramElt.parentNode;
var containerElt = crel('div', {
class: 'sequence-diagram'
});
preElt.parentNode.replaceChild(containerElt, preElt);
diagram.drawSVG(containerElt, {
theme: 'simple'
});
}
catch(e) {
}
_.delay(doSequenceDiagram, 0, cb);
}
function doFlowChart(cb) {
if(flowChartEltList.length === 0) {
return cb();
}
var flowChartElt = flowChartEltList.pop();
try {
var chart = flowChart.parse(flowChartElt.textContent);
var preElt = flowChartElt.parentNode;
var containerElt = crel('div', {
class: 'flow-chart'
});
preElt.parentNode.replaceChild(containerElt, preElt);
chart.drawSVG(containerElt, {
'line-width': 2
});
}
catch(e) {
}
_.delay(doFlowChart, 0, cb);
}
var afterDiagrams = onAsyncPreview;
onAsyncPreview = function(cb) {
sequenceDiagramEltList = Array.prototype.slice.call(previewContentsElt.querySelectorAll('.prettyprint > .language-sequence'));
flowChartEltList = Array.prototype.slice.call(previewContentsElt.querySelectorAll('.prettyprint > .language-flow'));
_.delay(doSequenceDiagram, 0, function() {
_.delay(doFlowChart, 0, function() {
afterDiagrams(cb);
});
});
};
};
return umlDiagrams;
});

View File

@ -1,23 +0,0 @@
You can create sequence diagrams like this:
<br />
<br />
```sequence<br />
Alice-&gt;Bob: Hello Bob, how are you?
Bob--&gt;Alice: I am good thanks!
```<br />
<a target="_blank" href="http://bramp.github.io/js-sequence-diagrams/">More info</a>
<br />
<br />
Or flow charts like this:
<br />
<br />
```flow<br />
st=&gt;start: Start<br />
e=&gt;end<br />
op=&gt;operation: My Operation<br />
cond=&gt;condition: Yes or No?<br />
st-&gt;op-&gt;cond<br />
cond(yes)-&gt;e<br />
cond(no)-&gt;op<br />
```<br />
<a target="_blank" href="http://adrai.github.io/flowchart.js/">More info</a>

View File

@ -0,0 +1,24 @@
<p>Creates UML diagrams from plain text description.</p>
<p>Sequence diagrams:</p>
<pre><div class="help-block pull-right"><a target="_blank" href="http://bramp.github.io/js-sequence-diagrams/">More info</a></div><code>```sequence
Alice->Bob: Hello Bob, how are you?
Bob-->Alice: I am good thanks!
```</code>
</pre>
<p>Flow charts:</p>
<pre><div class="help-block pull-right"><a target="_blank" href="http://adrai.github.io/flowchart.js/">More info</a></div><code>```flow
st=>start: Start
e=>end
op=>operation: My Operation
cond=>condition: Yes or No?
st->op->cond
cond(yes)->e
cond(no)->op
```</code>
</pre>
<blockquote>
<b>Note:</b> Markdown Extra extension has to be enabled with GFM fenced code blocks option.
</blockquote>

View File

@ -1,4 +1,5 @@
MathJax.Hub.Config({ MathJax.Hub.Config({
skipStartupTypeset: true,
"HTML-CSS": { "HTML-CSS": {
preferredFont: "TeX", preferredFont: "TeX",
availableFonts: [ availableFonts: [

View File

@ -0,0 +1,11 @@
// Hack to make js-sequence-diagram AMD friendly
define([
'text!bower-libs/js-sequence-diagrams/build/sequence-diagram-min.js',
'raphael',
'underscore'
], function(sequenceDiagramMinJS) {
/*jshint evil: true */
eval(sequenceDiagramMinJS);
return window.Diagram;
});

View File

@ -1,181 +1,176 @@
// RequireJS configuration // RequireJS configuration
/*global requirejs */ /*global requirejs */
requirejs.config({ requirejs.config({
waitSeconds: 0, waitSeconds: 0,
packages: [ packages: [
{ {
name: 'css', name: 'css',
location: 'bower-libs/require-css', location: 'bower-libs/require-css',
main: 'css' main: 'css'
}, },
{ {
name: 'less', name: 'less',
location: 'bower-libs/require-less', location: 'bower-libs/require-less',
main: 'less' main: 'less'
} }
], ],
paths: { paths: {
jquery: 'bower-libs/jquery/jquery', jquery: 'bower-libs/jquery/jquery',
underscore: 'bower-libs/underscore/underscore', underscore: 'bower-libs/underscore/underscore',
crel: 'bower-libs/crel/crel', crel: 'bower-libs/crel/crel',
jgrowl: 'bower-libs/jgrowl/jquery.jgrowl', jgrowl: 'bower-libs/jgrowl/jquery.jgrowl',
mousetrap: 'bower-libs/mousetrap/mousetrap', mousetrap: 'bower-libs/mousetrap/mousetrap',
'mousetrap-record': 'bower-libs/mousetrap/plugins/record/mousetrap-record', 'mousetrap-record': 'bower-libs/mousetrap/plugins/record/mousetrap-record',
toMarkdown: 'bower-libs/to-markdown/src/to-markdown', toMarkdown: 'bower-libs/to-markdown/src/to-markdown',
text: 'bower-libs/requirejs-text/text', text: 'bower-libs/requirejs-text/text',
mathjax: '../libs/MathJax/MathJax.js?config=TeX-AMS_HTML', mathjax: '../libs/MathJax/MathJax.js?config=TeX-AMS_HTML',
bootstrap: 'bower-libs/bootstrap/dist/js/bootstrap', bootstrap: 'bower-libs/bootstrap/dist/js/bootstrap',
requirejs: 'bower-libs/requirejs/require', requirejs: 'bower-libs/requirejs/require',
'google-code-prettify': 'bower-libs/google-code-prettify/src/prettify', 'google-code-prettify': 'bower-libs/google-code-prettify/src/prettify',
highlightjs: 'libs/highlight/highlight.pack', highlightjs: 'libs/highlight/highlight.pack',
'jquery-waitforimages': 'bower-libs/waitForImages/src/jquery.waitforimages', 'jquery-waitforimages': 'bower-libs/waitForImages/src/jquery.waitforimages',
'jquery-ui': 'bower-libs/jquery-ui/ui/jquery-ui', 'jquery-ui': 'bower-libs/jquery-ui/ui/jquery-ui',
'jquery-ui-core': 'bower-libs/jquery-ui/ui/jquery.ui.core', 'jquery-ui-core': 'bower-libs/jquery-ui/ui/jquery.ui.core',
'jquery-ui-widget': 'bower-libs/jquery-ui/ui/jquery.ui.widget', 'jquery-ui-widget': 'bower-libs/jquery-ui/ui/jquery.ui.widget',
'jquery-ui-mouse': 'bower-libs/jquery-ui/ui/jquery.ui.mouse', 'jquery-ui-mouse': 'bower-libs/jquery-ui/ui/jquery.ui.mouse',
'jquery-ui-draggable': 'bower-libs/jquery-ui/ui/jquery.ui.draggable', 'jquery-ui-draggable': 'bower-libs/jquery-ui/ui/jquery.ui.draggable',
'jquery-ui-effect': 'bower-libs/jquery-ui/ui/jquery.ui.effect', 'jquery-ui-effect': 'bower-libs/jquery-ui/ui/jquery.ui.effect',
'jquery-ui-effect-slide': 'bower-libs/jquery-ui/ui/jquery.ui.effect-slide', 'jquery-ui-effect-slide': 'bower-libs/jquery-ui/ui/jquery.ui.effect-slide',
FileSaver: 'bower-libs/FileSaver/FileSaver', FileSaver: 'bower-libs/FileSaver/FileSaver',
stacktrace: 'bower-libs/stacktrace/stacktrace', stacktrace: 'bower-libs/stacktrace/stacktrace',
'requirejs-text': 'bower-libs/requirejs-text/text', 'requirejs-text': 'bower-libs/requirejs-text/text',
'bootstrap-tour': 'bower-libs/bootstrap-tour/build/js/bootstrap-tour', 'bootstrap-tour': 'bower-libs/bootstrap-tour/build/js/bootstrap-tour',
css_browser_selector: 'bower-libs/css_browser_selector/css_browser_selector', css_browser_selector: 'bower-libs/css_browser_selector/css_browser_selector',
'pagedown-extra': 'bower-libs/pagedown-extra/Markdown.Extra', 'pagedown-extra': 'bower-libs/pagedown-extra/Markdown.Extra',
pagedown: 'libs/Markdown.Editor', pagedown: 'libs/Markdown.Editor',
'require-css': 'bower-libs/require-css/css', 'require-css': 'bower-libs/require-css/css',
xregexp: 'bower-libs/xregexp/xregexp-all', xregexp: 'bower-libs/xregexp/xregexp-all',
yaml: 'bower-libs/yaml.js', yaml: 'bower-libs/yaml.js',
'yaml.js': 'bower-libs/yaml.js', 'yaml.js': 'bower-libs/yaml.js',
'yaml-js': 'bower-libs/yaml.js/bin/yaml', 'yaml-js': 'bower-libs/yaml.js/bin/yaml',
css: 'bower-libs/require-css/css', css: 'bower-libs/require-css/css',
'css-builder': 'bower-libs/require-css/css-builder', 'css-builder': 'bower-libs/require-css/css-builder',
normalize: 'bower-libs/require-css/normalize', normalize: 'bower-libs/require-css/normalize',
prism: 'bower-libs/prism/prism', prism: 'bower-libs/prism/prism',
'prism-core': 'bower-libs/prism/components/prism-core', 'prism-core': 'bower-libs/prism/components/prism-core',
MutationObservers: 'bower-libs/MutationObservers/MutationObserver', MutationObservers: 'bower-libs/MutationObservers/MutationObserver',
WeakMap: 'bower-libs/WeakMap/weakmap', WeakMap: 'bower-libs/WeakMap/weakmap',
rangy: 'bower-libs/rangy/rangy-core', rangy: 'bower-libs/rangy/rangy-core',
'rangy-cssclassapplier': 'bower-libs/rangy/rangy-cssclassapplier', 'rangy-cssclassapplier': 'bower-libs/rangy/rangy-cssclassapplier',
diff_match_patch: 'bower-libs/google-diff-match-patch-js/diff_match_patch', diff_match_patch: 'bower-libs/google-diff-match-patch-js/diff_match_patch',
diff_match_patch_uncompressed: 'bower-libs/google-diff-match-patch-js/diff_match_patch_uncompressed', diff_match_patch_uncompressed: 'bower-libs/google-diff-match-patch-js/diff_match_patch_uncompressed',
jsondiffpatch: 'bower-libs/jsondiffpatch/build/bundle', jsondiffpatch: 'bower-libs/jsondiffpatch/build/bundle',
hammerjs: 'bower-libs/hammerjs/hammer', hammerjs: 'bower-libs/hammerjs/hammer',
'sequence-diagram': 'bower-libs/js-sequence-diagrams/build/sequence-diagram-min', 'sequence-diagram': 'libs/sequence-diagram',
raphael: 'bower-libs/raphael/raphael', raphael: 'bower-libs/raphael/raphael',
'flow-chart': 'bower-libs/flowchart/release/flowchart.amd-1.2.10.min', 'flow-chart': 'bower-libs/flowchart/release/flowchart.amd-1.2.10.min',
flowchart: 'bower-libs/flowchart/release/flowchart-1.2.10.min' flowchart: 'bower-libs/flowchart/release/flowchart-1.2.10.min'
}, },
shim: { shim: {
underscore: { underscore: {
exports: '_' exports: '_'
}, },
mathjax: [ mathjax: [
'libs/mathjax_init' 'libs/mathjax_init'
], ],
jgrowl: { jgrowl: {
deps: [ deps: [
'jquery' 'jquery'
], ],
exports: 'jQuery.jGrowl' exports: 'jQuery.jGrowl'
}, },
diff_match_patch_uncompressed: { diff_match_patch_uncompressed: {
exports: 'diff_match_patch' exports: 'diff_match_patch'
}, },
jsondiffpatch: [ jsondiffpatch: [
'diff_match_patch_uncompressed' 'diff_match_patch_uncompressed'
], ],
rangy: { rangy: {
exports: 'rangy' exports: 'rangy'
}, },
'rangy-cssclassapplier': [ 'rangy-cssclassapplier': [
'rangy' 'rangy'
], ],
mousetrap: { mousetrap: {
exports: 'Mousetrap' exports: 'Mousetrap'
}, },
'yaml-js': { 'yaml-js': {
exports: 'YAML' exports: 'YAML'
}, },
'prism-core': { 'prism-core': {
exports: 'Prism' exports: 'Prism'
}, },
'bower-libs/prism/components/prism-markup': [ 'bower-libs/prism/components/prism-markup': [
'prism-core' 'prism-core'
], ],
'libs/prism-latex': [ 'libs/prism-latex': [
'prism-core' 'prism-core'
], ],
'libs/prism-markdown': [ 'libs/prism-markdown': [
'bower-libs/prism/components/prism-markup', 'bower-libs/prism/components/prism-markup',
'libs/prism-latex' 'libs/prism-latex'
], ],
'bootstrap-record': [ 'bootstrap-record': [
'mousetrap' 'mousetrap'
], ],
toMarkdown: { toMarkdown: {
deps: [ deps: [
'jquery' 'jquery'
], ],
exports: 'toMarkdown' exports: 'toMarkdown'
}, },
stacktrace: { stacktrace: {
exports: 'printStackTrace' exports: 'printStackTrace'
}, },
FileSaver: { FileSaver: {
exports: 'saveAs' exports: 'saveAs'
}, },
MutationObservers: [ MutationObservers: [
'WeakMap' 'WeakMap'
], ],
highlightjs: { highlightjs: {
exports: 'hljs' exports: 'hljs'
}, },
'bootstrap-tour': { 'bootstrap-tour': {
deps: [ deps: [
'bootstrap' 'bootstrap'
], ],
exports: 'Tour' exports: 'Tour'
}, },
bootstrap: [ bootstrap: [
'jquery' 'jquery'
], ],
'jquery-waitforimages': [ 'jquery-waitforimages': [
'jquery' 'jquery'
], ],
pagedown: [ pagedown: [
'libs/Markdown.Converter' 'libs/Markdown.Converter'
], ],
'pagedown-extra': [ 'pagedown-extra': [
'libs/Markdown.Converter' 'libs/Markdown.Converter'
], ],
'sequence-diagram': { 'flow-chart': [
deps: [ 'raphael'
'underscore', ]
'raphael' }
],
exports: 'Diagram'
},
'flow-chart': [
'raphael'
],
}
}); });
// Check browser compatibility // Check browser compatibility
try { try {
var test = 'seLocalStorageCheck'; var test = 'seLocalStorageCheck';
localStorage.setItem(test, test); localStorage.setItem(test, test);
localStorage.removeItem(test); localStorage.removeItem(test);
var obj = {}; var obj = {};
Object.defineProperty(obj, 'prop', { Object.defineProperty(obj, 'prop', {
get: function() {}, get: function() {
set: function() {} },
}); set: function() {
}
});
} }
catch (e) { catch(e) {
alert('Your browser is not supported, sorry!'); alert('Your browser is not supported, sorry!');
throw e; throw e;
} }
// Viewer mode is deduced from the body class // Viewer mode is deduced from the body class
@ -184,34 +179,44 @@ window.viewerMode = /(^| )viewer($| )/.test(document.body.className);
// Keep the theme in a global variable // Keep the theme in a global variable
window.theme = localStorage.themeV3 || 'default'; window.theme = localStorage.themeV3 || 'default';
var themeModule = "less!themes/" + window.theme; var themeModule = "less!themes/" + window.theme;
if (window.baseDir.indexOf('-min') !== -1) { if(window.baseDir.indexOf('-min') !== -1) {
themeModule = "css!themes/" + window.theme; themeModule = "css!themes/" + window.theme;
} }
// RequireJS entry point. By requiring synchronizer, publisher and // RequireJS entry point. By requiring synchronizer, publisher and
// media-importer, we are actually loading all the modules // media-importer, we are actually loading all the modules
require(["jquery", "rangy", "core", "eventMgr", "synchronizer", "publisher", "mediaImporter", "css", "rangy-cssclassapplier", require([
themeModule, ], function($, rangy, core, eventMgr) { "jquery",
"rangy",
"core",
"eventMgr",
"synchronizer",
"publisher",
"mediaImporter",
"css",
"rangy-cssclassapplier",
themeModule,
], function($, rangy, core, eventMgr) {
if(window.noStart) { if(window.noStart) {
return; return;
} }
$(function() { $(function() {
rangy.init(); rangy.init();
// Here, all the modules are loaded and the DOM is ready // Here, all the modules are loaded and the DOM is ready
core.onReady(); core.onReady();
// If browser has detected a new application cache. // If browser has detected a new application cache.
if (window.applicationCache) { if(window.applicationCache) {
window.applicationCache.addEventListener('updateready', function() { window.applicationCache.addEventListener('updateready', function() {
if (window.applicationCache.status === window.applicationCache.UPDATEREADY) { if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
window.applicationCache.swapCache(); window.applicationCache.swapCache();
eventMgr.onMessage('New version available!\nJust refresh the page to upgrade.'); eventMgr.onMessage('New version available!\nJust refresh the page to upgrade.');
} }
}, false); }, false);
} }
}); });
}); });