source: main/trunk/greenstone3/web/interfaces/default/js/visual-xml-editor.js@ 26927

Last change on this file since 26927 was 26927, checked in by sjm84, 11 years ago

Adding a new visual editor

File size: 22.9 KB
Line 
1// ********************************************************************** //
2// Visual XML Editor //
3// This class represents an editor that allows you to modify XML visually //
4// ********************************************************************** //
5
6function visualXMLEditor(xmlString)
7{
8 var _globalID = 0;
9
10 var _xml;
11
12 var _mainDiv = $("<div>", {"id":"veMainDiv"});
13 var _toolboxDiv = $("<div>", {"id":"veToolboxDiv"});
14 var _editorContainer = $("<div>", {"id":"veEditorContainer"});
15 var _editorDiv = $("<div>", {"id":"veEditorDiv"});
16 var _infoDiv = $("<div>", {"id":"veInfoDiv"});
17 var _rootElement;
18 var _selectedElement;
19
20 var _validDropSpot = false;
21 var _validDropType;
22 var _validDropElem;
23
24 var _origDDParent;
25 var _origDDPosition;
26
27 var _overList = new Array();
28 _overList.freeSpaces = new Array();
29
30 this.getXML = function()
31 {
32 return _xml;
33 }
34
35 var populateToolbar = function()
36 {
37 var elemList =
38 {
39 keys:["html", "xsl", "gsf"], // NEED TO ADD GSLIB AT SOME POINT
40 html:["a", "div", "li", "script", "span", "table", "td", "tr", "ul"],
41 xsl:
42 [
43 "apply-imports", "apply-templates", "attribute", "attribute-set", "call-template",
44 "choose", "copy", "copy-of", "decimal-format", "element",
45 "fallback", "for-each", "if", "import", "include",
46 "key", "message", "namespace-alias", "number", "otherwise",
47 "output", "param", "preserve-space", "processing-instruction", "sort",
48 "strip-space", "stylesheet", "template", "text", "transform",
49 "value-of", "variable", "when", "with-param"
50 ],
51 gsf:
52 [
53 "cgi-param", "choose-metadata", "collectionText", "displayItem", "displayText",
54 "equivlinkgs3", "foreach-metadata", "icon", "if-metadata-exists", "image",
55 "interfaceText", "link", "meta-value", "metadata", "script",
56 "style", "switch", "template", "text", "variable"
57 ],
58 };
59
60 var tabHolder = $("<ul>");
61 _toolboxDiv.append(tabHolder);
62
63 for(var i = 0; i < elemList.keys.length; i++)
64 {
65 var key = elemList.keys[i];
66 var currentList = elemList[key];
67
68 var tab = $("<li>");
69 var tabLink = $("<a>", {"href":"#ve" + key});
70 tabLink.css({"font-size":"0.9em", "padding":"5px"});
71 tabLink.text(key);
72 tab.append(tabLink);
73 tabHolder.append(tab);
74
75 var tabDiv = $("<div>", {"id":"ve" + key});
76 for(var j = 0; j < currentList.length; j++)
77 {
78 var elemName = currentList[j];
79
80 var ns = (key == "html") ? "" : (key + ":");
81
82 var newElem = _xml.createElement(ns + elemName);
83 var veElement = new VEElement(newElem);
84 var veDiv = veElement.getDiv();
85 veDiv.css("float", "none");
86 veDiv.data("toolbar", true);
87 tabDiv.append(veDiv);
88 }
89
90 _toolboxDiv.append(tabDiv);
91 }
92
93 var otherTab = $("<li>");
94 var otherTabLink = $("<a>", {"href":"#veother"});
95 otherTabLink.css({"font-size":"0.9em", "padding":"5px"});
96 otherTabLink.text("other");
97 otherTab.append(otherTabLink);
98 tabHolder.append(otherTab);
99
100 var otherTabDiv = $("<div>", {"id":"veother"});
101 var textNode = _xml.createTextNode("text");
102 var textVEElement = new VEElement(textNode);
103 var textDiv = textVEElement.getDiv();
104 textDiv.css("float", "none");
105 textDiv.data("toolbar", true);
106 otherTabDiv.append(textDiv);
107
108 var customInput = $("<input type=\"text\">");
109 var customElemHolder = $("<div>");
110 var customCreateButton = $("<button>Create element</button>");
111 customCreateButton.click(function()
112 {
113 var elemName = customInput.val();
114 if(elemName.length)
115 {
116 var elem = _xml.createElement(elemName);
117 var veElement = new VEElement(elem);
118 var customElemDiv = veElement.getDiv();
119 customElemDiv.css("float", "none");
120 customElemDiv.data("toolbar", true);
121 customElemHolder.empty();
122 customElemHolder.append(customElemDiv);
123 }
124 });
125 otherTabDiv.append(customInput);
126 otherTabDiv.append(customCreateButton);
127 otherTabDiv.append(customElemHolder);
128
129 _toolboxDiv.append(otherTabDiv);
130
131 _toolboxDiv.tabs();
132 }
133
134 var constructDivsRecursive = function(currentDiv, currentParent, level)
135 {
136 if(!level)
137 {
138 level = 1;
139 }
140
141 var container = $("<div>");
142 container.addClass("veContainerElement");
143 currentDiv.append(container);
144
145 var allowedList = new Array();
146 var counter = currentParent.firstChild;
147 while(counter)
148 {
149 if(counter.nodeType == 1)
150 {
151 allowedList.push(counter)
152 }
153 else if(counter.nodeType == 3 && counter.nodeValue.search(/\S/) != -1)
154 {
155 allowedList.push(counter)
156 }
157 counter = counter.nextSibling;
158 }
159
160 var width = 100 / allowedList.length;
161 for(var i = 0; i < allowedList.length; i++)
162 {
163 var currentElement = allowedList[i];
164
165 var veElement = new VEElement(currentElement);
166 var elementDiv = veElement.getDiv();
167 veElement.setWidth(width);
168
169 if(!_rootElement)
170 {
171 _rootElement = elementDiv;
172 }
173
174 container.append(elementDiv);
175 if(currentElement.firstChild)
176 {
177 constructDivsRecursive(elementDiv, currentElement, level + 1);
178 }
179
180 currentElement = currentElement.nextSibling;
181 }
182
183 container.append($("<div>", {"style":"clear:both;"}));
184 }
185
186 this.selectRootElement = function()
187 {
188 var height = _editorDiv.height() + 10;
189 if(height < 300){height = 300;}
190
191 _editorContainer.css("height", height + "px");
192 _infoDiv.css("height", height + "px");
193 _rootElement.trigger("click");
194 }
195
196 this.getMainDiv = function()
197 {
198 return _mainDiv;
199 }
200
201 var addToOverList = function(veElement)
202 {
203 for(var i = 0; i < _overList.length; i++)
204 {
205 if(!_overList[i])
206 {
207 continue;
208 }
209
210 if(_overList[i].getID() == veElement.getID())
211 {
212 return false;
213 }
214 }
215
216 if(_overList.freeSpaces.length > 0)
217 {
218 _overList[_overList.freeSpaces.pop()] = veElement;
219 }
220 else
221 {
222 _overList.push(veElement);
223 }
224 }
225
226 var removeFromOverList = function(veElement)
227 {
228 for(var i = 0; i < _overList.length; i++)
229 {
230 if(!_overList[i])
231 {
232 continue;
233 }
234
235 if(_overList[i].getID() == veElement.getID())
236 {
237 delete _overList[i];
238 _overList.freeSpaces.push(i);
239 }
240 }
241 }
242
243 var getDeepestOverElement = function()
244 {
245 if(_overList.length == 0)
246 {
247 return null;
248 }
249
250 var deepestVal = 0;
251 var deepestElem = _overList[0];
252
253 for(var i = 0; i < _overList.length; i++)
254 {
255 if(!_overList[i])
256 {
257 continue;
258 }
259
260 var depth = _overList[i].getDiv().parents(".veElement").length;
261 depth = (depth) ? depth : 0;
262
263 if (depth > deepestVal)
264 {
265 deepestVal = depth;
266 deepestElem = _overList[i];
267 }
268 }
269
270 return deepestElem;
271 }
272
273 var resizeAll = function()
274 {
275 var filterFunction = function()
276 {
277 var toolbarStatus = $(this).data("toolbar");
278 var beingDraggedStatus = $(this).data("dragging");
279
280 if(beingDraggedStatus || !toolbarStatus)
281 {
282 return true;
283 }
284
285 return false;
286 }
287
288 var allElems = $(".veElement").filter(filterFunction).each(function()
289 {
290 if($(this).data("helper")){return;}
291
292 var size = $(this).data("expanded");
293 if(size == "small")
294 {
295 var width = (10 / ($(this).siblings(".veElement").filter(function(){return !($(this).data("helper"))}).length - 1));
296 $(this).css("width", width + "%");
297 }
298 else if(size == "normal")
299 {
300 var width = (100 / ($(this).siblings(".veElement").filter(function(){return !($(this).data("helper"))}).length + 1));
301 $(this).css("width", width + "%");
302 }
303 else if(size == "expanded")
304 {
305 $(this).css("width", "90%");
306 }
307 });
308 }
309
310 var initVXE = function()
311 {
312 try
313 {
314 _xml = $.parseXML('<testContainer xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil" xmlns:gslib="http://www.greenstone.org/skinning" xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat">' + xmlString + "</testContainer>");
315 constructDivsRecursive(_editorDiv, _xml.firstChild);
316 }
317 catch(error)
318 {
319 console.log(error);
320 return null;
321 }
322
323 populateToolbar();
324
325 _editorContainer.append(_editorDiv);
326 _mainDiv.append(_toolboxDiv);
327 _mainDiv.append(_editorContainer);
328 _mainDiv.append($("<div>", {"id":"veSpacerDiv"}));
329 _mainDiv.append(_infoDiv);
330 _mainDiv.append($("<div>", {"style":"clear:both;"}));
331 }
332
333 // *********************************************************************** //
334 // Visual Editor Attribute //
335 // This inner class represents a single xml attribute in the visual editor //
336 // *********************************************************************** //
337
338 var VEAttribute = function(attrElem, xmlElem, name, value)
339 {
340 var _name;
341 if(name)
342 {
343 _name = name;
344 }
345 else if(attrElem && attrElem.name)
346 {
347 _name = attrElem.name;
348 }
349
350 var _value;
351 if(value)
352 {
353 _value = value;
354 }
355 else if(attrElem && attrElem.value)
356 {
357 _value = attrElem.value;
358 }
359
360 var _xmlElem = xmlElem;
361 var _row;
362
363 this.getName = function()
364 {
365 return _name;
366 }
367
368 this.getValue = function()
369 {
370 return _value;
371 }
372
373 var createNameCell = function()
374 {
375 var cell = $("<td>", {"class":"veNameCell"});
376 cell.text(_name);
377 return cell;
378 }
379
380 var createValueCell = function()
381 {
382 var cell = $("<td>", {"class":"veValueCell"});
383 cell.text(_value);
384 return cell;
385 }
386
387 var createEditCell = function()
388 {
389 var cell = $("<td>", {"class":"veEditCell"});
390 var link = $("<a href=\"javascript:;\">edit</a>");
391 link.click(function()
392 {
393 var nameCell = cell.parent().children("td").eq(0);
394 var valueCell = cell.parent().children("td").eq(1);
395 if(link.text() == "edit")
396 {
397 link.text("save edit");
398
399 var nameInput = $("<input type=\"text\">");
400 nameInput.width(nameCell.width() - 5);
401 nameInput.val(_name);
402
403 var valueInput = $("<input type=\"text\">");
404 valueInput.width(valueCell.width() - 5);
405 valueInput.val(_value);
406
407 nameCell.text("");
408 valueCell.text("");
409
410 nameCell.append(nameInput);
411 valueCell.append(valueInput);
412 }
413 else
414 {
415 link.text("edit");
416
417 var nameInput = nameCell.children("input");
418 var valueInput = valueCell.children("input");
419
420 var name = nameInput.val();
421 var value = valueInput.val();
422
423 nameCell.empty();
424 nameCell.text(name);
425
426 valueCell.empty();
427 valueCell.text(value);
428
429 if(nameCell.data("prevName") != "")
430 {
431 _xmlElem.removeAttribute(_name);
432 }
433 _xmlElem.setAttribute(name, value);
434
435 _name = name;
436 _value = value;
437 }
438 });
439 cell.append(link);
440 return cell;
441 }
442
443 var createDeleteCell = function()
444 {
445 var cell = $("<td>", {"class":"veDeleteCell"});
446 var link = $("<a href=\"javascript:;\">delete</a>");
447 link.click(function()
448 {
449 _xmlElem.removeAttribute(_name);
450 _row.remove();
451 });
452 cell.append(link);
453 return cell;
454 }
455
456 this.getAsTableRow = function()
457 {
458 var tableRow = $("<tr>");
459
460 var attributeName = createNameCell();
461 tableRow.append(attributeName);
462
463 var attributeValue = createValueCell();
464 tableRow.append(attributeValue);
465
466 var editCell = createEditCell()
467 tableRow.append(editCell);
468
469 var deleteCell = createDeleteCell();
470 tableRow.append(deleteCell);
471
472 _row = tableRow;
473
474 return tableRow;
475 }
476 }
477
478 // ********************************************************************************** //
479 // Visual Editor Element //
480 // This inner class represents a single xml element or text node in the visual editor //
481 // ********************************************************************************** //
482 var VEElement = function(xml)
483 {
484 var _div = $("<div>");
485 var _xmlNode = xml;
486 var _id = _globalID++;
487
488 _div.data("parentVEElement", this);
489 _div.data("expanded", "normal");
490
491 var makeDraggable = function()
492 {
493 _div.draggable(
494 {
495 "revert":"true",
496 "helper":function()
497 {
498 //Make sure the cursor is put in the centre of the div
499 var height = _div.children(".veTitleElement").height();
500 _div.draggable("option", "cursorAt", {top:(height / 2), left:(_div.width() / 2)});
501
502 var tempVEE = new VEElement(_xmlNode);
503 var tempDiv = tempVEE.getDiv();
504 tempDiv.css("border", "1px solid orangered");
505 tempDiv.css("background", "orange");
506 tempDiv.width(_div.width());
507 tempDiv.data("helper", true);
508 return tempDiv;
509 },
510 "cursor":"move",
511 "appendTo":_mainDiv,
512 "start":function(event, ui)
513 {
514 _origDDParent = _div.parent();
515 _origDDPosition = _div.index();
516
517 _div.siblings(".veElement").filter(function(){return !($(this).data("helper"))}).data("expanded", "normal");
518 _div.css("border", "1px solid orangered");
519 _div.data("prevBackground", _div.css("background"));
520 _div.css("background", "orange");
521 _div.css("float", "left");
522
523 _div.data("dragging", true);
524 if(_div.data("toolbar"))
525 {
526 var cloneElem = new VEElement(_xmlNode.cloneNode(true));
527 var cloneDiv = cloneElem.getDiv();
528 cloneDiv.css("float", "none");
529 cloneDiv.data("toolbar", true);
530 _div.before(cloneDiv);
531 }
532 _div.detach();
533
534 resizeAll();
535 },
536 "drag":function(event, ui)
537 {
538 var foundDefined = false;
539 for(var i = 0; i < _overList.length; i++)
540 {
541 if(!(_overList[i] === "undefined"))
542 {
543 foundDefined = true;
544 }
545 }
546
547 _validDropSpot = false;
548 if(foundDefined)
549 {
550 var overElement = getDeepestOverElement();
551 if(overElement)
552 {
553 _validDropSpot = true;
554 var overDiv = overElement.getDiv();
555
556 var overLeft = overDiv.offset().left;
557 var helperLeft = ui.helper.offset().left;
558 var helperMiddle = helperLeft + (ui.helper.width() / 2);
559
560 var overContainers = overDiv.children(".veContainerElement");
561 if(!overContainers.length)
562 {
563 overDiv.append($("<div>", {"class":"veContainerElement"}));
564 overContainers = overDiv.children(".veContainerElement");
565 }
566 var overChildren = overContainers.children(".veElement").filter(function(){return !($(this).data("helper")) && !(_div.data("parentVEElement").getID() == $(this).data("parentVEElement").getID())});
567 var overChildrenLength = overChildren.length + 1;
568
569 if(!overChildren.length)
570 {
571 _validDropElem = overDiv;
572 _validDropType = "into";
573 overContainers.append(_div);
574 }
575 else
576 {
577 var posPercent = (helperMiddle - overLeft) / overDiv.width();
578 if(posPercent < 0)
579 {
580 posPercent = 0;
581 }
582 else if(posPercent > 1)
583 {
584 posPercent = 1;
585 }
586 var pos = Math.floor(overChildrenLength * posPercent);
587
588 if(pos < overChildrenLength - 1)
589 {
590 _validDropElem = overChildren.eq(pos);
591 _validDropType = "before";
592 overChildren.eq(pos).before(_div);
593 }
594 else
595 {
596 _validDropElem = overChildren.eq(pos - 1);
597 _validDropType = "after";
598 overChildren.eq(pos - 1).after(_div);
599 }
600 }
601
602 overChildren.data("expanded", "normal");
603 _div.data("expanded", "normal");
604
605 resizeAll();
606 }
607 }
608 },
609 "stop":function(event, ui)
610 {
611 _div.data("dragging", false);
612 _div.data("toolbar", false);
613
614 _div.css("border", "1px dashed black");
615 _div.css("background", _div.data("prevBackground"));
616
617 //If the element was not dropped in a valid place then put it back
618 if(!_validDropSpot)
619 {
620 if(_origDDPosition == 0)
621 {
622 _origDDParent.prepend(_div);
623 }
624 else if(_origDDPosition == _origDDParent.children(".veElement").length - 1)
625 {
626 _origDDParent.children(".veElement").eq(_origDDPosition - 1).after(_div);
627 }
628 else
629 {
630 _origDDParent.children(".veElement").eq(_origDDPosition).before(_div);
631 }
632
633 resizeAll();
634 }
635 //Otherwise modify the XML
636 else
637 {
638 var xmlNode = _validDropElem.data("parentVEElement").getXMLNode();
639 if(_validDropType == "before")
640 {
641 $(xmlNode).before(_xmlNode);
642 }
643 else if (_validDropType == "after")
644 {
645 $(xmlNode).after(_xmlNode);
646 }
647 else if (_validDropType == "into")
648 {
649 $(xmlNode).append(_xmlNode);
650 }
651 }
652 }
653 });
654
655 _div.droppable(
656 {
657 "over":function(event)
658 {
659 addToOverList($(this).data("parentVEElement"));
660 event.stopPropagation();
661 },
662 "out":function(event)
663 {
664 removeFromOverList($(this).data("parentVEElement"));
665 event.stopPropagation();
666 }
667 });
668 }
669
670 this.getDiv = function()
671 {
672 return _div;
673 }
674
675 this.getXMLNode = function()
676 {
677 return _xmlNode;
678 }
679
680 this.getID = function()
681 {
682 return _id;
683 }
684
685 var createTableHeader = function()
686 {
687 var tableHeader = $("<tr>");
688 tableHeader.html("<td class=\"veNameCell\">Name</td><td class=\"veValueCell\">Value</td>");
689 return tableHeader;
690 }
691
692 this.populateInformationDiv = function()
693 {
694 _infoDiv.empty();
695
696 var nameElement = $("<p>");
697 if(_xmlNode.nodeType == 1)
698 {
699 nameElement.text("Name: " + _xmlNode.nodeName);
700 }
701 else
702 {
703 nameElement.text("[text node]");
704 }
705 _infoDiv.append(nameElement);
706
707 if(_xmlNode.nodeType == 1)
708 {
709 var attributeTableTitle = $("<p>Attributes:<p/>");
710 var attributeTable = $("<table>");
711 attributeTable.addClass("veAttributeTableContainer");
712
713 attributeTable.append(createTableHeader());
714
715 $(_xmlNode.attributes).each(function()
716 {
717 var veAttribute = new VEAttribute(this, _xmlNode);
718 attributeTable.append(veAttribute.getAsTableRow());
719 });
720
721 _infoDiv.append(attributeTableTitle);
722 _infoDiv.append(attributeTable);
723
724 var addButton = $("<button>Add attribute</button>");
725 addButton.click(function()
726 {
727 var newAtt = new VEAttribute(null, _xmlNode, "", "");
728 attributeTable.append(newAtt.getAsTableRow());
729 });
730 _infoDiv.append(addButton);
731 }
732
733 if(_xmlNode.nodeType == 3)
734 {
735 var textEditor = $("<div>");
736 var textTitle = $("<div>Text:</div>");
737 var nodeText = $("<div>");
738 nodeText.text(_xmlNode.nodeValue);
739
740 textEditor.append(textTitle);
741 textEditor.append(nodeText);
742
743 _infoDiv.append(textEditor);
744
745 var editButton = $("<button>edit text</button>");
746 editButton.click(function()
747 {
748 if(editButton.text() == "edit text")
749 {
750 var textArea = $("<textarea>");
751 textArea.val(nodeText.text());
752 nodeText.text("");
753 nodeText.append(textArea);
754 editButton.text("save edit");
755 }
756 else
757 {
758 var textArea = nodeText.find("textarea");
759 var newValue = textArea.val();
760 _xmlNode.nodeValue = newValue;
761 nodeText.empty();
762 nodeText.text(newValue);
763 editButton.text("edit text");
764 }
765 });
766
767 textEditor.append(editButton);
768 }
769
770 _infoDiv.append($("<br>"));
771 _infoDiv.append($("<br>"));
772
773 var removeButton = $("<button>Delete this element</button>");
774 _infoDiv.append(removeButton);
775 removeButton.click(function()
776 {
777 var divParent = _div.parents(".veElement");
778 $(_xmlNode).remove();
779 _div.remove();
780 _infoDiv.empty();
781
782 if(divParent.length)
783 {
784 divParent.first().trigger("click");
785 }
786 });
787 }
788
789 var addMouseEvents = function()
790 {
791 _div.mouseover(function(event)
792 {
793 event.stopPropagation();
794 _div.css("border", "1px solid orange");
795 var titleString = " ";
796 if(_xmlNode.nodeType == 1)
797 {
798 for(var i = 0; i < _xmlNode.attributes.length; i++)
799 {
800 var current = _xmlNode.attributes[i];
801 var name = current.name;
802 var value = current.value;
803
804 titleString += name + "=\"" + value + "\" ";
805 }
806 }
807 else if(_xmlNode.nodeType == 3)
808 {
809 titleString = _xmlNode.nodeValue;
810 }
811 _div.attr("title", titleString);
812 });
813 _div.mouseout(function(event)
814 {
815 _div.css("border", "1px dashed black");
816 event.stopPropagation();
817 });
818 _div.click(function(event)
819 {
820 if(_selectedElement)
821 {
822 _selectedElement.css("border", _selectedElement.prevBorder);
823 }
824 _selectedElement = _div;
825 _div.prevBorder = _div.css("border");
826 _div.css("border", "red solid 1px");
827
828 _div.data("parentVEElement").focus();
829 _div.data("parentVEElement").populateInformationDiv();
830
831 event.stopPropagation();
832 });
833 }
834
835 this.expand = function()
836 {
837 var siblings = _div.siblings(".veElement");
838 if(!(_div.data("expanded") == "expanded") && siblings.length && siblings.length > 0)
839 {
840 var sibWidth = 10 / siblings.length;
841 siblings.each(function()
842 {
843 $(this).animate({width:sibWidth + "%"}, 900);
844 $(this).data("expanded", "small");
845 });
846
847 _div.animate({width:"90%"}, 1000);
848 _div.data("expanded", "expanded");
849 }
850 }
851
852 this.evenlyDistributeChildren = function()
853 {
854 var children = _div.find(".veElement")
855 .each(function()
856 {
857 $(this).data("expanded", "normal");
858 var length = $(this).siblings(".veElement").filter(function(){return !($(this).data("helper"))}).length + 1;
859 $(this).css("width", (100 / length) + "%");//$(this).animate({"width":(100 / length) + "%"}, 900);
860 });
861 }
862
863 this.focus = function()
864 {
865 _div.data("parentVEElement").expand();
866
867 var parents = _div.parents(".veElement");
868 parents.each(function()
869 {
870 $(this).data("parentVEElement").expand();
871 });
872
873 _div.data("parentVEElement").evenlyDistributeChildren();
874 }
875
876 this.setWidth = function(width)
877 {
878 _div.css("width", width + "%");
879 }
880
881 //Visual Editor Element constructor
882 var initVEE = function()
883 {
884 _div.addClass("veElement");
885 makeDraggable();
886
887 var titleText;
888 if(_xmlNode.nodeType == 3 && _xmlNode.nodeValue.search(/\S/) != -1)
889 {
890 _div.addClass("veTextElement");
891 titleText = "[text]";
892 }
893 else if (_xmlNode.nodeType == 1)
894 {
895 if(_xmlNode.tagName.search(/^xsl/) != -1)
896 {
897 _div.addClass("veXSLElement");
898 }
899 else if(_xmlNode.tagName.search(/^gsf/) != -1)
900 {
901 _div.addClass("veGSFElement");
902 }
903 else if(_xmlNode.tagName.search(/^gslib/) != -1)
904 {
905 _div.addClass("veGSLIBElement");
906 }
907 else
908 {
909 _div.addClass("veHTMLElement");
910 }
911 titleText = _xmlNode.tagName;
912 }
913
914 addMouseEvents();
915
916 _div.append("<div class=\"veTitleElement\">" + titleText + "</div>");
917 }
918
919 initVEE();
920 }
921
922 //Call the constructor
923 initVXE();
924}
Note: See TracBrowser for help on using the repository browser.