Skip to content

Instantly share code, notes, and snippets.

View mittsh's full-sized avatar
🇪🇪
Tallinn, Estonia

Micha Mazaheri mittsh

🇪🇪
Tallinn, Estonia
View GitHub Profile
@mittsh
mittsh / inject.js
Created December 12, 2016 23:49 — forked from anonymous/inject.js
(function(afterEl, descriptionUrl){
var fn = function() {
console.log('ready')
var html = '<a href="#" class="oic-button" data-mode="url" data-source="swagger" data-url="' + descriptionUrl + '"><img src="https://console.rest/github.io/assets/buttons/run_with_blue.svg" style="border: none;" /></a>'
var containerTag = document.createElement('div')
containerTag.innerHTML = html
afterEl.parentNode.insertBefore(containerTag, afterEl.nextSibling)
ConsoleRest.bindModalToButtons()
}
function evaluate(context){
var request = context.getCurrentRequest();
var jsonBody = request.jsonBody;
var json = request.getJsonBodyKeyPath("build.commit_id")
var response = json.substring(5,0);
return response;
};