diff --git a/class2context.js b/class2context.js index 56a4d80..ad0de5f 100755 --- a/class2context.js +++ b/class2context.js @@ -12,7 +12,30 @@ class2context( ); */ +/* testing this, not necessary +$( document ).ready(function() { + $(document).on('contextmenu', function (e) { + //e.preventDefault(); + ContextMenus(); + }); +});*/ + +/* MUTATION OBSERVER +--detect changes in dom, and re-asign context menus*/ +// select the target node //MUTATION DOM +var target = document.body; +var mutNum=0; +var observer = new MutationObserver(function(mutations) { + console.log("class2context.js: mutation of dom, num." + mutNum); + mutNum++; + ContextMenus(); +}); +// configuration of the observer: +var config = { attributes: true, childList: true, characterData: true }; +// pass in the target node, as well as the observer options +observer.observe(target, config); +/*