--- a/web/data/cubicweb.htmlhelpers.js Thu Jul 09 15:15:18 2009 +0200
+++ b/web/data/cubicweb.htmlhelpers.js Thu Jul 09 15:18:19 2009 +0200
@@ -16,6 +16,7 @@
return '';
}
+// XXX this is used exactly ONCE in web/views/massmailing.py
function insertText(text, areaId) {
var textarea = jQuery('#' + areaId);
if (document.selection) { // IE
@@ -40,6 +41,7 @@
}
/* taken from dojo toolkit */
+// XXX this looks unused
function setCaretPos(element, start, end){
if(!end){ end = element.value.length; } // NOTE: Strange - should be able to put caret at start of text?
// Mozilla
@@ -72,30 +74,30 @@
}
}
+
+// XXX this looks unused
function setProgressMessage(label) {
var body = document.getElementsByTagName('body')[0];
body.appendChild(DIV({id: 'progress'}, label));
jQuery('#progress').show();
}
+// XXX this looks unused
function resetProgressMessage() {
var body = document.getElementsByTagName('body')[0];
jQuery('#progress').hide();
}
-/* set body's cursor to 'progress'
- */
+/* set body's cursor to 'progress' */
function setProgressCursor() {
var body = document.getElementsByTagName('body')[0];
body.style.cursor = 'progress';
}
-/*
- * reset body's cursor to default (mouse cursor). The main
+/* reset body's cursor to default (mouse cursor). The main
* purpose of this function is to be used as a callback in the
- * deferreds' callbacks chain.
- */
+ * deferreds' callbacks chain. */
function resetCursor(result) {
var body = document.getElementsByTagName('body')[0];
body.style.cursor = 'default';
@@ -138,7 +140,7 @@
*/
function firstSelected(selectNode) {
var selection = filter(attrgetter('selected'), selectNode.options);
- return (selection.length>0) ? getNodeAttribute(selection[0], 'value'):null;
+ return (selection.length > 0) ? getNodeAttribute(selection[0], 'value'):null;
}
/* toggle visibility of an element by its id
@@ -149,22 +151,12 @@
/* toggles visibility of login popup div */
+// XXX used exactly ONCE
function popupLoginBox() {
toggleVisibility('popupLoginBox');
jQuery('#__login:visible').focus();
}
-/*
- * return true (resp. false) if <element> (resp. doesn't) matches <properties>
- */
-function elementMatches(properties, element) {
- for (prop in properties) {
- if (getNodeAttribute(element, prop) != properties[prop]) {
- return false;
- }
- }
- return true;
-}
/* returns the list of elements in the document matching the tag name
* and the properties provided
@@ -175,9 +167,13 @@
* list() function)
*/
function getElementsMatching(tagName, properties, /* optional */ parent) {
- var filterfunc = partial(elementMatches, properties);
parent = parent || document;
- return filter(filterfunc, parent.getElementsByTagName(tagName));
+ return filter(function elementMatches(element) {
+ for (prop in properties) {
+ if (getNodeAttribute(element, prop) != properties[prop]) {
+ return false;}}
+ return true;},
+ parent.getElementsByTagName(tagName));
}
/*
@@ -197,9 +193,8 @@
forEach(filter(filterfunc, elements), function(cb) {cb.checked=checked;});
}
-/*
- * centers an HTML element on the screen
- */
+/* centers an HTML element on the screen */
+// XXX looks unused
function centerElement(obj){
var vpDim = getViewportDimensions();
var elemDim = getElementDimensions(obj);
@@ -228,15 +223,9 @@
function isTextNode(domNode) { return domNode.nodeType == 3; }
function isElementNode(domNode) { return domNode.nodeType == 1; }
+// XXX this looks unused
function changeLinkText(link, newText) {
jQuery(link).text(newText);
-// for (var i=0; i<link.childNodes.length; i++) {
-// var node = link.childNodes[i];
-// if (isTextNode(node)) {
-// swapDOM(node, document.createTextNode(newText));
-// break;
-// }
-// }
}
@@ -248,6 +237,7 @@
}
}
+// XXX this looks unused
function limitTextAreaSize(textarea, size) {
var $area = jQuery(textarea);
$area.val($area.val().slice(0, size));
@@ -257,7 +247,7 @@
CubicWeb.rounded = [
['div.sideBoxBody', 'bottom 6px'],
- ['div.boxTitle, div.boxPrefTitle, div.sideBoxTitle, th.month', 'top 6px'],
+ ['div.boxTitle, div.boxPrefTitle, div.sideBoxTitle, th.month', 'top 6px']
];