[prev in list] [next in list] [prev in thread] [next in thread]
List: kupu-checkins
Subject: [kupu-checkins] r35790 - in kupu/trunk/kupu: . common
From: duncan () codespeak ! net
Date: 2006-12-15 12:01:56
Message-ID: 20061215120156.A940510083 () code0 ! codespeak ! net
[Download RAW message or body]
Author: duncan
Date: Fri Dec 15 13:01:50 2006
New Revision: 35790
Modified:
kupu/trunk/kupu/common/kupu_kjax.js
kupu/trunk/kupu/common/kupubasetools.js
kupu/trunk/kupu/common/kupubeforeunload.js
kupu/trunk/kupu/common/kupucleanupexpressions.js
kupu/trunk/kupu/common/kupucnftable.js
kupu/trunk/kupu/common/kupucontentfilters.js
kupu/trunk/kupu/common/kupucontextmenu.js
kupu/trunk/kupu/common/kupudrawers.js
kupu/trunk/kupu/common/kupueditor.js
kupu/trunk/kupu/common/kupuhelpers.js
kupu/trunk/kupu/common/kupuinit.js
kupu/trunk/kupu/common/kupuinit_experimental.js
kupu/trunk/kupu/common/kupuinit_form.js
kupu/trunk/kupu/common/kupuinit_genericelements.js
kupu/trunk/kupu/common/kupuinit_multi.js
kupu/trunk/kupu/common/kupuinspector.js
kupu/trunk/kupu/common/kupuloggers.js
kupu/trunk/kupu/common/kupumultieditor.js
kupu/trunk/kupu/common/kupusaveonpart.js
kupu/trunk/kupu/common/kupusourceedit.js
kupu/trunk/kupu/common/kupuspellchecker.js
kupu/trunk/kupu/common/kupustart.js
kupu/trunk/kupu/common/kupustart_form.js
kupu/trunk/kupu/common/kupustart_multi.js
kupu/trunk/kupu/common/kuputoolcollapser.js
kupu/trunk/kupu/common/sarissa.js
kupu/trunk/kupu/common/sarissa_ieemu_xpath.js
kupu/trunk/kupu/jslint.js
kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js
kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js
kupu/trunk/kupu/plone/kupu_plone_layer/kupusaveonpart.js
Log:
Added error message output for the report stage of jslint.js so we now get messages \
for undefined globals and unused local variables. Another big cleanup of Kupu's \
javascript: removed a lot of inadvertant global variables and unused locals.
Modified: kupu/trunk/kupu/common/kupu_kjax.js
==============================================================================
--- kupu/trunk/kupu/common/kupu_kjax.js (original)
+++ kupu/trunk/kupu/common/kupu_kjax.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern Sarissa timer_instance newElement */
/* Javascript to aid migration page. */
function KJax() {};
@@ -134,7 +134,7 @@
var name = /input/i.test(el.tagName)?el.type:el.tagName;
if (/checkbox|radio/i.test(name) && !el.checked) continue;
if (/select/i.test(name)) {
- push(el, options[el.selectedIndex].value);
+ push(el, el.options[el.selectedIndex].value);
continue;
}
if (/text|hidden|checkbox|radio|textarea/i.test(name)) {
Modified: kupu/trunk/kupu/common/kupubasetools.js
==============================================================================
--- kupu/trunk/kupu/common/kupubasetools.js (original)
+++ kupu/trunk/kupu/common/kupubasetools.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,10 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern addEventHandler _ getFromSelector newElement
+ ContextMenuElement _SARISSA_IS_MOZ openPopup selectSelectItem
+ NodeIterator _IE_VERSION Sarissa
+ */
// $Id$
//----------------------------------------------------------------------------
@@ -59,7 +62,7 @@
Calls the updateState for all toolboxes and may want perform
some actions itself
*/
- for (id in this.toolboxes) {
+ for (var id in this.toolboxes) {
this.toolboxes[id].updateState(selNode, event);
};
};
@@ -356,7 +359,7 @@
var opts = [];
while (options.length) {
- opt = options[0];
+ var opt = options[0];
options[0] = null;
var v = opt.value;
if (v.indexOf('|') > -1) {
@@ -381,7 +384,7 @@
paraoptions.push(normal);
parastyles[normal[1]] = 0;
- for (i = 0; i < opts.length; i++) {
+ for (var i = 0; i < opts.length; i++) {
optarray = opts[i];
v = optarray[1];
@@ -569,7 +572,6 @@
* trailing <br>
* If the node is now empty and no preserveEmpty, remove the node \
itself.
*/
- var len = node.childNodes.length;
function stripspace() {
var c;
while ((c = node.lastChild) && c.nodeType==3 && (/^\s*$/.test(c.data))) \
{ @@ -1135,7 +1137,7 @@
// Insert link with no text selected, insert the title
// or URI instead.
var doc = this.editor.getInnerDocument();
- linkel = doc.createElement("a");
+ var linkel = doc.createElement("a");
linkel.setAttribute('href', url);
linkel.setAttribute('class', 'generated');
this.editor.getSelection().replaceWithNode(linkel, true);
@@ -1375,8 +1377,7 @@
};
var doc = this.editor.getInnerDocument();
-
- table = doc.createElement("table");
+ var table = doc.createElement("table");
table.className = tableclass;
// If the user wants a row of headings, make them
@@ -1392,7 +1393,7 @@
table.appendChild(thead);
}
- tbody = doc.createElement("tbody");
+ var tbody = doc.createElement("tbody");
for (var i=0; i < rows; i++) {
var tr = doc.createElement("tr");
for (var j=0; j < cols; j++) {
@@ -1541,7 +1542,6 @@
this.editor.logMessage(_('No parentcolumn found!'), 1);
return;
}
- var currtr = this.editor.getNearestParentOfType(currnode, 'TR');
var currtable = this.editor.getNearestParentOfType(currnode, 'TABLE');
// get the current index
@@ -1674,7 +1674,6 @@
var bodies = currtable.getElementsByTagName('TBODY');
for (var i=0; i < bodies.length; i++) {
var currtbody = bodies[i];
- var relevant_rowspan = 0;
for (var j=0; j < currtbody.childNodes.length; j++) {
var tr = currtbody.childNodes[j];
if (tr.nodeType != 1) {
@@ -1686,7 +1685,6 @@
if (cell.nodeType != 1) {
continue;
}
- var colspan = cell.colSpan;
if (currindex == currcolindex) {
tr.removeChild(cell);
break;
@@ -2117,8 +2115,6 @@
var rows = this.newrowsinput.value;
var cols = this.newcolsinput.value;
var makeHeader = this.makeheaderinput.checked;
- // XXX getFromSelector
- var classchooser = getFromSelector("kupu-table-classchooser-add");
var tableclass = \
this.classselect.options[this.classselect.selectedIndex].value;
this.tool.createTable(rows, cols, makeHeader, tableclass);
@@ -2730,9 +2726,7 @@
var iframe = editor.getDocument().editable;
var sourcetool = editor.getTool('sourceedittool');
var sourceArea = sourcetool?sourcetool.getSourceArea():null;
-
var fulleditor = iframe.parentNode;
- var body = document.body;
if (window.innerWidth) {
var width = window.innerWidth;
@@ -2815,12 +2809,10 @@
var options = ui.getStyles()[0];
for (var i = 1; i < options.length-1; i++) {
- var t = options[i][0];
- var v =options[i][1];
-
+ var cur = options[i];
var opt = document.createElement('option');
- opt.text = options[i][0];
- opt.value = options[i][1];
+ opt.text = cur[0];
+ opt.value = cur[1];
select.options.add(opt);
}
};
Modified: kupu/trunk/kupu/common/kupubeforeunload.js
==============================================================================
--- kupu/trunk/kupu/common/kupubeforeunload.js (original)
+++ kupu/trunk/kupu/common/kupubeforeunload.js Fri Dec 15 13:01:50 2006
@@ -1,4 +1,5 @@
/* BeforeUnload form processing */
+/*extern _ */
if (!window.beforeunload) (function() {
var BeforeUnloadHandler = function() {
var self = this;
Modified: kupu/trunk/kupu/common/kupucleanupexpressions.js
==============================================================================
--- kupu/trunk/kupu/common/kupucleanupexpressions.js (original)
+++ kupu/trunk/kupu/common/kupucleanupexpressions.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern addEventHandler NodeIterator */
// $Id: kupueditor.js 7951 2004-12-21 15:06:38Z guido $
// WARNING: this file can contain non-ascii characters, *always* make sure your
Modified: kupu/trunk/kupu/common/kupucnftable.js
==============================================================================
--- kupu/trunk/kupu/common/kupucnftable.js (original)
+++ kupu/trunk/kupu/common/kupucnftable.js Fri Dec 15 13:01:50 2006
@@ -7,8 +7,8 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
-// $Id: kupubasetools.js 6120 2004-08-22 23:23:42Z roku $
+/*extern _ getFromSelector addEventHandler selectSelectItem */
+// $Id$
TableTool.prototype.setTableRowRepeat = function() {
var selNode = this.editor.getSelectedNode();
Modified: kupu/trunk/kupu/common/kupucontentfilters.js
==============================================================================
--- kupu/trunk/kupu/common/kupucontentfilters.js (original)
+++ kupu/trunk/kupu/common/kupucontentfilters.js Fri Dec 15 13:01:50 2006
@@ -593,7 +593,7 @@
};
this._convertNodes = function(ownerdoc, htmlnode, xhtmlparent, permitted) {
- var name, parentnode = xhtmlparent;
+ var parentnode = xhtmlparent;
var nodename = this._getTagName(htmlnode);
var nostructure = !this.filterstructure;
Modified: kupu/trunk/kupu/common/kupucontextmenu.js
==============================================================================
--- kupu/trunk/kupu/common/kupucontextmenu.js (original)
+++ kupu/trunk/kupu/common/kupucontextmenu.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern addEventHandler */
// $Id$
Modified: kupu/trunk/kupu/common/kupudrawers.js
==============================================================================
--- kupu/trunk/kupu/common/kupudrawers.js (original)
+++ kupu/trunk/kupu/common/kupudrawers.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,10 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern getFromSelector timer_instance NodeIterator getBaseTagClass
+ addEventHandler selectSelectItem newElement XSLTProcessor
+ Sarissa
+ */
// $Id$
function DrawerTool() {
@@ -76,7 +79,7 @@
/* fill the drawer with some content */
// here's where any intelligence and XSLT transformation and such
// is done
- el.style.display = 'block';
+ this.element.style.display = 'block';
this.focusElement();
};
@@ -272,7 +275,6 @@
this.element.style.display = 'block';
this.hideAnchors();
this.focusElement();
- var style = this.element.style;
};
this.save = function() {
@@ -362,7 +364,7 @@
fixClasses(editclassselect);
var table = editor.getNearestParentOfType(selNode, 'table');
-
+ var show, hide;
if (!table) {
// show add table drawer
show = this.addpanel;
@@ -914,8 +916,8 @@
// that is handled in _libraryContentCallback anyway).
// We need to give the newly retrieved data a unique ID, we
// just use the time.
- date = new Date();
- time = date.getTime();
+ var date = new Date();
+ var time = date.getTime();
// attach 'loadedInNode' attribute to leaf node so Case 1
// applies next time.
@@ -968,7 +970,6 @@
this.removeSelection = function() {
// Mark the drawer as having no selection
- var el = this.element;
if (!this.xmldata) return;
if (!this.multiple) {
@@ -1102,8 +1103,8 @@
// we need to give the newly retrieved data a unique ID, we
// just use the time.
- date = new Date();
- time = date.getTime();
+ var date = new Date();
+ var time = date.getTime();
resultlib.setAttribute("id", time);
// deselect the previous collection and mark the result
@@ -1177,7 +1178,6 @@
this._transformXml = function() {
/* transform this.xmldata to HTML using this.shared.xsl and return it */
- var doc = Sarissa.getDomDocument();
var result = this.shared.xsltproc.transformToDocument(this.xmldata);
return result;
};
@@ -1455,7 +1455,7 @@
var isSingle = this.getMode();
var s = ['', ''];
- for (idx=0; idx < (isSingle?1:2); idx++) {
+ for (var idx=0; idx < (isSingle?1:2); idx++) {
var sel = this['style'+(idx+1)];
var i = sel.selectedIndex;
if (i >= 0) {
@@ -1484,7 +1484,6 @@
};
};
this.createContent = function() {
- var editor = this.editor;
if (this.radio2.checked) this.table.className=this.radio2.id;
this.fillList();
this.element.style.display = 'block';
@@ -1538,7 +1537,7 @@
if (!isSingle && toc.firstChild) {
var o = this.ostyle.selectedIndex;
if (o > 0) {
- ostyle = this.ostyle.options[o].value.split('|');
+ var ostyle = this.ostyle.options[o].value.split('|');
if (ostyle[0]=='ul') {
toc.className=ostyle[1];
} else {
Modified: kupu/trunk/kupu/common/kupueditor.js
==============================================================================
--- kupu/trunk/kupu/common/kupueditor.js (original)
+++ kupu/trunk/kupu/common/kupueditor.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,11 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern _SARISSA_IS_IE IESelection MozillaSelection addEventHandler
+ XMLSerializer XhtmlValidation _ UpdateStateCancelBubble
+ ContextFixer _SARISSA_IS_MOZ timer_instance newDocumentElement
+ Sarissa
+ */
// $Id$
//----------------------------------------------------------------------------
Modified: kupu/trunk/kupu/common/kupuhelpers.js
==============================================================================
--- kupu/trunk/kupu/common/kupuhelpers.js (original)
+++ kupu/trunk/kupu/common/kupuhelpers.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern _SARISSA_IS_IE _ Node Range */
// $Id$
/*
@@ -711,7 +711,7 @@
var curroffset = 0;
var endparent = null;
- var endoffset = 0;
+ var endparentoffset = 0;
while (currnode) {
if (currnode.nodeType == 3) { // XXX need to add CDATA support
@@ -887,8 +887,6 @@
if (realoffset >= 0) {
var currnode = offsetparent.firstChild;
var curroffset = 0;
- var startparent = null;
- var startoffset = 0;
while (currnode) {
if (currnode.nodeType == 3) { // XXX need to support CDATA sections
var nodelength = currnode.nodeValue.length;
@@ -1055,7 +1053,7 @@
var range = this.selection.createRange();
range.pasteHTML('<img id="kupu-tempnode">');
- tempnode = document.getElementById('kupu-tempnode');
+ var tempnode = document.getElementById('kupu-tempnode');
tempnode.replaceNode(newnode);
if (selectAfterPlace) {
Modified: kupu/trunk/kupu/common/kupuinit.js
==============================================================================
--- kupu/trunk/kupu/common/kupuinit.js (original)
+++ kupu/trunk/kupu/common/kupuinit.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,15 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern KupuButton loadDictFromXML listtool ImageTool PlainLogger
+ SourceEditTool LinkTool KupuSpellChecker DrawerTool
+ ImageToolBox TableDrawer KupuDocument KupuStateButton
+ KupuUI DefinitionListTool PropertyTool LinkDrawer LinkToolBox
+ AnchorTool parentWithStyleChecker AnchorDrawer TableToolBox
+ LinkLibraryDrawer ColorchooserTool KupuEditor CleanupExpressionsTool
+ KupuZoomTool ImageLibraryDrawer KupuRemoveElementButton
+ ContextMenu TableTool NonXHTMLTagFilter ShowPathTool _ ListTool
+ */
// $Id$
Modified: kupu/trunk/kupu/common/kupuinit_experimental.js
==============================================================================
--- kupu/trunk/kupu/common/kupuinit_experimental.js (original)
+++ kupu/trunk/kupu/common/kupuinit_experimental.js Fri Dec 15 13:01:50 2006
@@ -7,6 +7,16 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
+/*extern KupuButton loadDictFromXML listtool ImageTool PlainLogger
+ SourceEditTool LinkTool KupuSpellChecker DrawerTool
+ ImageToolBox TableDrawer KupuDocument KupuStateButton
+ KupuUI DefinitionListTool PropertyTool LinkDrawer LinkToolBox
+ AnchorTool parentWithStyleChecker AnchorDrawer TableToolBox
+ LinkLibraryDrawer ColorchooserTool KupuEditor CleanupExpressionsTool
+ KupuZoomTool ImageLibraryDrawer KupuRemoveElementButton
+ ContextMenu TableTool NonXHTMLTagFilter ShowPathTool _ ListTool
+ KupuInspector ViewSourceTool
+ */
// $Id$
@@ -198,12 +208,12 @@
var drawertool = new DrawerTool();
kupu.registerTool('drawertool', drawertool);
- var linklibdrawer = new LinkLibrarydrawer(linktool, conf.link_xsl_uri,
+ var linklibdrawer = new LinkLibraryDrawer(linktool, conf.link_xsl_uri,
conf.link_libraries_uri,
conf.link_images_uri);
drawertool.registerDrawer('linklibdrawer', linklibdrawer);
- var imagelibdrawer = new ImageLibrarydrawer(imagetool, conf.image_xsl_uri,
+ var imagelibdrawer = new ImageLibraryDrawer(imagetool, conf.image_xsl_uri,
conf.image_libraries_uri,
conf.search_images_uri);
drawertool.registerDrawer('imagelibdrawer', imagelibdrawer);
Modified: kupu/trunk/kupu/common/kupuinit_form.js
==============================================================================
--- kupu/trunk/kupu/common/kupuinit_form.js (original)
+++ kupu/trunk/kupu/common/kupuinit_form.js Fri Dec 15 13:01:50 2006
@@ -19,6 +19,16 @@
// We only want to disable the save button, but unfortunately that currently
// still means this method should be overridden completely
//----------------------------------------------------------------------------
+/*extern KupuButton loadDictFromXML listtool ImageTool PlainLogger
+ SourceEditTool LinkTool KupuSpellChecker DrawerTool
+ ImageToolBox TableDrawer KupuDocument KupuStateButton
+ KupuUI DefinitionListTool PropertyTool LinkDrawer LinkToolBox
+ AnchorTool parentWithStyleChecker AnchorDrawer TableToolBox
+ LinkLibraryDrawer ColorchooserTool KupuEditor CleanupExpressionsTool
+ KupuZoomTool ImageLibraryDrawer KupuRemoveElementButton
+ ContextMenu TableTool NonXHTMLTagFilter ShowPathTool _ ListTool
+ KupuInspector ViewSourceTool addEventHandler getFromSelector
+ */
function initKupu(iframe) {
/* Although this is meant to be a sample implementation, it can
Modified: kupu/trunk/kupu/common/kupuinit_genericelements.js
==============================================================================
--- kupu/trunk/kupu/common/kupuinit_genericelements.js (original)
+++ kupu/trunk/kupu/common/kupuinit_genericelements.js Fri Dec 15 13:01:50 2006
@@ -7,6 +7,17 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
+/*extern KupuButton loadDictFromXML listtool ImageTool PlainLogger
+ SourceEditTool LinkTool KupuSpellChecker DrawerTool
+ ImageToolBox TableDrawer KupuDocument KupuStateButton
+ KupuUI DefinitionListTool PropertyTool LinkDrawer LinkToolBox
+ AnchorTool parentWithStyleChecker AnchorDrawer TableToolBox
+ LinkLibraryDrawer ColorchooserTool KupuEditor CleanupExpressionsTool
+ KupuZoomTool ImageLibraryDrawer KupuRemoveElementButton
+ ContextMenu TableTool NonXHTMLTagFilter ShowPathTool _ ListTool
+ KupuInspector ViewSourceTool addEventHandler getFromSelector
+ */
+/*extern CNFTableToolBox GenericElementsTool GenericElementsToolBox */
// $Id$
Modified: kupu/trunk/kupu/common/kupuinit_multi.js
==============================================================================
--- kupu/trunk/kupu/common/kupuinit_multi.js (original)
+++ kupu/trunk/kupu/common/kupuinit_multi.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,17 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern KupuButton loadDictFromXML listtool ImageTool PlainLogger
+ SourceEditTool LinkTool KupuSpellChecker DrawerTool
+ ImageToolBox TableDrawer KupuDocument KupuStateButton
+ KupuUI DefinitionListTool PropertyTool LinkDrawer LinkToolBox
+ AnchorTool parentWithStyleChecker AnchorDrawer TableToolBox
+ LinkLibraryDrawer ColorchooserTool KupuEditor CleanupExpressionsTool
+ KupuZoomTool ImageLibraryDrawer KupuRemoveElementButton
+ ContextMenu TableTool NonXHTMLTagFilter ShowPathTool _ ListTool
+ KupuInspector ViewSourceTool addEventHandler getFromSelector
+ */
+/*extern KupuMultiEditor MultiSourceEditTool */
// $Id$
Modified: kupu/trunk/kupu/common/kupuinspector.js
==============================================================================
--- kupu/trunk/kupu/common/kupuinspector.js (original)
+++ kupu/trunk/kupu/common/kupuinspector.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern _SARISSA_IS_IE addEventHandler getFromSelector */
// $Id$
/* The Kupu Inspector tool
Modified: kupu/trunk/kupu/common/kupuloggers.js
==============================================================================
--- kupu/trunk/kupu/common/kupuloggers.js (original)
+++ kupu/trunk/kupu/common/kupuloggers.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern getFromSelector */
// $Id$
Modified: kupu/trunk/kupu/common/kupumultieditor.js
==============================================================================
--- kupu/trunk/kupu/common/kupumultieditor.js (original)
+++ kupu/trunk/kupu/common/kupumultieditor.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern _ timer_instance */
// $Id: kupumultieditor.js 3450 2004-03-28 11:07:30Z guido $
function KupuMultiEditor(documents, config, logger) {
Modified: kupu/trunk/kupu/common/kupusaveonpart.js
==============================================================================
--- kupu/trunk/kupu/common/kupusaveonpart.js (original)
+++ kupu/trunk/kupu/common/kupusaveonpart.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern kupu _ */
// $Id$
function saveOnPart() {
Modified: kupu/trunk/kupu/common/kupusourceedit.js
==============================================================================
--- kupu/trunk/kupu/common/kupusourceedit.js (original)
+++ kupu/trunk/kupu/common/kupusourceedit.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,8 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern getFromSelector addEventHandler _ kupuButtonEnable
+ kupuButtonDisable kupu */
// $Id$
Modified: kupu/trunk/kupu/common/kupuspellchecker.js
==============================================================================
--- kupu/trunk/kupu/common/kupuspellchecker.js (original)
+++ kupu/trunk/kupu/common/kupuspellchecker.js Fri Dec 15 13:01:50 2006
@@ -1,3 +1,4 @@
+/*extern addEventHandler ContextFixer _ NodeIterator timer_instance */
function KupuSpellChecker(buttonid, scripturl, spanstyle,
winwidth, winheight, skip_tags) {
this.button = document.getElementById(buttonid);
@@ -195,6 +196,5 @@
};
result[word] = replacements;
};
- var attrs = [];
return result;
};
Modified: kupu/trunk/kupu/common/kupustart.js
==============================================================================
--- kupu/trunk/kupu/common/kupustart.js (original)
+++ kupu/trunk/kupu/common/kupustart.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern saveOnPart getFromSelector initKupu addEventHandler */
// $Id$
function startKupu() {
Modified: kupu/trunk/kupu/common/kupustart_form.js
==============================================================================
--- kupu/trunk/kupu/common/kupustart_form.js (original)
+++ kupu/trunk/kupu/common/kupustart_form.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern getFromSelector initKupu ContextFixer _ */
// $Id$
function startKupu() {
Modified: kupu/trunk/kupu/common/kupustart_multi.js
==============================================================================
--- kupu/trunk/kupu/common/kupustart_multi.js (original)
+++ kupu/trunk/kupu/common/kupustart_multi.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern initKupu ContextFixer _ */
// $Id$
function startKupu() {
Modified: kupu/trunk/kupu/common/kuputoolcollapser.js
==============================================================================
--- kupu/trunk/kupu/common/kuputoolcollapser.js (original)
+++ kupu/trunk/kupu/common/kuputoolcollapser.js Fri Dec 15 13:01:50 2006
@@ -1,3 +1,4 @@
+/*extern addEventHandler _ */
// turn this into a nice module-like namespace to avoid messing up the global
// (window) namespace
this.kuputoolcollapser = new function() {
@@ -78,7 +79,7 @@
currchild = currchild.nextSibling;
if (!currchild) {
throw('body not found by collapser for toolbox ' +
- child.id);
+ tool.id);
};
};
return currchild;
Modified: kupu/trunk/kupu/common/sarissa.js
==============================================================================
--- kupu/trunk/kupu/common/sarissa.js (original)
+++ kupu/trunk/kupu/common/sarissa.js Fri Dec 15 13:01:50 2006
@@ -26,6 +26,7 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/*extern ActiveXObject */
/**
* <p>Sarissa is a utility class. Provides "static" methods for DOMDocument,
* DOM Node serialization to XML strings and other utility goodies.</p>
@@ -66,18 +67,20 @@
*/
Sarissa.pickRecentProgID = function (idList){
// found progID flag
- var bFound = false;
+ var bFound = false, e;
for(var i=0; i < idList.length && !bFound; i++){
try{
- var oDoc = new ActiveXObject(idList[i]);
- o2Store = idList[i];
+ var _ = new ActiveXObject(idList[i]);
+ _ = _;
+ var o2Store = idList[i];
bFound = true;
}catch (objException){
// trap; try next progID
+ e = objException;
};
};
if (!bFound) {
- throw "Could not retreive a valid progID of Class: " + \
idList[idList.length-1]+". (original exception: "+e+")"; + throw "Could \
not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original \
exception: "+e+")"; };
idList = null;
return o2Store;
@@ -597,7 +600,6 @@
isLeaf = true;
}else{
s += "\n";
- var itemKey = '';
var isArrayItem = anyObject instanceof Array;
for(var name in anyObject){
s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item \
key=\""+name+"\"":name), indentSpace + " ");
Modified: kupu/trunk/kupu/common/sarissa_ieemu_xpath.js
==============================================================================
--- kupu/trunk/kupu/common/sarissa_ieemu_xpath.js (original)
+++ kupu/trunk/kupu/common/sarissa_ieemu_xpath.js Fri Dec 15 13:01:50 2006
@@ -33,6 +33,7 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/*extern XPathResult */
if(_SARISSA_HAS_DOM_FEATURE && document.implementation.hasFeature("XPath", "3.0")){
/**
* <p>SarissaNodeList behaves as a NodeList but is only used as a result to \
<code>selectNodes</code>,
Modified: kupu/trunk/kupu/jslint.js
==============================================================================
--- kupu/trunk/kupu/jslint.js (original)
+++ kupu/trunk/kupu/jslint.js Fri Dec 15 13:01:50 2006
@@ -101,6 +101,62 @@
return (this >= '0' && this <= '9');
};
+String.prototype.format = function() {
+ function repl() {
+ function spaces(n) {
+ n = Math.floor(n);
+ if (n<=0) return '';
+ if (n==1) return ' ';
+ return spaces(n/2)+spaces(n-n/2);
+ }
+ var flag = arguments[1];
+ var width = Number(arguments[2] || 0);
+ var prec = Number(arguments[3] || 0);
+ var type = arguments[4];
+ var value;
+ switch(type) {
+ case '%':
+ value = '%';
+ break;
+ case 'f':
+ value = args[n++].toFixed(prec);
+ width = width+prec+1;
+ break;
+ case 'd':
+ value = String(Math.floor(args[n++]));
+ break;
+ case 'r': case 's':
+ value = args[n++];
+ if (type=='r') {
+ if (typeof(value)=='string') {
+ value = "'"+value.replace("'","\\'")+"'";
+ } else {
+ value = value.toString();
+ }
+ }
+ if (prec !== 0) {
+ value = value.substr(0,prec);
+ }
+ break;
+ default:
+ throw("String.format: unrecognised format character '"+type+"'");
+ break;
+ }
+ var padding = spaces(width-value.length);
+ if (flag=='-') { // Left align
+ value = value + padding;
+ } else {
+ value = padding + value;
+ }
+ return value;
+ }
+ var n = 0, args = arguments;
+ var res = this.replace(/%([-0]?)(\d*)(?:\.)?(\d*)(.)/g, repl);
+ if (n != args.length) {
+ throw("String.format given %d arguments, expecting %d".format(args.length, \
n)); + }
+ return res;
+}
// We build the application inside a function so that we produce only a single
// global variable. The function will be invoked, its return value is the JSLINT
@@ -2651,6 +2707,149 @@
return o.join('');
};
+ itself.textreport = function (option) {
+ var a = [], c, cc, f, i, k, o = [], s;
+
+ function detail(h) {
+ if (s.length) {
+ o.push(h + ': ' + s.sort().join(', '));
+ }
+ }
+
+ if (!option) {
+ for (k in member) {
+ a.push(k);
+ }
+ if (a.length) {
+ a = a.sort();
+ o.push('Members Occurrences');
+ for (i = 0; i < a.length; i += 1) {
+ o.push(a[i]+' '+member[a[i]]);
+ }
+ o.push('');
+ }
+ for (i = 0; i < functions.length; i += 1) {
+ f = functions[i];
+ for (k in f) {
+ if (f[k] === 'global') {
+ c = f['(context)'];
+ for (;;) {
+ cc = c['(context)'];
+ if (!cc) {
+ if ((!funlab[k] || funlab[k] === 'var?') &&
+ !builtin(k)) {
+ funlab[k] = 'var?';
+ f[k] = 'global?';
+ }
+ break;
+ }
+ if (c[k] === 'parameter!' || c[k] === 'var!') {
+ f[k] = 'var.';
+ break;
+ }
+ if (c[k] === 'var' || c[k] === 'var*' ||
+ c[k] === 'var!') {
+ f[k] = 'var.';
+ c[k] = 'var!';
+ break;
+ }
+ if (c[k] === 'parameter') {
+ f[k] = 'var.';
+ c[k] = 'parameter!';
+ break;
+ }
+ c = cc;
+ }
+ }
+ }
+ }
+ s = [];
+ for (k in funlab) {
+ c = funlab[k];
+ if (typeof c === 'string' && c.substr(0, 3) === 'var') {
+ if (c === 'var?') {
+ s.push(k+' (?)');
+ warning(1001, 'Global %r defined by default'.format(k));
+ } else {
+ s.push(k);
+ }
+ }
+ }
+ detail('Global');
+ if (functions.length) {
+ o.push('Function:');
+ }
+ for (i = 0; i < functions.length; i += 1) {
+ f = functions[i];
+ o.push(' * ' +
+ f['(line)'] + ' ' + (f['(name)'] || ''));
+ s = [];
+ for (k in f) {
+ if (k.charAt(0) !== '(') {
+ switch (f[k]) {
+ case 'parameter':
+ s.push(k);
+ break;
+ case 'parameter!':
+ s.push(k + ' (closure)');
+ warning(1002, 'Parameter %r used in nested function \
in %s'.format(k,f['(name)']), f['(line)']); + break;
+ }
+ }
+ }
+ detail('Parameter');
+ s = [];
+ for (k in f) {
+ if (k.charAt(0) !== '(') {
+ switch(f[k]) {
+ case 'var':
+ s.push(k + ' (unused)');
+ warning(1003, 'Unused local variable %r in \
%s'.format(k,f['(name)']), f['(line)']); + break;
+ case 'var*':
+ s.push(k);
+ break;
+ case 'var!':
+ s.push(k + ' (closure)');
+ warning(1004, 'Var %r used in nested function in \
%s'.format(k,f['(name)']), f['(line)']); + break;
+ case 'var.':
+ s.push(k + ' (outer)');
+ warning(1005, 'Var %r used from outer function in \
%s'.format(k,f['(name)']), f['(line)']); + break;
+ }
+ }
+ }
+ detail('Var');
+ s = [];
+ c = f['(context)'];
+ for (k in f) {
+ if (k.charAt(0) !== '(' && f[k].substr(0, 6) === 'global') {
+ if (f[k] === 'global?') {
+ s.push(k + ' (?)');
+ warning(1006, 'Undefined global %r in \
%s'.format(k,f['(name)']), f['(line)']); + } else {
+ s.push(k);
+ }
+ }
+ }
+ detail('Global');
+ s = [];
+ for (k in f) {
+ if (k.charAt(0) !== '(' && f[k] === 'label') {
+ s.push(k);
+ }
+ }
+ detail('Label');
+ o.push('');
+ }
+ if (functions.length) {
+ o.push('');
+ }
+ }
+ return o.join('\n');
+ };
+
return itself;
}();// rhino.js
@@ -2671,16 +2870,13 @@
print("jslint: Couldn't open file '" + a[0] + "'.");
quit(1);
}
- ignore = [501, 510, 531, 535, 544, 546, 554, 557];
- if (!JSLINT(input, {passfail: false, redef:true, ignore:ignore})) {
+ ignore = [501, 510, 531, 535, 544, 546, 554, 557,1001,1002,1004,1005];
+ if (!JSLINT(input, {passfail: false, redef:true, ignore:ignore, browser:true})) \
{ for (var i = 0; i < JSLINT.errors.length; i += 1) {
var e = JSLINT.errors[i];
if (e) {
- print(a[0]+':'+(e.line+1)+','+(e.character+1)+':'+
- ' Error '+e.errno+': '+
- //'Lint at line ' + (e.line + 1) +
- //' character ' + (e.character + 1) + ': ' +
- e.reason);
+ var type = (e.errno >= 500)?"Warning":"Error";
+ print("%s:%d,%d: %s %d:%s".format(a[0],e.line+1, e.character+1, \
type, e.errno,e.reason)); print((e.evidence || '').
replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
print('');
@@ -2689,6 +2885,17 @@
quit(1);
} else {
print("jslint: No problems found in " + a[0]);
+ JSLINT.textreport(false);
+ if (JSLINT.errors.length) {
+ for (var i = 0; i < JSLINT.errors.length; i += 1) {
+ var e = JSLINT.errors[i];
+ if (e) {
+ var type = (e.errno >= 500)?"Warning":"Error";
+ print("%s:%d,%d: %s %d:%s".format(a[0],e.line+1, e.character+1, \
type, e.errno,e.reason)); + }
+ }
+ quit(1);
+ }
quit();
}
})(arguments);
Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js (original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js Fri Dec 15 13:01:50 \
2006 @@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern kupu */
KupuEditor.prototype._getBase = function(dom) {
var base = dom.getElementsByTagName('base');
if (base.length) {
@@ -110,8 +110,6 @@
this.logMessage("Cleanup done, sending document to server");
// now create the form input
- var document = form.ownerDocument;
-
field.value = contents;
kupu.content_changed = false;
Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js (original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js Fri Dec 15 13:01:50 2006
@@ -7,11 +7,16 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern KupuButton loadDictFromXML ListTool ImageTool SourceEditTool
+ KupuSpellChecker LinkTool DrawerTool TableDrawer KupuDocument
+ KupuStateButton KupuUI DefinitionListTool AnchorTool
+ parentWithStyleChecker AnchorDrawer DummyLogger ColorchooserTool
+ KupuEditor KupuZoomTool ImageLibraryDrawer addEventHandler KupuRemoveElementButton
+ _SARISSA_IS_IE noContextMenu getFromSelector TableTool ShowPathTool
+ */
// $Id$
function initPloneKupu(editorId) {
- var topnode = getFromSelector(editorId);
var prefix = '#'+editorId+' ';
var iframe = getFromSelector(prefix+'iframe.kupu-editor-iframe');
Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupusaveonpart.js
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupusaveonpart.js (original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupusaveonpart.js Fri Dec 15 13:01:50 2006
@@ -7,7 +7,7 @@
* Contributors see CREDITS.txt.
*
*****************************************************************************/
-
+/*extern kupu */
// $Id$
function saveOnPart(evt) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic