/* * This file contains the JS that handles the first init of each jQuery demonstration, and also switching * between render modes. */ jsPlumb.bind("ready", function() { jsPlumb.DemoList.init(); // chrome fix. document.onselectstart = function () { return false; }; // render mode var resetRenderMode = function(desiredMode) { var newMode = jsPlumb.setRenderMode(desiredMode); $(".rmode").removeClass("selected"); $(".rmode[mode='" + newMode + "']").addClass("selected"); var disableList = (newMode === jsPlumb.VML) ? ".rmode[mode='canvas'],.rmode[mode='svg']" : ".rmode[mode='vml']"; $(disableList).attr("disabled", true); jsPlumbDemo.init(); }; $(".rmode").bind("click", function() { var desiredMode = $(this).attr("mode"); if (jsPlumbDemo.reset) jsPlumbDemo.reset(); jsPlumb.reset(); resetRenderMode(desiredMode); }); // explanation div is draggable $("#explanation,.renderMode").draggable(); resetRenderMode(jsPlumb.SVG); });