Skip to content

Instantly share code, notes, and snippets.

@lmmx
Created May 3, 2014 04:37
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 lmmx/a312d824c3c0f65fc823 to your computer and use it in GitHub Desktop.
Save lmmx/a312d824c3c0f65fc823 to your computer and use it in GitHub Desktop.
for (l=0;l<doilist.length;l++){
newBadge = document.createElement('div');
if (l=0 && document.querySelector('div.post').offsetLeft > 300) {lr='left';}
else {lr='right';}
newBadge.setAttribute('data-badge-popover',lr);
newBadge.setAttribute('data-badge-type','medium-donut');
newBadge.setAttribute('data-doi',doilist[l]);
newBadge.setAttribute('data-hide-no-mentions','true');
newBadge.className = "altmetric-embed";
document.getElementById('altmetBox').appendChild(newBadge);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment