[Chrome Extension] AI2Helper - download all blocks seperately and remove all orphan blocks with one click

can't we download individual blocks (method, property) from extension?

function downloadPNGIgnoreOrphan(){
			var topblocks=Blockly.getMainWorkspace().getTopBlocks();
			var blocks=topblocks.filter((block)=>{
				return types.indexOf(block.type)>=0
			});
			if(confirm("Are you sure to download all " + blocks.length + " blocks?")){

				var i=0;
				var timer=setTimeout(function(){
					if(i<blocks.length){
						exportBlockAsPng(blocks[i]);
						i++;
						timer=setTimeout(arguments.callee,1000)
					}
				},1000);
			}
		}

change
return types.indexOf(block.type)>=0
to
return types.indexOf(block.type)>=-1

this should be working, not tested.

2 Likes

It worked, thanks @Kevinkun!