diff --git a/caddy/etc/Caddyfile b/caddy/etc/Caddyfile new file mode 100644 index 0000000..21c38b0 --- /dev/null +++ b/caddy/etc/Caddyfile @@ -0,0 +1,8 @@ +http://blockly.localhost { + root /var/www/html/blockly-games/ + file_server +} + +http://moodle.localhost { + reverse_proxy moodle:8000 +} diff --git a/docker-compose.yml b/docker-compose.yml index 975794d..2c52503 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,16 @@ services: + static_sites: + image: caddy:alpine + container_name: static_sites_caddy + restart: always + volumes: + - ./html:/var/www/html + - ./caddy/etc/Caddyfile:/etc/caddy/Caddyfile + ports: + - "80:80" + expose: + - 80 + moodle_db: image: mariadb:10 container_name: moodle_db @@ -12,7 +24,7 @@ services: moodle: image: moodlehq/moodleapp:latest ports: - - "80:443" + - "8000:80" expose: - 443 environment: diff --git a/html/blockly-games/about.html b/html/blockly-games/about.html new file mode 100644 index 0000000..81bd55f --- /dev/null +++ b/html/blockly-games/about.html @@ -0,0 +1,134 @@ + + +
+ +Blockly Games is a series of educational games that teach programming. It is +designed for children who have not had prior experience with computer programming. +By the end of these games, players are ready to use conventional text-based languages.
+ +
+
+ |
+
+ Puzzle is a quick introduction to Blockly's shapes and how the pieces snap together. + |
+
+
+ |
+
+ Maze is an introduction to loops and conditionals. It starts simply, but +every level is more challenging than the last. + |
+
+
+ |
+
+ Bird is a deep-dive into conditionals. Control-flow is explored with +increasingly complex conditions. + |
+
+
+ |
+
+ Turtle is a deep-dive into loops. Use nested loops to paint a picture. +Then publish your art for the world to see. + |
+
+
+ |
+
+ Movie is an introduction to mathematical equations. Use math to animate a movie. +Then publish your movie for the world to watch. + |
+
+
+ |
+
+ Music is an introduction to functions. Use functions to compose music. +Then publish your music for the world to listen to. + |
+
+
+ |
+
+ Pond Tutor introduces text-based programming. Levels switch back and forth +between blocks and actual JavaScript in a text editor. + |
+
+
+ |
+
+ Pond is an open-ended contest to program the smartest duck. +Use either blocks or JavaScript. + |
+
Blockly Games is a Google project to encourage tomorrow's programmers. The +games are designed to be self-paced and self-teaching. Feel free to use Blockly +Games both inside and outside the classroom. All code is open source, see +the developer's website +for more info or to download zip files for offline use.
+ +Developers, teachers and parents are welcome to +give feedback +as we continue to grow.
+ ++ Google Privacy Policy — + Google Terms of Service +
+ + + + + + + diff --git a/html/blockly-games/bird.html b/html/blockly-games/bird.html new file mode 100644 index 0000000..df0bd96 --- /dev/null +++ b/html/blockly-games/bird.html @@ -0,0 +1,15 @@ + + + + + + +'+ +((Yc?'':'')+"Jogos do Blockly : "+T({appName:"P\u00e1ssaro"}.appName)+""),c=" ",d=1;11>d;d++)c+=" "+(d==Q?''+T(d)+"":10==d?''+T(d)+"":'');return a+c+' |
![]() | |
| Trocar o \u00e2ngulo da dire\u00e7\u00e3o para que o p\u00e1ssaro pegue a minhoca e aterrisse em seu ninho. |
![]() | Usar este bloco para ir em uma posi\u00e7\u00e3o se voc\u00ea tiver a minhoca, ou uma posi\u00e7\u00e3o diferente se voc\u00ea n\u00e3o tiver a minhoca. | ![]() |
![]() | 'x' e sua posi\u00e7\u00e3o horizontal atual. Use este bloco para ir em uma dire\u00e7\u00e3o se 'x' for menor que um numero, ou uma dire\u00e7\u00e3o diferente caso contr\u00e1rio. | ![]() |
![]() | Clique no \u00edcone para modificar o bloco \'se\'. | ![]() |
![]() | Este n\u00edvel precisa de um bloco 'sen\u00e3o se' e de um bloco 'sen\u00e3o'. | ![]() |
![]() | O bloco "e" somente \u00e9 verdadeiro se as duas entradas forem verdadeiras. | ![]() |
![]() | Puxe um bloco "sen\u00e3o" em cima do bloco "se". |
':5>Q?' ':' ';X.rC(f,!1);ee();gd("runButton",fe);gd("resetButton",ge); +setTimeout(function(){K(C,function(){he()});he()},5E3);8 90<")&&-1!=c.indexOf("bird_heading")||h.T.isVisible()||(g={width:"370px",top:"140px"},g[a?"right":"left"]="215px",f=D(C,!0),f=f.length?f[0].aa():d[0].aa());else if(2==Q)-1==c.indexOf("bird_noWorm")&&(g={width:"350px",top:"170px"},g[a?"right":"left"]="180px",f=d[1].aa());else if(4==Q)-1==c.indexOf("bird_compare")&&(g={width:"350px", +top:"230px"},g[a?"right":"left"]="180px",f=d[2].aa());else if(5==Q){if(ie||(ie=setInterval(he,100)),-1==c.indexOf("mutation else")){f=D(C,!1);for(g=0;(d=f[g])&&"controls_if"!=d.type;g++);d.se.isVisible()?(e=document.getElementById("dialogMutatorHelp"),f=d.se.s.O.tl[1],c=h.g.style.zh(f),g={width:"340px",top:c.y+60+"px"},g.left=c.x-(a?310:0)+"px"):(c=h.g.style.zh(d.aa()),g={width:"340px",top:c.y+100+"px"},g.left=c.x-(a?280:0)+"px",f=d.aa())}}else if(6==Q){if(-1==c.indexOf("mutation")){f=D(C,!1);for(g= +0;(d=f[g])&&"controls_if"!=d.type;g++);c=h.g.style.zh(d.aa());g={width:"350px",top:c.y+220+"px"};g.left=c.x-(a?350:0)+"px";f=d.aa()}}else 8==Q&&-1==c.indexOf("bird_and")&&(g={width:"350px",top:"360px"},g[a?"right":"left"]="450px",f=d[4].aa());g?e.parentNode!=document.getElementById("dialog")&&W.Sl(e,f,!0,!1,g,null):W.Oc(!1)}} +function ee(){for(var a=0;ah.g.I.ng(S,Z.nd))throw md.push(["play","quack",null]),me(Z.nd),md.push(["finish",null]),!0;!ld&&Z.zc&&15>h.g.I.ng(S,Z.zc)&&(me(Z.zc),md.push(["worm",null]),md.push(["play","worm",null]),ld=!0);a:{for(d=0;e=Z.xc[d];d++)if(6>e.ng(S)){d=!0;break a}d=!1}if(d)throw md.push(["play","whack",null]),!1;}));a.setProperty(c,"noWorm", +a.createNativeFunction(function(){return!ld}));a.setProperty(c,"getX",a.createNativeFunction(function(){return S.x}));a.setProperty(c,"getY",a.createNativeFunction(function(){return S.y}))} +function ke(){if("Interpreter"in window){md=[];h.selected&&mb(h.selected);var a=Oc(),c=a.indexOf("if ("),d=a.indexOf("}\n");-1!=c&&-1!=d&&(a=a.substring(c,d+2));c=0;a=new Interpreter("while(true) {\n"+a+"}",le);try{for(d=1E5;a.step();)if(0>=d--)throw Infinity;c=-1}catch(e){Infinity===e?c=2:!0===e?c=1:!1===e?c=-2:(c=-2,window.alert(e))}id=1==c?10:15;ee();be.push(setTimeout(ne,1))}else setTimeout(ke,250)} +function ne(){be=[];var a=md.shift();a?(X.Dn(a.pop()),"move"==a[0]||"goto"==a[0]?(S.x=a[1],S.y=a[2],jd=a[3],ce="move"==a[0]?2:1,je()):"worm"==a[0]?document.getElementById("worm").style.visibility="hidden":"finish"==a[0]?(ce=3,je(),X.rD(),W.MA()):"play"==a[0]&&C.Bd.play(a[1],.5),be.push(setTimeout(ne,5*id))):X.Dn(null)} +function je(){var a=hd(kd-jd);10>=Math.abs(a)?kd=jd:(kd+=0>a?10:-10,kd=hd(kd));var c=(14-Math.round(kd/360*12))%12,d=kd%30;15<=d&&(d-=30);d*=-1;if(1==ce)var e=0;else if(3==ce)e=3;else if(2==ce)e=Math.round(Date.now()/100)%3;else throw Error("Unknown pose.");a=S.x/100*400-60;var f=400*(1-S.y/100)-60,g=document.getElementById("bird");g.setAttribute("x",a-120*c);g.setAttribute("y",f-120*e);g.setAttribute("transform","rotate("+d+", "+(a+60)+", "+(f+60)+")");c=document.getElementById("clipRect");c.setAttribute("x", +a);c.setAttribute("y",f)}function me(a){var c=Math.round(h.g.I.ng(S,a));a=hd(h.g.Lb.wx(Math.atan2(a.y-S.y,a.x-S.x)));for(var d=h.g.Lb.li(a),e=0;e img, +button.secondary>img { + opacity: 1; +} +button>img { + opacity: 0.6; + vertical-align: text-bottom; +} +button:hover:not(:disabled)>img { + opacity: 1; +} +button:active:not(:disabled) { + border: 1px solid #888 !important; +} +button:hover:not(:disabled) { + box-shadow: 2px 2px 5px #888; +} + +/* Dialogs */ +#dialog { + visibility: hidden; + background-color: #fff; + color: #000; + border: 1px solid #ccc; + position: absolute; + border-radius: 8px; + box-shadow: 5px 5px 5px #888; + padding: 10px; +} +#dialogBorder { + visibility: hidden; + position: absolute; + background-color: #fff; + color: #000; + border: 1px solid #000; + border-radius: 6px; + box-shadow: 5px 5px 5px #888; +} +#dialogShadow { + visibility: hidden; + position: fixed; + top: 0; + left: 0; + height: 100%; + width: 100%; + background-color: #000; + opacity: 0.3 +} +.dialogAnimate { + transition-property: width height left top opacity; + transition-duration: 0.2s; + transition-timing-function: linear; +} +.dialogHiddenContent { + visibility: hidden; + position: absolute; + top: 0; + left: 0; + z-index: -1; +} +#dialogHeader { + height: 25px; + margin: -10px -10px 15px; + border-top-left-radius: 8px; + border-top-right-radius: 8px; + background-color: #ddd; + cursor: move; +} +#dialog button { + min-width: 4em; +} +.readonly .blocklyMainBackground { + stroke: none; +} +#galleryForm>header { + font-size: larger; +} +#galleryForm>footer { + font-size: smaller; +} +#galleryForm>* { + margin-top: 1em; + margin-left: 1em; + margin-right: 1em; +} diff --git a/html/blockly-games/common/help.png b/html/blockly-games/common/help.png new file mode 100644 index 0000000..2dae19b Binary files /dev/null and b/html/blockly-games/common/help.png differ diff --git a/html/blockly-games/common/loading.gif b/html/blockly-games/common/loading.gif new file mode 100644 index 0000000..31d7ee0 Binary files /dev/null and b/html/blockly-games/common/loading.gif differ diff --git a/html/blockly-games/common/prettify.css b/html/blockly-games/common/prettify.css new file mode 100644 index 0000000..d44b3a2 --- /dev/null +++ b/html/blockly-games/common/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} \ No newline at end of file diff --git a/html/blockly-games/common/prettify.js b/html/blockly-games/common/prettify.js new file mode 100644 index 0000000..7b99049 --- /dev/null +++ b/html/blockly-games/common/prettify.js @@ -0,0 +1,30 @@ +!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a= +b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a 122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f =2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k =5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com", +/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+ +s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/, +q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d= +c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i =0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"], +O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/, +V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^]+/],["dec",/^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-", +/^ ]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^ + + + +