I\'ve got an HTML page that is compiled dynamically from a database that I need to restyle and restructure. It looks messy, I know, but what I\'m working with is this (note: no
You could insert jQuery from the bookmarklet, and then it's rather easy:
function a() {
var names = {'h1': 'one',
'h2': 'two',
'h3': 'three',
'h4': 'four',
'h5': 'five',
'h6': 'six'};
var i = 1;
jQuery('*').filter(":header").each(function() {
jQuery(this)
.add(jQuery(this)
.nextUntil( jQuery("*")
.filter(":header")) )
.wrapAll( jQuery("") );
});
};
(function(){
var s=document.createElement('script');
s.src='http://code.jquery.com/jquery-1.6.1.js';
document.getElementsByTagName('head')[0].appendChild(s);
s.onload = function(){
setTimeout(a, 500);
};
})();
Or, in one line:
javascript:function a(){var b={h1:"one",h2:"two",h3:"three",h4:"four",h5:"five",h6:"six"};jQuery("*").filter(":header").each(function(){jQuery(this).add(jQuery(this).nextUntil(jQuery("*").filter(":header"))).wrapAll(jQuery(""))})}(function(){var b=document.createElement("script");b.src="http://code.jquery.com/jquery-1.6.1.js";document.getElementsByTagName("head")[0].appendChild(b);b.onload=function(){setTimeout(a,500)}})();