Skip to content

Instantly share code, notes, and snippets.

@philipmat
Created September 6, 2011 04:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipmat/1196552 to your computer and use it in GitHub Desktop.
Save philipmat/1196552 to your computer and use it in GitHub Desktop.
Books24x7 page cleanup
d = document;
function p(n){return n.parentNode}
function $(x){return d.getElementById(x)}
function $t(x){return d.getElementsByTagName(x)}
function $c(x){return d.getElementsByClassName(x)}
function $r(n){p(n).removeChild(n)}
if (d.location.href.indexOf('mobile.books24x7') != -1 ) {
while($t('link').length != 1) {
l = $t('link');
for(var i = 0; i < l.length; i++) if (l[i].href.indexOf('grison') == -1) $r(l[i]);
}
/* removes all navigation as well
while($c('b24-navmenu').length != 0) {
var l = $c('b24-navmenu')[0];
$r(l);
}
//*/
c = $c('chapter')[0];
} else {
$r(p(p($('ctl00_logoline'))));
$r($('MenuTD'));
c = $c('admon-title');
for(var i=0;i<c.length;i++) c[i].style.display='none';
c = $('ctl00_ContentPlaceHolder1_ContentAreaUpdatePanel');
}
n=p(c);n.appendChild(c);
while(n.childElementCount != 1) n.removeChild(n.children[0]);
// bookmarklet:
// javascript:(function() { ... })();
// javascript:(function() { d = document; function p(n){return n.parentNode} function $(x){return d.getElementById(x)} function $t(x){return d.getElementsByTagName(x)} function $c(x){return d.getElementsByClassName(x)} function $r(n){p(n).removeChild(n)} if (d.location.href.indexOf('mobile.books24x7') != -1 ) { while($t('link').length != 1) { l = $t('link'); for(var i = 0; i < l.length; i++) if (l[i].href.indexOf('grison') == -1) $r(l[i]); } while($c('b24-navmenu').length != 0) { var l = $c('b24-navmenu')[0]; $r(l); } c = $c('chapter')[0]; } else { $r(p(p($('ctl00_logoline')))); $r($('MenuTD')); c = $c('admon-title'); for(var i=0;i<c.length;i++) c[i].style.display='none'; c = $('ctl00_ContentPlaceHolder1_ContentAreaUpdatePanel'); } n=p(c);n.appendChild(c); while(n.childElementCount != 1) n.removeChild(n.children[0]); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment