Commit 6e45f933 authored by Neil Fraser's avatar Neil Fraser

Add option flag to supress internal CSS.

parent 2844da76
......@@ -1268,9 +1268,9 @@ Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};Blockly
// Copyright 2011 Google Inc. Apache License 2.0
Blockly.inject=function(a,b){if(!goog.dom.contains(document,a))throw"Error: container is not in current document.";b&&Blockly.parseOptions_(b);var c=function(){Blockly.createDom_(a);Blockly.init_()};if(Blockly.enableRealtime){var d=document.getElementById("realtime");d&&(d.style.display="block");Blockly.Realtime.startRealtime(c,a,Blockly.realtimeOptions)}else c()};
Blockly.parseToolboxTree_=function(a){a?("string"!=typeof a&&"undefined"==typeof XSLTProcessor&&(a=a.outerHTML),"string"==typeof a&&(a=Blockly.Xml.textToDom(a))):a=null;return a};
Blockly.parseOptions_=function(a){var b=!!a.readOnly;if(b)var c=!1,d=!1,e=!1,f=!1,g=!1,h=null;else h=Blockly.parseToolboxTree_(a.toolbox),c=Boolean(h&&h.getElementsByTagName("category").length),d=a.trashcan,void 0===d&&(d=c),e=a.collapse,void 0===e&&(e=c),f=a.comments,void 0===f&&(f=c),g=a.disable,void 0===g&&(g=c);var k=a.scrollbars;void 0===k&&(k=c);var l=a.sounds;void 0===l&&(l=!0);var p=!!a.realtime,n=p?a.realtimeOptions:void 0;Blockly.RTL=!!a.rtl;Blockly.collapse=e;Blockly.comments=f;Blockly.disable=
g;Blockly.readOnly=b;Blockly.maxBlocks=a.maxBlocks||Infinity;a.media?Blockly.pathToMedia=a.media:a.path&&(Blockly.pathToMedia=a.path+"media/");Blockly.hasCategories=c;Blockly.hasScrollbars=k;Blockly.hasTrashcan=d;Blockly.hasSounds=l;Blockly.languageTree=h;Blockly.enableRealtime=p;Blockly.realtimeOptions=n};
Blockly.createDom_=function(a){a.setAttribute("dir","LTR");goog.ui.Component.setDefaultRightToLeft(Blockly.RTL);Blockly.Css.inject();var b=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1","class":"blocklySvg"},null),c=Blockly.createSvgElement("defs",{},b),d,e;d=Blockly.createSvgElement("filter",{id:"blocklyEmboss"},c);Blockly.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",
Blockly.parseOptions_=function(a){var b=!!a.readOnly;if(b)var c=!1,d=!1,e=!1,f=!1,g=!1,h=null;else h=Blockly.parseToolboxTree_(a.toolbox),c=Boolean(h&&h.getElementsByTagName("category").length),d=a.trashcan,void 0===d&&(d=c),e=a.collapse,void 0===e&&(e=c),f=a.comments,void 0===f&&(f=c),g=a.disable,void 0===g&&(g=c);var k=a.scrollbars;void 0===k&&(k=c);var l=a.sounds;void 0===l&&(l=!0);var p=a.css;void 0===p&&(p=!0);var n=!!a.realtime,q=n?a.realtimeOptions:void 0;Blockly.RTL=!!a.rtl;Blockly.collapse=
e;Blockly.comments=f;Blockly.disable=g;Blockly.readOnly=b;Blockly.maxBlocks=a.maxBlocks||Infinity;a.media?Blockly.pathToMedia=a.media:a.path&&(Blockly.pathToMedia=a.path+"media/");Blockly.hasCategories=c;Blockly.hasScrollbars=k;Blockly.hasTrashcan=d;Blockly.hasSounds=l;Blockly.hasCss=p;Blockly.languageTree=h;Blockly.enableRealtime=n;Blockly.realtimeOptions=q};
Blockly.createDom_=function(a){a.setAttribute("dir","LTR");goog.ui.Component.setDefaultRightToLeft(Blockly.RTL);Blockly.hasCss&&Blockly.Css.inject();var b=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1","class":"blocklySvg"},null),c=Blockly.createSvgElement("defs",{},b),d,e;d=Blockly.createSvgElement("filter",{id:"blocklyEmboss"},c);Blockly.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",
stdDeviation:1,result:"blur"},d);e=Blockly.createSvgElement("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},d);Blockly.createSvgElement("fePointLight",{x:-5E3,y:-1E4,z:2E4},e);Blockly.createSvgElement("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},d);Blockly.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},d);d=Blockly.createSvgElement("filter",
{id:"blocklyTrashcanShadowFilter"},c);Blockly.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"},d);Blockly.createSvgElement("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"},d);d=Blockly.createSvgElement("feMerge",{},d);Blockly.createSvgElement("feMergeNode",{"in":"offsetBlur"},d);Blockly.createSvgElement("feMergeNode",{"in":"SourceGraphic"},d);d=Blockly.createSvgElement("filter",{id:"blocklyShadowFilter"},c);Blockly.createSvgElement("feGaussianBlur",{stdDeviation:2},
d);c=Blockly.createSvgElement("pattern",{id:"blocklyDisabledPattern",patternUnits:"userSpaceOnUse",width:10,height:10},c);Blockly.createSvgElement("rect",{width:10,height:10,fill:"#aaa"},c);Blockly.createSvgElement("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},c);Blockly.mainWorkspace=new Blockly.WorkspaceSvg(Blockly.getMainWorkspaceMetrics_,Blockly.setMainWorkspaceMetrics_);b.appendChild(Blockly.mainWorkspace.createDom());Blockly.mainWorkspace.maxBlocks=Blockly.maxBlocks;Blockly.readOnly||
......
......@@ -126,6 +126,10 @@ Blockly.parseOptions_ = function(options) {
if (hasSounds === undefined) {
hasSounds = true;
}
var hasCss = options['css'];
if (hasCss === undefined) {
hasCss = true;
}
var enableRealtime = !!options['realtime'];
var realtimeOptions = enableRealtime ? options['realtimeOptions'] : undefined;
......@@ -145,6 +149,7 @@ Blockly.parseOptions_ = function(options) {
Blockly.hasScrollbars = hasScrollbars;
Blockly.hasTrashcan = hasTrashcan;
Blockly.hasSounds = hasSounds;
Blockly.hasCss = hasCss;
Blockly.languageTree = tree;
Blockly.enableRealtime = enableRealtime;
Blockly.realtimeOptions = realtimeOptions;
......@@ -164,7 +169,9 @@ Blockly.createDom_ = function(container) {
goog.ui.Component.setDefaultRightToLeft(Blockly.RTL);
// Load CSS.
Blockly.Css.inject();
if (Blockly.hasCss) {
Blockly.Css.inject();
}
// Build the SVG DOM.
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment