Skip to content

Instantly share code, notes, and snippets.

@sys1yagi
Forked from tomorrowkey/bookmarklet
Created November 9, 2012 09:42
Show Gist options
  • Save sys1yagi/4044841 to your computer and use it in GitHub Desktop.
Save sys1yagi/4044841 to your computer and use it in GitHub Desktop.
expand all tree on google site's sitemap. auto!
javascript:(function(){var t = 1000;var r = 3;var s = function(k){return document.getElementsByClassName('goog-tree-expand-icon-'+k);};var d = function(p){var e=document.createEvent('MouseEvents');e.initMouseEvent('mousedown',true,true,window,0,0,0,0,0,false,false,false,false,0,null);while(p.length>0){p[0].dispatchEvent(e);}};var c = function(){var p=s("tplus");var ps = p.length;d(p);var l=s("lplus");var ls = l.length;d(l);if(r>0){if(ps + ls == 0){console.log("retry");r--;}setTimeout(function(){c();}, t);}};c();})();
(function(){
var t = 1000;
var r = 3;
var s = function(k){
return document.getElementsByClassName('goog-tree-expand-icon-'+k);
};
var d = function(p){
var e=document.createEvent('MouseEvents');
e.initMouseEvent('mousedown',true,true,window,0,0,0,0,0,false,false,false,false,0,null);
while(p.length>0){
p[0].dispatchEvent(e);
}
};
var c = function(){
var p=s("tplus");
var ps = p.length;
d(p);
var l=s("lplus");
var ls = l.length;
d(l);
if(r>0){
if(ps + ls == 0){
console.log("retry");
r--;
}
setTimeout(function(){
c();
}, t);
}
};
c();
})();
@tomorrowkey
Copy link

わーい、やったー!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment