Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 16, 2015 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/56b777d9131074dc9a92 to your computer and use it in GitHub Desktop.
Save bjoerntx/56b777d9131074dc9a92 to your computer and use it in GitHub Desktop.
var interval;
// after the complete ribbon is loaded, "listen" to the
// "Insert Merge Field" drop-down to see whether the
// database is loaded completely
TXTextControl.addEventListener("ribbonTabsLoaded", function (e) {
interval = setInterval(SetScrollbars, 500);
});
// if button doesn't have the "disabled" class anymore
function SetScrollbars() {
if (!$("#drpDnBtnInsertMergeField").hasClass("ui-state-disabled")) {
clearInterval(interval);
// find the last "ul" element and set the height and
// overflow properties
$("#insertMergeFieldDropDown").find("li").each(function () {
$(this).find("ul").last().css({
"max-height": "150px",
"overflow-y": "scroll",
"width": $(this).width() + 50
});
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment