Skip to content

Instantly share code, notes, and snippets.

@hedgerh
Created July 23, 2014 06:13
Show Gist options
  • Select an option

  • Save hedgerh/cdb1e7b0689d14ab1185 to your computer and use it in GitHub Desktop.

Select an option

Save hedgerh/cdb1e7b0689d14ab1185 to your computer and use it in GitHub Desktop.
/**
* Content script for the Soundcloud Following page.
*/
(function() {
// replace the user list with the following template
document.onreadystatechange = function() {
if (document.readyState === "complete") {
setTimeout(function() {
var contentDiv = document.querySelector('.usersList');
var parentDiv = document.querySelector('.g-main-scroll-area');
parentDiv.removeChild(contentDiv);
chrome.runtime.sendMessage({
template: 'groups/groups'
}, function(response) {
var newDiv = document.createElement('div');
newDiv.innerHTML = response;
parentDiv.insertBefore(newDiv, parentDiv.childNodes[0]);
// angular needs to be bootstrapped manually
var angularDiv = document.querySelector('body');
angularDiv.classList.add('ng-app');
angularDiv.classList.add('ng-csp');
angular.bootstrap(angularDiv, ['SESApp']);
});
}, 2000);
}
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment