- textarea.cancel.style.display = "none";
-
- /*
- * JSON.stringify isn't built to be nice to functions. The following fixes
- * this.
- *
- * First, val.toString only does part of the work, turning it into
- * "function () {\n alert(\"p-click!\");\n}",
- *
- * {start,end}Marker make the surrounding quotes easy to find, and then
- * remove them. It also converts the instances of \n and \" so the
- * result looks like:
- * function () {
- * alert("p-click!");
- * }",
- */
- var startMarker = "<~%!<";
- var endMarker = ">!%~>";
- var replacer = function(key, val) {
- if (typeof val === 'function') {
- return startMarker + val.toString() + endMarker;
- }
- return val;
- }
- var text = JSON.stringify(hash, replacer, 2);
- while(true) {
- var start = text.indexOf(startMarker);
- var end = text.indexOf(endMarker);
- if (start == -1) {
- break;
- }
- var substring = text.substring(start + startMarker.length, end);
- while(substring.indexOf("\\n") >= 0) {
- substring = substring.replace("\\n", "\n");
+
+ var hashToString = function(hash) {
+ /*
+ * JSON.stringify isn't built to be nice to functions. The following fixes
+ * this.
+ *
+ * First, val.toString only does part of the work, turning it into
+ * "function () {\n alert(\"p-click!\");\n}",
+ *
+ * {start,end}Marker make the surrounding quotes easy to find, and then
+ * remove them. It also converts the instances of \n and \" so the
+ * result looks like:
+ * function () {
+ * alert("p-click!");
+ * }",
+ */
+ var startMarker = "<~%!<";
+ var endMarker = ">!%~>";
+ var replacer = function(key, val) {
+ if (typeof val === 'function') {
+ return startMarker + val.toString() + endMarker;
+ }
+ return val;