demo-helper-mootools.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * This file contains the JS that handles the first init of each MooTools demonstration, and also switching
  3. * between render modes.
  4. */
  5. jsPlumb.bind("ready", function() {
  6. // chrome fix.
  7. document.onselectstart = function () { return false; };
  8. // render mode
  9. var resetRenderMode = function(desiredMode) {
  10. var newMode = jsPlumb.setRenderMode(desiredMode);
  11. $$(".rmode").each(function(e) { e.removeClass("selected"); });
  12. $$(".rmode[mode='" + newMode + "']").each(function(e) { e.addClass("selected"); });
  13. var disableList = (newMode === jsPlumb.VML) ? ".rmode[mode='canvas'],.rmode[mode='svg']" : ".rmode[mode='vml']";
  14. $$(disableList).each(function(e) {
  15. e.set("disabled", true);
  16. });
  17. jsPlumbDemo.init();
  18. };
  19. $$(".rmode").each(function(r) {
  20. r.addEvent("click", function() {
  21. var desiredMode = $(this).get("mode");
  22. if (jsPlumbDemo.reset) jsPlumbDemo.reset();
  23. jsPlumb.reset();
  24. resetRenderMode(desiredMode);
  25. });
  26. });
  27. resetRenderMode(jsPlumb.CANVAS);
  28. });