Lively Kernel canvas
// this script is evaluated on world load
//updatesourcecodefromrepositorybaseUrl=newURL('http://www.lively-kernel.org/repository/lively-kernel/trunk/source/kernel/');dirs=['','Tests/','ometa/']dirs.each(function(lastPart){dir=newFileDirectory(baseUrl.withFilename(lastPart));files=dir.filenames().reject(function(ea){returnea.startsWith('index')||ea.startsWith('.')||ea.endsWith('xhtml')});files.each(function(ea){dir.copyFileNamed(ea,null,URL.source.getDirectory().withFilename(lastPart))});});7
//copyjustaspecificfiledir.copyFileNamed('Tools.js',null,URL.source.getDirectory());dir=newFileDirectory(newURL('http://www.lively-kernel.org/repository/lively-kernel/trunk/source/kernel/'));2
//deleteunwantedfilesvarx=newFileDirectory(URL.source.getDirectory());varfiles=x.filenames().select(function(ea){returnea.startsWith('.')});files.each(function(ea){x.deleteFileNamed(ea)});3
//deletefilefile='index.xhtml'varx=newFileDirectory(URL.source.getDirectory());x.deleteFileNamed(file);3
//copyandrenameafilex=newFileDirectory(URL.source.getDirectory());x.copyFileNamed('index.xhtml',null,URL.common.wiki,'example.xhtml');2
//listrevisionsofafilefile='happyNewYear.xhtml';url=URL.source.getDirectory();dir=newFileDirectory(url);res=newSVNResource(url.toString(),Record.newPlainInstance({URL:url+file,Metadata:null,HeadRevision:null}));res.fetchMetadata(true,null);timestamps=res.getMetadata();revs=timestamps.collect(function(ea){returnea.toString().match(/.*Revision(.*)/)[1]});8
//patchandunpatchwikifilesfile='wikiScripts2.xhtml';url=newURL('http://localhost/svn/wiki/');patcher=newWikiPatcher(url);patcher.patchFile(file,8426);4
//unpatchafilesothatitusesthemostcurrentsourcesfile='wikiScripts2.xhtml';url=newURL('http://localhost/svn/wiki/');patcher=newWikiPatcher(url);patcher.unpatchFile(file);4
//copyandrename,fromlocalhost,notwiki!//getwriteaccessinthewikifromlocalhostnewNetRequest().put(URL.common.wiki.withFilename('abc'));//copyfilefromlocalhosttowiki//(mustbeevaluatedfromlocalhost)fileName='LKWiki.js';revision=null;newName=null;x=newFileDirectory(URL.source.getDirectory());x.copyFileNamed(fileName,revision,URL.common.wiki,newName);7
//throughabugthereissometimesmorethanone'SystemDictionary'intheDOM,thisscriptsunifiesthemtoonedicts=$A(document.getElementsByTagName('defs')).select(function(ea){returnea.getAttribute('id')});all=dicts.inject([],function(nodes,ea){returnnodes.concat($A(ea.childNodes))});all.each(function(ea){try{varowner=ea.ownerSVGElement||ea.ownerNode;if(owner)owner.removeChild(ea)}catch(e){}});newDict=dicts.shift();lively.data.Wrapper.dictionary=newDict;dicts.each(function(ea){try{varowner=ea.ownerSVGElement||ea.ownerNode;if(owner)owner.removeChild(ea)}catch(e){}});all.each(function(ea){newDict.appendChild(ea,true)});16
//addachangetothecurrentchangesetc=DoitChange.create('Config.showWikiNavigator=false\n\require("LKWiki.js").toRun(function(){});//justforloadingthejs');ChangeSet.current().addChange(c);3
//revertafiletoarevisionfile='happyNewYear.xhtml';dir=newFileDirectory(URL.source);content=dir.fileContent(file,10624);dir.writeFileNamed(file,content)4null16