Bookmarklet for displaying Jive content IDs

Blog Post created by mcollinge on Dec 7, 2016

This is something we've been using on our site for a while; I've updated the code so that I can share it with fellow Jive developers. Bookmarklets are browser bookmarks that contain JavaScript code. When you click the bookmark, it'll run the JavaScript against the page you're looking at, which comes in really handy!


What I've developed here is a bookmarklet that will display a panel at the top left of your Jive site.. the panel will contain the IDs of the content & Place you're looking at, and give you links to the full JSON object via a REST call. This kind of thing is really handy if you're regularly working with the REST API.


Here's how it looks;



1. Create a new bookmark


2. Edit the bookmark and paste in the JavaScript below



3. Go to your Jive site (or JiveWorks) and click the bookmark to display the panel


Here's the JavaScript...


javascript:var html='';var;var;var currentContainerName='';if(typeof(e14CurrentContainer)!=='undefined');var contentInfo=$j('.jive-content:first');if(contentInfo.length==0||typeof('object-id'))==='undefined')contentInfo=$j('.bookmark-controls');if(contentInfo.length>0){var'object-id');var'object-type');if(typeof(contentID)==='undefined'&&typeof(e14CurrentObject)!=='undefined'){;contentType=e14CurrentObject.objectType;}if(typeof(contentID)!=='undefined'){html+='Content type: '+contentType+', ID: '+contentID+'. ';html+='<a href="'+_jive_base_url+'/api/core/v3/contents?filter=entityDescriptor('+contentType+','+contentID+')" target="_blank">REST</a>';html+='<br>';}}html+='Container type: '+currentContainerType+', ID: '+currentContainerID;if(>-1)html+=', Browse ID: ';if(currentContainerName!=='')html+=', Name: '+currentContainerName+'.';if(currentContainerType!=3){html+=' <a href="'+_jive_base_url+'/api/core/v3/places?filter=entityDescriptor('+currentContainerType+','+currentContainerID+')" target="_blank">REST</a>';}else{html+=' <a href="'+_jive_base_url+'/api/core/v3/people/'+currentContainerID+'" target="_blank">REST</a>';}html+='<br>';$j('.e14-page-info').remove();$j('body').prepend('<div style="border:1px solid grey; height: 25px; font-size: 10px; padding: 5px; position: fixed; display: block; top: 10px; left: 10px; z-index: 10; background: white;" class="e14-page-info">'+html+'</div>');void(0);


If you're interested in the uncompressed source, here it is (to use this in a bookmarklet, you'll need to run it through a service like this);


var html = '';

var currentContainerID =;
var currentContainerType =;

var currentContainerName = '';
if (typeof(e14CurrentContainer)!=='undefined') currentContainerName =;

var contentInfo = $j('.jive-content:first'); // Try the jive-content class first
if (contentInfo.length==0 || typeof('object-id'))==='undefined') contentInfo = $j('.bookmark-controls'); // Next try the social action link

if (contentInfo.length>0) {
  var contentID ='object-id');
  var contentType ='object-type');

  // We can get at blog container if we're on element14 Community 
  if (typeof(contentID)==='undefined' && typeof(e14CurrentObject)!=='undefined') {
  contentID =;
  contentType = e14CurrentObject.objectType;

  if (typeof(contentID)!=='undefined') {
  html += 'Content type: '+contentType+', ID: '+contentID+'. ';
  html += '<a href="'+_jive_base_url+'/api/core/v3/contents?filter=entityDescriptor('+contentType+','+contentID+')" target="_blank">REST</a>';
  html += '<br>';

html += 'Container type: '+currentContainerType+', ID: '+currentContainerID;
if (>-1) html+=', Browse ID: ';
if (currentContainerName!=='') html += ', Name: '+currentContainerName + '.';
if (currentContainerType!=3) {
  html += ' <a href="'+_jive_base_url+'/api/core/v3/places?filter=entityDescriptor('+currentContainerType+','+currentContainerID+')" target="_blank">REST</a>';
} else {
  html += ' <a href="'+_jive_base_url+'/api/core/v3/people/'+currentContainerID+'" target="_blank">REST</a>';
html += '<br>';

$j('body').prepend('<div style="border:1px solid grey; height: 25px; font-size: 10px; padding: 5px; position: fixed; display: block; top: 10px; left: 10px; z-index: 10; background: white;" class="e14-page-info">'+html+'</div>');