javascript to add colored-coded diff
authorLuc Moreau <l.moreau@ecs.soton.ac.uk>
Wed, 21 Nov 2012 00:29:31 +0000
changeset 4879 d758f4512962
parent 4875 3be7c8fa2c89
child 4880 17d6e95a6265
javascript to add colored-coded diff
model/prov-dm.html
model/prov-n.html
--- a/model/prov-dm.html	Tue Nov 20 23:53:49 2012 +0000
+++ b/model/prov-dm.html	Wed Nov 21 00:29:31 2012 +0000
@@ -57,6 +57,27 @@
 	From http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/
 */
 
+function setContributors () {
+    $('dt').each(function(index) {
+        var content=$(this).text();
+        if (content== "Authors:") {
+         console.log( "content " +  content);
+         $(this).text("Contributors:")
+        }
+    })
+}
+
+function setColoredDiffs () {
+    $('dt').each(function(index) {
+        var content=$(this).text();
+        if (content== "Previous version:") {
+         console.log( "content " +  content);
+	  $(this).next().append(" ").append($('<a>').attr('href','diff.html').append("(colored-coded diff)"));
+        }
+    })
+}
+
+
 function getElementsByClassName(oElm, strTagName, oClassNames){
 	var arrElements = (! (! (strTagName == "*") || ! (oElm.all)))? oElm.all : oElm.getElementsByTagName(strTagName);
 	var arrReturnElements = new Array();
@@ -445,7 +466,7 @@
           // Add extraReferences to bibliography database
           preProcess: [addExtraReferences, addProvReferences],
 
-          postProcess: [updateSectionRefs, updateDfn, updateFigures, checkLinksToW3CReports],
+          postProcess: [updateSectionRefs, updateDfn, updateFigures, checkLinksToW3CReports, setContributors, setColoredDiffs],
       };
     </script> 
   <style type="text/css">
--- a/model/prov-n.html	Tue Nov 20 23:53:49 2012 +0000
+++ b/model/prov-n.html	Wed Nov 21 00:29:31 2012 +0000
@@ -42,6 +42,26 @@
     <script src="http://www.w3.org/2007/OWL/toggles.js" class="remove"></script> 
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" class="remove"></script>
     <script class="remove">
+function setContributors () {
+    $('dt').each(function(index) {
+        var content=$(this).text();
+        if (content== "Authors:") {
+         console.log( "content " +  content);
+         $(this).text("Contributors:")
+        }
+    })
+}
+
+function setColoredDiffs () {
+    $('dt').each(function(index) {
+        var content=$(this).text();
+        if (content== "Previous version:") {
+         console.log( "content " +  content);
+	  $(this).next().append(" ").append($('<a>').attr('href','diff-n.html').append("(colored-coded diff)"));
+        }
+    })
+}
+
 function insertProductionDefinition(doc, content, name) {
 
 	var xml=$.parseXML(content);
@@ -277,7 +297,7 @@
 
           // Add extraReferences to bibliography database
           preProcess: [addExtraReferences, addProvReferences],
-          postProcess: [checkLinksToW3CReports],
+          postProcess: [checkLinksToW3CReports, setContributors, setColoredDiffs],
       };
     </script>