Skip to content

Commit

Permalink
Adds highlighting to individual CI detail section
Browse files Browse the repository at this point in the history
The individual correction instruction, which can be accessed from
the Market Place is now also highlighted.

I decided to leave the background untouched, as the context,
deletion and insertion blocks are already separated.

It could be that for big CIs with big blocks it would be useful to
color them, but this is a bit more dificult in this case because
the block title is language dependent and must be read from a table
header.
  • Loading branch information
dellagustin-sap committed Jul 15, 2015
1 parent 0e40a0f commit fde9ef2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
14 changes: 13 additions & 1 deletion extensionFiles/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,17 @@
"common_ci_operations.js",
"sap_ci_overview_enhancer.js"
]
}]
},
{
"matches": ["https://*/*/bc/bsp/spn/corr_instr/correction_detail.*"],
"all_frames": true,
"css": ["sap_note_enhancer.css"],
"js": [
"jquery-2.1.4.min.js",
"prismABAP.js",
"string_operations.js",
"sap_ci_detail_enhancer.js"
]
}
]
}
27 changes: 27 additions & 0 deletions extensionFiles/sap_ci_detail_enhancer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function forEachCorrectionInstruction(callback) {
$('pre').each(function(index) {
var myElement = $( this );

callback(myElement);
});
}

$( document ).ready(function() {

forEachCorrectionInstruction(function(myElement) {
myElement.addClass('language-abap');

var newHtmlForElement = myElement.html();

newHtmlForElement = '<code>' + newHtmlForElement + '</code>';

/* Strip the script for generating new lines. If we don't do it, the following
html replacement fails and the page becomes inconsistent.
*/
newHtmlForElement = replaceAll(newHtmlForElement, '<script>document.write(\'\\r\\n\');</script>', '');

myElement.html(newHtmlForElement);
});

Prism.highlightAll();
});

0 comments on commit fde9ef2

Please sign in to comment.