Only run javascript on certain block
You can just get the element like this:

$variables['elements']['#id']


And then if you would of some reason need to load the block you can do like this:

$block = entity_load('block', $variables['elements']['#id']);
$block_id = $block-&gt;id;