Bookmarklet for changing visible number of iRules in VS resource management

Problem this snippet solves:

When selecting iRules from the list of available ones during creation or modification of a virtual server in the GUI I found it rather tedious that the displayed list is only five lines high, so I created a JavaScript bookmarklet to be able to change it. I have tested the bookmarklet in Firefox, Chrome, Internet Explorer and Edge.

Sorry for the tags, but I had to select some to be able to submit the code.

How to use this snippet:

Firefox and Chrome: Create a new bookmark by right-clicking the bookmark toolbar in your browser. Enter a name to your liking and copy the code below into the URL field.

Internet Explorer 11: A bit trickier as it does not allow you to create a new bookmark directly. You have to bookmark a random page and then edit its properties by right-clicking.

Edge: You have to bookmark a random page, then open your Favourites with Ctrl-I. Right-click the bookmark you just created, and now you can rename it and edit the URL so it contains the code.

The configuration options within the GUI are in general embedded via an iframe. The code takes the size of the two relevant select tags with the IDs "assigned_rules" (these are the enabled iRules) and "rule_references" (these are the available iRules), and changes their size (ie the number of lines displayed) from the default value of 5 to a custom value, in this case 15. This can be adjusted by changing the mySize variable.

The size of the select field (ie the number of lines displayed) can be changed by editing the variable mySize. The script changes

Code :

javascript:(function SelectResize(){var mySize=15;var iframe=document.getElementById('contentframe');var selectAR=iframe.contentWindow.document.getElementById('assigned_rules');var selectRR=iframe.contentWindow.document.getElementById('rule_references');selectAR.size=mySize;selectRR.size=mySize;})();

Tested this on version:

No Version Found
Published Apr 25, 2020
Version 1.0

Was this article helpful?

No CommentsBe the first to comment