From fde9ef28a055d109facc54740da1fc151b091fd9 Mon Sep 17 00:00:00 2001 From: Guilherme Dellagustin Date: Wed, 15 Jul 2015 12:11:05 +0200 Subject: [PATCH] Adds highlighting to individual CI detail section 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. --- extensionFiles/manifest.json | 14 +++++++++++- extensionFiles/sap_ci_detail_enhancer.js | 27 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 extensionFiles/sap_ci_detail_enhancer.js diff --git a/extensionFiles/manifest.json b/extensionFiles/manifest.json index 318481a..c6e55a0 100644 --- a/extensionFiles/manifest.json +++ b/extensionFiles/manifest.json @@ -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" + ] + } + ] } diff --git a/extensionFiles/sap_ci_detail_enhancer.js b/extensionFiles/sap_ci_detail_enhancer.js new file mode 100644 index 0000000..838bcac --- /dev/null +++ b/extensionFiles/sap_ci_detail_enhancer.js @@ -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 = '' + newHtmlForElement + ''; + + /* 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, '', ''); + + myElement.html(newHtmlForElement); + }); + + Prism.highlightAll(); +});