Skip to content

Instantly share code, notes, and snippets.

@fiskr
Created March 9, 2015 19:54
Show Gist options
  • Save fiskr/d368e789bceb8fc8a748 to your computer and use it in GitHub Desktop.
Save fiskr/d368e789bceb8fc8a748 to your computer and use it in GitHub Desktop.
This is a bookmarklet that pop ups a simple text area to let you copy the query paths you get from CRXDE querying.
// Author: Brandon Foster
// Purpose: when you query in AEM, you can't copy and paste the paths,
// so this takes the paths from the DOM and puts them in a text area so you can copy/paste them
// Date: 20150305
function createTextarea(){
var output = document.createElement('textarea');
document.body.appendChild(output);
output.style.zIndex = 9999;
output.style.width = '550px';
output.style.height = '300px';
output.style.position = 'absolute';
output.style.background = 'white';
output.style.left = '100px';
output.style.top = '100px';
output.setAttribute('class', 'bookmarklet-query-results');
return output;
}
var string = '',
elems = document.getElementsByClassName('x-grid3-col-path');
if(elems.length > 0){
// get paths from the DOM of the query page
for(var i = 0; i< elems.length; i++){
string += (i === 0) ? elems[i].innerHTML : '\n' + elems[i].innerHTML;
}
// create your textarea
var output = createTextarea();
// fill the textarea with your output
output.innerHTML = string;
setTimeout(function(){
document.body.removeChild(output);
}, 3500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment