Skip to content

Instantly share code, notes, and snippets.

@r-k-b
Last active May 26, 2016 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-k-b/1b89a057231055fb0f231b304df8a78e to your computer and use it in GitHub Desktop.
Save r-k-b/1b89a057231055fb0f231b304df8a78e to your computer and use it in GitHub Desktop.
Show List IDs in BC Admin
// ==UserScript==
// @name Show List IDs in BC Admin
// @namespace https://gist.github.com/r-k-b/
// @version 1.0.0
// @description Show the ID of all visible list items. Works on most lists in BC.
// @author Robert K. Bell
// @homepage https://gist.github.com/r-k-b/1b89a057231055fb0f231b304df8a78e
// @downloadURL https://gist.github.com/r-k-b/1b89a057231055fb0f231b304df8a78e/raw/show-list-IDs-in-BC-admin.user.js
// @include *://*/*
// @grant none
// @run-at context-menu
// ==/UserScript==
/* jshint esnext: true */
(() => {
jQuery.each(
[
'a.treenode', // Expandable tree views, e.g. Classifications
'.item-list > a', // List views, e.g. Pages
'.rgMasterTable td > a' // List views, e.g. Page Templates
],
function (index, elem) {
jQuery(elem).each(function (index, element) {
try {
if (!jQuery(element).data('already-grabbed-the-id')) {
jQuery(element).html(
'#' +
jQuery(element).attr('href').split('=')[1] +
' - ' +
jQuery(element).html()
);
jQuery(element).data('already-grabbed-the-id', true);
}
} catch (TypeError) {
// todo: error handling?
}
});
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment