Subdomain Posts
None | 2 days ago
None | 8 days ago
None | 12 days ago
None | 12 days ago
None | 17 days ago
JavaScript | 27 days ago
Python | 27 days ago
JavaScript | 27 days ago
None | 48 days ago
JavaScript | 48 days ago
Recent Posts
None | 15 sec ago
None | 30 sec ago
Power Shell | 37 sec ago
None | 43 sec ago
None | 57 sec ago
None | 1 min ago
Bash | 1 min ago
None | 1 min ago
None | 1 min ago
VisualBasic | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By -Xv on the 15th of Dec 2007 04:17:06 PM Download | Raw | Embed | Report
  1. // Use custom field input boxes if they already exist
  2.  
  3. story.getTiddlerField = function(title, field) {
  4.   var tiddlerElem = document.getElementById(this.idPrefix + title);
  5.   return this.getTiddlerFieldFromPlace(tiddlerElem, field);
  6. };
  7. story.getTiddlerFieldFromPlace = function(tiddlerElem, field) {
  8.   var e = null;
  9.   if(tiddlerElem != null) {
  10.     var children = tiddlerElem.getElementsByTagName("*");
  11.     for(var t=0; t<children.length; t++) {
  12.       var c = children[t];
  13.       if(c.tagName.toLowerCase() == "input" || c.tagName.toLowerCase() == "textarea") {
  14.         //if(!e)
  15.         //  e = c;  // -Xv: Why this code?! We may be returning a wrong input/textarea!
  16.         if(c.getAttribute("edit") == field) {
  17.           e = c;
  18.           break;  // -Xv: This break is not in the original method
  19.         }
  20.       }
  21.     }
  22.   }
  23.   return e;
  24. };
  25. story.addCustomFields = function(place,customFields) {
  26.   var fields = customFields.decodeHashMap();
  27.   var w = document.createElement("div");
  28.   w.style.display = "none";
  29.   place.appendChild(w);
  30.   for(var t in fields) {
  31.     var e = story.getTiddlerFieldFromPlace(place, t);
  32.     if (!e) {
  33.         e = document.createElement("input");
  34.         e.setAttribute("type","text");
  35.         w.appendChild(e);
  36.         e.setAttribute("edit",t);
  37.     }
  38.     e.value = fields[t];
  39.   }
  40. };
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: