Browse Source

changing dom problem fixed, dom mutation observer added to call ContextMenus()

master
arnau 7 years ago
committed by GitHub
parent
commit
30facc9263
1 changed files with 23 additions and 0 deletions
  1. +23
    -0
      class2context.js

+ 23
- 0
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);
/* </MUTATION OBSERVER */
//creates the div where the context menus will place

Loading…
Cancel
Save