Skip to content

Instantly share code, notes, and snippets.

@bpruitt-goddard
Created April 26, 2019 17:16
Show Gist options
  • Save bpruitt-goddard/b82c119c54c7f3edfd925b6d7528bcf4 to your computer and use it in GitHub Desktop.
Save bpruitt-goddard/b82c119c54c7f3edfd925b6d7528bcf4 to your computer and use it in GitHub Desktop.
GreaseMonkey Show File Ids In CF Search Cards
// ==UserScript==
// @name CF Show FileIds In Search
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Show FAST File Id In search results
// @author Brian Pruitt-Goddard
// @match https://dev.ncwp.firstam.net/search/*
// @grant none
// @require https://raw.githubusercontent.com/uzairfarooq/arrive/master/minified/arrive.min.js
// ==/UserScript==
(function() {
'use strict';
document.arrive('div.search-result', function() {
showFileId(this);
});
function showFileId(searchCard) {
// id is something like 'searchResult-42398012'
// grab the int value
var id = searchCard.id.split('-')[1];
var idDiv = document.createElement('span');
idDiv.innerHTML = `File Id:<strong>${id}</strong>`;
idDiv.style.whiteSpace = 'nowrap';
idDiv.style.padding = '10px';
var cardTitleElement = searchCard.getElementsByClassName('search-result__title')[0];
cardTitleElement.parentNode.insertBefore(idDiv, cardTitleElement.nextSibling)
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment