Skip to content

Commit

Permalink
Added support to ONE Support Launchpad
Browse files Browse the repository at this point in the history
  • Loading branch information
dellagustin committed Mar 9, 2016
1 parent 4b60f44 commit 275fbff
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
13 changes: 11 additions & 2 deletions extensionFiles/common_ci_operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function replaceNoteInCIHeaderLine(headerLine, replaceCallback) {
});
}

function commonCIPostProcessing(myElement) {
function commonCIPostProcessing(myElement, noteLinkBuilder) {
var newHtmlForElement = myElement.html();

// Build insertion and deletion DIVs
Expand Down Expand Up @@ -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 =
'<a href="/sap/support/notes/' + sapNoteNumber +'">' + sapNoteNumber + '</a>';
'<a href="' + linkToNote +'">' + sapNoteNumber + '</a>';

return sapNoteNumber;
});
});
Expand Down
12 changes: 12 additions & 0 deletions extensionFiles/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]
}
19 changes: 19 additions & 0 deletions extensionFiles/sap_ci_launchpad_enhancer.js
Original file line number Diff line number Diff line change
@@ -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, '<br>', '\n');

thisElement.html('<code>' + newHtmlForElement + '</code>');
Prism.highlightAll();

commonCIPostProcessing(thisElement, function(noteNumber) {
return '/#/notes/' + noteNumber;
});
}
});

0 comments on commit 275fbff

Please sign in to comment.