Advertisement
sweenig

Health Check JS

Mar 26th, 2014
415
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function editcontent(container, originalcontentcontainer) {
  2.     content = '<input type="button" style="right:110px;" value="Save as Draft" onclick="savedraft(\'' + container + '\',\'' + originalcontentcontainer + '\')" />\n';
  3.     content += '<input type="button" value="Save as Final" onclick="savefinal(\'' + container + '\',\'' + originalcontentcontainer + '\')" />\n';
  4.     content += '<textarea id="' + originalcontentcontainer + '">' + document.getElementById(originalcontentcontainer).innerHTML + '</textarea>\n';
  5.     document.getElementById(container).innerHTML = content;
  6. }
  7. function savedraft(container, newcontentcontainer) {
  8.     content = '<img id="button" src="health_check_files/edit-icon.png" onclick="editcontent(\'' + container + '\',\'' + newcontentcontainer + '\')" />\n';
  9.     content += '<div style="min-height:25px" id="' + newcontentcontainer + '">' + document.getElementById(newcontentcontainer).value + '</div>\n';
  10.     document.getElementById(container).innerHTML = content;
  11. }
  12. function savefinal(container, newcontentcontainer) {
  13.     content = '<img id="button" src="health_check_files/edit-icon.png" onclick="editcontent(\'' + container + '\',\'' + newcontentcontainer + '\')" />\n';
  14.     content += '<div id="' + newcontentcontainer + '" style="border:0px solid black;">' + document.getElementById(newcontentcontainer).value + '</div>\n';
  15.     if ((document.getElementById(newcontentcontainer).value).length>0) {
  16.         document.getElementById(container).innerHTML = content;
  17.     }
  18.     else
  19.     {
  20.         if (confirm('This will collapse this section entirely.\nThis is irreversable.\nAre you sure you want to do this?')) {document.getElementById(container).innerHTML = content;}
  21.     }
  22. }
  23. function hidehelp(helpdiv) {
  24.     if (document.getElementById(helpdiv).style.display == 'block') {
  25.         document.getElementById(helpdiv).style.display = 'none';
  26.     } else {
  27.         document.getElementById(helpdiv).style.display = 'block';
  28.     }
  29. }
Advertisement
RAW Paste Data Copied
Advertisement