Created
April 23, 2011 14:58
-
-
Save Mottie/938670 to your computer and use it in GitHub Desktop.
Cycle Through Visual Event Bookmarklet Layers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code I paste into the Firebug Console after I run the Visual Event | |
// bookmarklet (http://www.sprymedia.co.uk/article/Visual+Event) | |
// so I can cycle through the layers - Use arrow keys to cycle | |
var veColors = [ 'black', 'orange', 'purple', 'green', 'blue', 'yellow', 'red' ], | |
veColorLength= veColors.length - 1, | |
veLayerIndex = 0; | |
function showVeLayer(nxt){ | |
veLayerIndex += (nxt) ? 1 : -1; | |
if (veLayerIndex > veColorLength) { veLayerIndex = 0; } | |
if (veLayerIndex < 0) { veLayerIndex = veColorLength; } | |
var veLayer = $('.Event_bg_' + veColors[veLayerIndex]); | |
if (veLayer.length === 0 ) { showVeLayer(nxt); return; } | |
$('.Event_bg_' + veColors.join(', .Event_bg_')).hide(); | |
veLayer.show(); | |
}; | |
$(document).keyup(function(e){ | |
switch(e.which){ | |
case 39: case 40: // right/down | |
showVeLayer(true); | |
break; | |
case 37: case 38: // left/up | |
showVeLayer(); | |
break; | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment