From 6392c3b6beffdef6383fc01859567a0e1f8a3f4e Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 12 Aug 2009 21:40:07 +0200 Subject: simplify JavaScript loading Ignore-this: 7637977e042ed8ba7e9e9097f9e9f03f This patch removes the differences between the JavaScript loaded in edit and view modes. * increases the amount of JavaScript that is loaded initially * decreases the number of requests * only one cache for all javascript * all javascript is available in view mode The last point is the most important as it makes a lot of functionality available to plugins working in the view mode. The discussion plugin now can reuse the toolbar code for example. Note: development is part of ICKE 2.0 project http://www.icke-projekt.de darcs-hash:20090812194007-6e07b-c8a71dedf506065a95d8b84b55aafce67810236c.gz --- lib/scripts/edit.js | 7 +++++-- lib/scripts/script.js | 3 --- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/scripts') diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index 5320c9419..215e647b5 100644 --- a/lib/scripts/edit.js +++ b/lib/scripts/edit.js @@ -341,9 +341,13 @@ function changeCheck(msg){ * JSnocheck class), add handlers to monitor changes * * Sets focus to the editbox as well + * + * @fixme this is old and crappy code. needs to be redone */ function initChangeCheck(msg){ - if(!document.getElementById){ return false; } + var edit_text = document.getElementById('wiki__text'); + if(!edit_text) return; + // add change check for links var links = document.getElementsByTagName('a'); for(var i=0; i < links.length; i++){ @@ -374,7 +378,6 @@ function initChangeCheck(msg){ btn_prev.onclick = function(){ textChanged = false; }; // add change memory setter - var edit_text = document.getElementById('wiki__text'); edit_text.onchange = function(){ textChanged = true; //global var summaryCheck(); diff --git a/lib/scripts/script.js b/lib/scripts/script.js index be3339525..948375a64 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -17,9 +17,6 @@ if (clientPC.indexOf('opera')!=-1) { var is_opera_seven = (window.opera && document.childNodes); } -// prepare empty toolbar for checks by lazy plugins -var toolbar = ''; - /** * Handy shortcut to document.getElementById * -- cgit v1.2.3