Skip to content

Instantly share code, notes, and snippets.

@cephcyn
Last active September 12, 2016 17:29
Show Gist options
  • Save cephcyn/ed3214955a74d7542bb3423d954496df to your computer and use it in GitHub Desktop.
Save cephcyn/ed3214955a74d7542bb3423d954496df to your computer and use it in GitHub Desktop.
Bookmarklet to "un-compress" a MSN slideshow, removing the images and placing all text into a single paragraph.
(function() {
var el=document.createElement('div'),
b=document.getElementsByTagName('body')[0],
otherlib=false,
msg='';
el.style.position='fixed';
el.style.height='32px';
el.style.width='220px';
el.style.marginLeft='-110px';
el.style.top='0';
el.style.left='50%';
el.style.padding='5px 10px';
el.style.zIndex = 1001;
el.style.fontSize='12px';
el.style.color='#222';
el.style.backgroundColor='#f99';
if(typeof jQuery!='undefined') {
msg='This page already using jQuery v'+jQuery.fn.jquery;
return showMsg();
} else if (typeof $=='function') {
otherlib=true;
}
// more or less stolen form jquery core and adapted by paul irish
function getScript(url,success){
var script=document.createElement('script');
script.src=url;
var head=document.getElementsByTagName('head')[0],
done=false;
// Attach handlers for all browsers
script.onload=script.onreadystatechange = function(){
if ( !done && (!this.readyState
|| this.readyState == 'loaded'
|| this.readyState == 'complete') ) {
done=true;
success();
script.onload = script.onreadystatechange = null;
head.removeChild(script);
}
};
head.appendChild(script);
}
getScript('http://code.jquery.com/jquery.min.js',function() {
if (typeof jQuery=='undefined') {
msg='Sorry, but jQuery wasn\'t able to load';
} else {
msg='This page is now jQuerified with v' + jQuery.fn.jquery;
if (otherlib) {msg+=' and noConflict(). Use $jq(), not $().';}
}
return showMsg();
});
function showMsg() {
el.innerHTML=msg;
b.appendChild(el);
window.setTimeout(function() {
if (typeof jQuery=='undefined') {
b.removeChild(el);
} else {
jQuery(el).fadeOut('slow',function() {
jQuery(this).remove();
});
if (otherlib) {
$jq=jQuery.noConflict();
}
}
} ,2500);
}
// My Code Starts
$('.gallerydata').addClass('show');
// My Code Ends
})();
//JQuerify from http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
//so msn doesnt like jquerify fml
javascript:(function(){var%20el=document.createElement('div'),b=document.getElementsByTagName('body')[0],otherlib=false,msg='';el.style.position='fixed';el.style.height='32px';el.style.width='220px';el.style.marginLeft='-110px';el.style.top='0';el.style.left='50%';el.style.padding='5px%2010px';el.style.zIndex=1001;el.style.fontSize='12px';el.style.color='#222';el.style.backgroundColor='#f99';if(typeof%20jQuery!='undefined'){msg='This%20page%20already%20using%20jQuery%20v'+jQuery.fn.jquery;return%20showMsg()}else%20if(typeof%20$=='function'){otherlib=true}function%20getScript(url,success){var%20script=document.createElement('script');script.src=url;var%20head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success();script.onload=script.onreadystatechange=null;head.removeChild(script)}};head.appendChild(script)}getScript('http://code.jquery.com/jquery.min.js',function(){if(typeof%20jQuery=='undefined'){msg='Sorry,%20but%20jQuery%20wasn\'t%20able%20to%20load'}else{msg='This%20page%20is%20now%20jQuerified%20with%20v'+jQuery.fn.jquery;if(otherlib){msg+='%20and%20noConflict().%20Use%20$jq(),%20not%20$().'}}return%20showMsg()});function%20showMsg(){el.innerHTML=msg;b.appendChild(el);window.setTimeout(function(){if(typeof%20jQuery=='undefined'){b.removeChild(el)}else{jQuery(el).fadeOut('slow',function(){jQuery(this).remove()});if(otherlib){$jq=jQuery.noConflict()}}},2500)}$('.gallerydata').addClass('show')})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment