Posted by -Xv on Sat 15 Dec 16:17
report abuse | download | new post
- // Use custom field input boxes if they already exist
- story.getTiddlerField = function(title, field) {
- var tiddlerElem = document.getElementById(this.idPrefix + title);
- return this.getTiddlerFieldFromPlace(tiddlerElem, field);
- };
- story.getTiddlerFieldFromPlace = function(tiddlerElem, field) {
- var e = null;
- if(tiddlerElem != null) {
- var children = tiddlerElem.getElementsByTagName("*");
- for(var t=0; t<children.length; t++) {
- var c = children[t];
- if(c.tagName.toLowerCase() == "input" || c.tagName.toLowerCase() == "textarea") {
- //if(!e)
- // e = c; // -Xv: Why this code?! We may be returning a wrong input/textarea!
- if(c.getAttribute("edit") == field) {
- e = c;
- break; // -Xv: This break is not in the original method
- }
- }
- }
- }
- return e;
- };
- story.addCustomFields = function(place,customFields) {
- var fields = customFields.decodeHashMap();
- var w = document.createElement("div");
- w.style.display = "none";
- place.appendChild(w);
- for(var t in fields) {
- var e = story.getTiddlerFieldFromPlace(place, t);
- if (!e) {
- e = document.createElement("input");
- e.setAttribute("type","text");
- w.appendChild(e);
- e.setAttribute("edit",t);
- }
- e.value = fields[t];
- }
- };
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.