Skip to content

Instantly share code, notes, and snippets.

View hobbes3's full-sized avatar
😅

Satoshi Kawasaki hobbes3

😅
View GitHub Profile
@hobbes3
hobbes3 / datepicker.js
Last active August 29, 2015 14:01
format time datepicker oneshot
require([
'jquery',
'underscore',
'splunkjs/mvc',
// The ready! requirement makes sure the code below runs after Splunk initialize all the objects on the dashboards
// Without it the Javascript may try to act on a Splunk object that doesn't exist yet (like trying to hide a panel before the panel is created
'splunkjs/mvc/simplexml/ready!'
],
function(
$,
@hobbes3
hobbes3 / move_inputs_to_panel_pre_61.js
Last active August 29, 2015 14:05
move inputs to panel pre 61
// Not needed in Splunk >= 6.1
// This function moves a list of input ids (jQuery format) to a panel
function move_inputs_to_panel(input_ids, panel_id) {
$(panel_id + " .panel-head").after('<div class="fieldset">');
$(panel_id + " .fieldset").append($(input_ids.join(", ")));
$(input_ids[0]).css("margin-left", "10px");
}
// Hide the first 2 fields
@hobbes3
hobbes3 / template.js
Last active August 29, 2015 14:05
splunkjs template js
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
mvc
) {
@hobbes3
hobbes3 / total_results_count.js
Last active August 29, 2015 14:05
total results count table
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
],
function(
$,
_,
mvc
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
mvc
) {
@hobbes3
hobbes3 / sticky.css
Last active August 29, 2015 14:05
sticky floating div inputs
#sticky.stick {
position: fixed;
top: 0;
z-index: 1000; /* Splunk modals are 1050 */
margin-top: 10px;
}
@hobbes3
hobbes3 / inpage_drilldown_pre_61.js
Last active August 29, 2015 14:05
inpage drilldown pre 61 tokens example
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
mvc
) {
@hobbes3
hobbes3 / hide_rows_pre_62.js
Last active August 29, 2015 14:05
hide rows pre 62 depends
// Needed for Splunk 6.1 since the "depends" attributes in <chart>, <table>, etc. doesn't hide the inputs in that panel
// I was told that the inputs within the panel can be hidden in Simple XML in Splunk 6.2
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
],
function(
$,
@hobbes3
hobbes3 / checkbox_on_off.js
Created September 7, 2014 21:58
checkbox input on or off
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
mvc
) {
@hobbes3
hobbes3 / move_paginator_to_top.js
Created September 19, 2014 04:00
move paginator to top table
// Not sure if it works with event view 100% of the time
function move_paginator_to_top(panel_id) {
var paginator = $("#" + panel_id).find("div.splunk-paginator");
var results_table = $("#" + panel_id).find("div.shared-resultstable-resultstablemaster");
$(results_table).css("clear", "both");
$(paginator).css("clear", "both");
$(results_table).before($(paginator));
}