Skip to content

Instantly share code, notes, and snippets.

@r-k-b
Created January 25, 2017 04:07
Show Gist options
  • Save r-k-b/588276150d28db990f024bc2ce6f3e67 to your computer and use it in GitHub Desktop.
Save r-k-b/588276150d28db990f024bc2ce6f3e67 to your computer and use it in GitHub Desktop.
Add as many nested children to a BC menu as possible.
// Run from the 'Menu' Admin UI pages, like https://foo.worldsecuresystems.com/Admin/Menus_Detail.aspx?MenuID=1234356&A=Items
(() => {
let n = 228;
function addItem(name) {
let $label = $('#ctl00_cp_uc_name');
let $selectParent = $('#ctl00_cp_uc_parentId');
let lastAncestorID = $selectParent.children('option').last().val()
$label.val(name);
$selectParent.val(lastAncestorID);
$('#ctl00_cp_uc_update').click();
}
/* function addForeverByTimer(n) {
addItem('depthlimit' + n);
setTimeout(
_ => {
console.info('next n:', n);
addForever(n + 1);
},
3e3
);
} */
let oldSticky = systemNotifications.showNormal.bind(systemNotifications);
function stickyInterceptor(title) {
console.log('n, stickyArgs:', n, arguments)
if (title.toLowerCase() === 'success') {
addItem('depthlimit' + n);
n = n + 1;
}
return oldSticky(...arguments);
}
systemNotifications.showNormal = stickyInterceptor;
addItem('depthlimit' + n);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment