Lively Kernel canvas
// this script is evaluated on world load
null
http://lively-kernel.org/repository/lively-wiki/dipr6.xhtmlnull0.004329004329004329
nullfalsetruenullfalse
fixworldhelperfunctions[doit]falsenullfalse
false
false
nullfalse
localrequirements[doit]falsetruefalsetrue0false
initializer[doit]falsetruefalsetrue0false
ArrayandURLextension[doit]falsetruefalsetrue0false
fixworldhelperfunctions[doit]falsetruefalsetrue0false313.00001499999996null3nulltruetruetrue
00.11
true
null
null
null
nulltrue
true
-----falsetruefalsetrue0false313.00001499999996null
-1nullnulltruetruetrue
00.11
true
null
null
null
nulltrue
true
20null
findScriptEndingWith=function(string,scripts){return$A(scripts).detect(function(node){varurl=node.getAttribute('xlink:href');returnurl&&url.endsWith(string)})}removeScriptEndingWith=function(string,scripts){varscript=findScriptEndingWith(string,scripts);if(script)script.parentElement.removeChild(script)}removeNodes=function(nodes){nodes.forEach(function(node){node.parentElement.removeChild(node)})}createNode=function(doc,ns,tagName){returndoc.createElementNS(ns,tagName)}createCDATA=function(doc,data){returndoc.createCDATASection(data)}changeHrefFromLibToLively=function(scripts){$A(scripts).forEach(function(node){varhref=node.getAttribute('xlink:href')if(!href)return;href=href.replace('lib','lively')node.setAttribute('xlink:href',href);})}changeHrefToLively=function(scripts){$A(scripts).forEach(function(node){varhref=node.getAttribute('xlink:href')if(!href)return;href='lively/'+href;node.setAttribute('xlink:href',href);})}34truetrue2000000
0.5
nulltruetrue
00.11
true
true
20null
Browseworld...falsenulltruefalsetrue
Pushchangesbackfalsenulltruefalsetrue
Refreshfalsenulltruefalsetrue
Evalonfalsenulltruefalsetrue
Sortfalsenulltruefalsetrue
truetruenullfalsenullnullnullnullfalse
codeBase=newURL('http://www.lively-kernel.org/repository/webwerkstatt/')url='http://www.lively-kernel.org/repository/webwerkstatt/'//url='http://www.lively-kernel.org/repository/webwerkstatt/migration-test/'configs=newWebResource(url).subDocuments('infinity').select(function(ea){returnea.getURL().filename()=='config.js'})configs.lengthconfigs[0].getContent()configs.forEach(function(ea){str=ea.getURL()+'\n';str+=ea.getContent();newTextMorph(newRectangle(0,0,600,400),str).openInWorld()})configs.invoke('del')17truetruefalsetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
nullfalsefalsenullnullnullnullfalse
//getallxhtmlfilescodeBase=URL.codeBase//url='http://www.lively-kernel.org/repository/webwerkstatt/migration-test/'worlds=newWebResource(codeBase).subDocuments('infinity').select(function(ea){returnea.getURL().toString().endsWith('.xhtml')})fixWorld=function(world){vardoc=world.getDocument()varscripts=doc.getElementsByTagName('script')//step1removeExample.jsandScratch.jsremoveScriptEndingWith('Examples.js',scripts);removeScriptEndingWith('Scratch.js',scripts);//step2removeconfig.jsscriptsvarconfigs=$A(scripts).select(function(node){varurl=node.getAttribute('xlink:href');returnurl&&(url.endsWith('/config.js')||url=='config.js')})removeNodes(configs);//step2addbaseUrlscriptbeforelocalconfig.jsscriptvarurl=world.getURL().getDirectory();varrelative=url.relativePathFrom(codeBase)if(relative.startsWith('/'))thrownewError('relativelooksdifferentthanexpected')varlevels=relative.split('/').length-1vartoCodeBase=range(1,levels).collect(function(){return'..'}).join('/')+'/';varsrc=Strings.format('Config.codeBase=Config.getDocumentDirectory()+"%s"',toCodeBase);varcodeBaseScripts=$A(scripts).select(function(ea){returnea.childElements&&ea.childElements.length>0&&ea.childElements[0].data==src});codeBaseScripts.forEach(function(ea){ea.parentElement.removeChild(ea)})varscript=createNode(doc,Namespace.SVG,'script')script.setAttribute('name','codeBase');script.appendChild(createCDATA(doc,src))varlocalConfigScript=findScriptEndingWith('localconfig.js',scripts)localConfigScript.parentElement.insertBefore(script,localConfigScript);localConfigScript.parentElement.insertBefore(doc.createTextNode("\n"),localConfigScript);//step3rewritelibinlively//changeHrefFromLibToLively(scripts)//changeHrefToLively(scripts)//step4findduplicates?//step5writeoutworld.setContent(Exporter.stringify(doc))}worlds.forEachShowingProgress($morph('progress'),function(w){fixWorld(w)},function(w){returnw.getURL().toString()}) 0 && ea.childElements[0].data == src });\n\tcodeBaseScripts.forEach(function(ea) { ea.parentElement.removeChild(ea) })\n\n\tvar script = createNode(doc, Namespace.SVG, 'script')\n\tscript.setAttribute('name', 'codeBase');\n\tscript.appendChild(createCDATA(doc, src))\n\tvar localConfigScript = findScriptEndingWith('localconfig.js', scripts)\n\tlocalConfigScript.parentElement.insertBefore(script, localConfigScript);\n\tlocalConfigScript.parentElement.insertBefore(doc.createTextNode(\"\\n\"), localConfigScript);\n\n\t// step 3 rewrite lib in lively\n\t//changeHrefFromLibToLively(scripts)\n\t//changeHrefToLively(scripts)\n\n\t// step 4 find duplicates?\n\n\t// step 5 write out\n\tworld.setContent(Exporter.stringify(doc))\n\n}\n\n\nworlds.forEachShowingProgress($morph('progress'), function(w) { fixWorld(w) }, function(w) { return w.getURL().toString() })"]]>truetruefalse54truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
worldmigrationfalsenullfalse
false
false
nullfalsefalsenullnullnullnullfalse
template=newWebResource('http://www.lively-kernel.org/repository/webwerkstatt/BWINF/GruppeXX/start.xhtml')doc=template.getDocument()doc.getElementById('28236:TextMorph').childNodes[5].childNodes[0].databaseURL=newURL('http://www.lively-kernel.org/repository/webwerkstatt/BWINF/')//createdirsfor(vari=0;i<20;i++){varidx=i<10?'0'+i:i.toString()varname='Gruppe'+idx;vardir=newWebResource(baseURL.withFilename(name+'/'));dir.create();}baseURL=newURL('http://www.lively-kernel.org/repository/webwerkstatt/BWINF/')//createworldsfor(vari=0;i<20;i++){varidx=i<10?'0'+i:i.toString()varname='Gruppe'+idx;varworld=newWebResource(baseURL.withFilename(name+'/'+start.xhtml));doc.getElementById('28236:TextMorph').childNodes[5].childNodes[0].data=nameworld.setContent(Exporter.stringify(doc))}22truetruefalsetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
nullfalsefalsenullnullnullnullfalse
Wikicontroltruetrue
null54