summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2011-11-24 15:34:06 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2011-11-24 15:34:06 +0100
commit8a45c65b35387631daefc64e74d2c4e4f48e586f (patch)
treef378099fc9dd7744a400bf304976592e80551658 /static
parent5684a01feb1594f9434e3bc206733fc4874249cd (diff)
Refactor the JavaScript code.
Diffstat (limited to 'static')
-rw-r--r--static/js/wiki.js37
1 files changed, 24 insertions, 13 deletions
diff --git a/static/js/wiki.js b/static/js/wiki.js
index 3f61456..4f13af3 100644
--- a/static/js/wiki.js
+++ b/static/js/wiki.js
@@ -1,3 +1,24 @@
+var mulk;
+
+if (!mulk) {
+ mulk = {};
+}
+
+mulk.savePage = function() {
+ $.ajax({
+ url: "?save",
+ data: { content: $('#wiki-page-content').html() },
+ type: "POST",
+ success: function() {
+ mulk.savePage();
+ console.log('Success.');
+ },
+ error: function() {
+ console.log('Error.');
+ }
+ });
+};
+
/*
jQuery(function ($) {
$('#wiki-page-content').on('blur', function() {
@@ -10,7 +31,6 @@ jQuery(function ($) {
});
*/
-
jQuery(function ($) {
if (!window.Aloha) {
window.Aloha = {};
@@ -18,7 +38,7 @@ jQuery(function ($) {
window.Aloha.settings = {
logLevels: {'error': true, 'warn': true, 'info': true, 'debug': false},
errorhandling : false,
- ribbon: true,
+ ribbon: false,
"i18n": {
"current": "de"
@@ -52,19 +72,10 @@ jQuery(function ($) {
$$('#wiki-page-content').aloha();
var save = function() {
console.log('Saving changes.');
- $.ajax({
- url: "?save",
- data: { content: $('#wiki-page-content').html() },
- type: "POST",
- success: function() {
- console.log('Success.');
- },
- error: function() {
- console.log('Error.');
- }
- });
+ mulk.savePage();
};
$('#wiki-page-content').on('blur', save);
//$('#wiki-page-content').on('datachanged', save);
});
});
+