Last active
May 12, 2016 16:52
-
-
Save mcm/ce5aa2ca4eae46c785a179b7e818c965 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Splunk Cloud - Advanced Edit | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description Splunk Cloud - Advanced Edit | |
// @author Steve McMaster <mcmaster[at]hurricanelabs[.]com> | |
// @match http*://*/en-US/manager/*/data/* | |
// @match http*://*/en-US/manager/*/saved/* | |
// @grant none | |
// @require https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.0/URI.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.0/URITemplate.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var app; | |
var nsUri; | |
var segments; | |
var stanza; | |
var user; | |
var uri; | |
var nsUriTemplate = "/servicesNS/{user}/{app}/configs/conf-{conf}/{stanza}"; | |
if (typeof(jQuery) != 'undefined') { | |
var cloneLinks = $("td.col-actions a:contains('Clone')"); | |
$.each(cloneLinks, function(i, v) { | |
uri = URI(v.href); | |
nsUri = URI(uri.search(true).uri); | |
uri.query({ | |
ns: "-", | |
search: nsUri.segment(-1), | |
count: "", | |
pwnr: "", | |
s: URI.expand(nsUriTemplate, { | |
user: nsUri.segment(1), | |
app: nsUri.segment(2), | |
conf: uri.segment(4), | |
stanza: nsUri.segment(-1) | |
}).toString() | |
}); | |
uri.segment([ | |
uri.segment(0), | |
uri.segment(1), | |
uri.segment(2), | |
"saved", | |
"searches", | |
"advancededit" | |
]); | |
$(v).parent().append(" | <a href='" + uri.toString() + "'><span>Advanced Edit</span></a>"); | |
}); | |
} | |
//console.log(cloneLinks); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment