From 275fbffceca39ce19b1fafc913a80458dae05a9a Mon Sep 17 00:00:00 2001 From: Guilherme Dellagustin Date: Thu, 10 Mar 2016 00:52:29 +0100 Subject: [PATCH] Added support to ONE Support Launchpad --- extensionFiles/common_ci_operations.js | 13 +++++++++++-- extensionFiles/manifest.json | 12 ++++++++++++ extensionFiles/sap_ci_launchpad_enhancer.js | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 extensionFiles/sap_ci_launchpad_enhancer.js diff --git a/extensionFiles/common_ci_operations.js b/extensionFiles/common_ci_operations.js index 148b4cb..22eae53 100644 --- a/extensionFiles/common_ci_operations.js +++ b/extensionFiles/common_ci_operations.js @@ -4,7 +4,7 @@ function replaceNoteInCIHeaderLine(headerLine, replaceCallback) { }); } -function commonCIPostProcessing(myElement) { +function commonCIPostProcessing(myElement, noteLinkBuilder) { var newHtmlForElement = myElement.html(); // Build insertion and deletion DIVs @@ -35,8 +35,17 @@ function commonCIPostProcessing(myElement) { // Add links to Notes in ci header newHtmlForElement = newHtmlForElement.replace(/\*\$\s.*\$\*/g, function(headerLine) { return replaceNoteInCIHeaderLine(headerLine, function(sapNoteNumber) { + var linkToNote; + if(noteLinkBuilder) { + linkToNote = noteLinkBuilder(sapNoteNumber); + } + else { + linkToNote = '/sap/support/notes/' + sapNoteNumber; + } + sapNoteNumber = - '' + sapNoteNumber + ''; + '' + sapNoteNumber + ''; + return sapNoteNumber; }); }); diff --git a/extensionFiles/manifest.json b/extensionFiles/manifest.json index ffeb922..7833331 100644 --- a/extensionFiles/manifest.json +++ b/extensionFiles/manifest.json @@ -42,6 +42,18 @@ "string_operations.js", "sap_ci_detail_enhancer.js" ] + }, + { + "matches": ["https://launchpad.support.sap.com/*"], + "all_frames": true, + "css": ["sap_note_enhancer.css"], + "js": [ + "jquery-2.1.4.min.js", + "prismABAP.js", + "string_operations.js", + "common_ci_operations.js", + "sap_ci_launchpad_enhancer.js" + ] } ] } diff --git a/extensionFiles/sap_ci_launchpad_enhancer.js b/extensionFiles/sap_ci_launchpad_enhancer.js new file mode 100644 index 0000000..e9271ed --- /dev/null +++ b/extensionFiles/sap_ci_launchpad_enhancer.js @@ -0,0 +1,19 @@ +$( document ).on('DOMNodeInserted', 'pre', function(eventObject) { + var thisElement = $(this); + + if(!thisElement.hasClass('language-abap')) { + changingPres = true; + + thisElement.addClass('language-abap'); + + var newHtmlForElement = thisElement.html(); + newHtmlForElement = replaceAll(newHtmlForElement, '
', '\n'); + + thisElement.html('' + newHtmlForElement + ''); + Prism.highlightAll(); + + commonCIPostProcessing(thisElement, function(noteNumber) { + return '/#/notes/' + noteNumber; + }); + } +});