[OpenLayers-Commits] r10825 - in sandbox/tschaub/canvas: . build examples lib lib/OpenLayers tests

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Oct 13 15:04:30 EDT 2010


Author: tschaub
Date: 2010-10-13 12:04:29 -0700 (Wed, 13 Oct 2010)
New Revision: 10825

Added:
   sandbox/tschaub/canvas/tests/OpenLayers1.html
   sandbox/tschaub/canvas/tests/OpenLayers2.html
   sandbox/tschaub/canvas/tests/OpenLayers3.html
Removed:
   sandbox/tschaub/canvas/tests/OpenLayers.html
Modified:
   sandbox/tschaub/canvas/
   sandbox/tschaub/canvas/build/full.cfg
   sandbox/tschaub/canvas/build/library.cfg
   sandbox/tschaub/canvas/build/lite.cfg
   sandbox/tschaub/canvas/examples/Jugl.js
   sandbox/tschaub/canvas/examples/example-list.html
   sandbox/tschaub/canvas/examples/strategy-cluster.html
   sandbox/tschaub/canvas/lib/OpenLayers.js
   sandbox/tschaub/canvas/lib/OpenLayers/SingleFile.js
   sandbox/tschaub/canvas/tests/list-tests.html
Log:
Merge r10820:10824 from trunk.


Property changes on: sandbox/tschaub/canvas
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/roberthl/openlayers:9745-9748
   + /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:10820-10824

Modified: sandbox/tschaub/canvas/build/full.cfg
===================================================================
--- sandbox/tschaub/canvas/build/full.cfg	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/build/full.cfg	2010-10-13 19:04:29 UTC (rev 10825)
@@ -3,7 +3,6 @@
 
 [first]
 OpenLayers/SingleFile.js
-OpenLayers.js
 OpenLayers/BaseTypes.js
 OpenLayers/BaseTypes/Class.js
 OpenLayers/Util.js
@@ -14,19 +13,6 @@
 [include]
 
 [exclude]
-Firebug/firebug.js
-Firebug/firebugx.js
-OpenLayers/Lang/ca.js
-OpenLayers/Lang/cs-CZ.js
-OpenLayers/Lang/da-DK.js
-OpenLayers/Lang/de.js
-OpenLayers/Lang/en-CA.js
-OpenLayers/Lang/es.js
-OpenLayers/Lang/fr.js
-OpenLayers/Lang/it.js
-OpenLayers/Lang/nb.js
-OpenLayers/Lang/nl.js
-OpenLayers/Lang/pt-BR.js
-OpenLayers/Lang/sv-SE.js
-OpenLayers/Lang/zh-TW.js
-OpenLayers/Lang/zh-CN.js
+Firebug
+OpenLayers.js
+OpenLayers/Lang

Modified: sandbox/tschaub/canvas/build/library.cfg
===================================================================
--- sandbox/tschaub/canvas/build/library.cfg	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/build/library.cfg	2010-10-13 19:04:29 UTC (rev 10825)
@@ -4,7 +4,6 @@
 
 [first]
 OpenLayers/SingleFile.js
-OpenLayers.js
 OpenLayers/BaseTypes.js
 OpenLayers/BaseTypes/Class.js
 OpenLayers/Util.js
@@ -17,6 +16,7 @@
 [exclude]
 Firebug/firebug.js
 Firebug/firebugx.js
+OpenLayers.js
 OpenLayers/Format/GeoRSS.js
 OpenLayers/Format/GML.js
 OpenLayers/Format/WKT.js

Modified: sandbox/tschaub/canvas/build/lite.cfg
===================================================================
--- sandbox/tschaub/canvas/build/lite.cfg	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/build/lite.cfg	2010-10-13 19:04:29 UTC (rev 10825)
@@ -6,7 +6,6 @@
 
 [first]
 OpenLayers/SingleFile.js
-OpenLayers.js
 OpenLayers/BaseTypes.js
 OpenLayers/BaseTypes/Class.js
 OpenLayers/Util.js

Modified: sandbox/tschaub/canvas/examples/Jugl.js
===================================================================
--- sandbox/tschaub/canvas/examples/Jugl.js	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/examples/Jugl.js	2010-10-13 19:04:29 UTC (rev 10825)
@@ -1,84 +1,8 @@
-/**
+/*
  * Jugl.js -- JavaScript Template Library
  *
- * Copyright 2007 Tim Schaub
- * Released under the MIT license.  Please see
- * http://svn.tschaub.net/jugl/trunk/license.txt for the full license.
+ * Copyright 2007-2010 Tim Schaub
+ * Released under the MIT license.  Please see 
+ * http://github.com/tschaub/jugl/blob/master/license.txt for the full license.
  */
-
-(function(){var Jugl={prefix:"jugl",namespaceURI:"http://namespace.jugl.org/"};Jugl.Array={indexOf:function(array,obj){for(var i=0;i<array.length;i++){if(array[i]==obj)return i;}
-return-1;}};Jugl.Function={bind:function(method,object){var args=[];for(var i=2;i<arguments.length;++i){args.push(arguments[i]);}
-return function(){for(var i=0;i<arguments.length;++i){args.push(arguments[i]);}
-return method.apply(object,args);}}};Jugl.Node={appendChild:function(parent,child){if(typeof(parent)=="string"){var obj=document.getElementById(parent);if(!obj){throw Error("Element id not found: "+parent);}
-parent=obj;}
-if(typeof(child)=="string"){var obj=document.getElementById(child);if(!obj){throw Error("Element id not found: "+child);}
-child=obj;}
-if(child.namespaceURI&&child.xml){var wrapper=document.createElement('div');wrapper.innerHTML=child.xml;var children=wrapper.childNodes;for(var i=0;i<children.length;++i){parent.appendChild(children[i]);}}else{if(parent.ownerDocument&&parent.ownerDocument.importNode){child=parent.ownerDocument.importNode(child,true);}
-parent.appendChild(child);}
-return child;}};Jugl.Object={extend:function(destination,source){destination=destination||{};source=source||{};for(property in source){destination[property]=source[property];}
-return destination;},applyDefaults:function(destination,source){destination=destination||{};source=source||{};for(property in source){if(destination[property]===undefined){destination[property]=source[property];}}
-return destination;}};Jugl.Request={loadTemplate:function(url,onComplete,caller){var createTemplate=function(request){var doc,template;try{doc=request.responseXML;template=new Jugl.Template(doc.documentElement);}catch(invalidXML){try{doc=document.createElement("div");doc.innerHTML=request.responseText;template=new Jugl.Template(doc.firstChild);}catch(invalidHTML){var msg="Can't make HTML out of response: "+
-request.responseText;Jugl.Console.error(msg);throw invalidHTML;}}
-var complete=Jugl.Function.bind(onComplete,caller);complete(template);}
-Jugl.Request.loadUrl(url,createTemplate);},loadUrl:function(url,onComplete,caller){var complete=(caller)?Jugl.Function.bind(onComplete,caller):onComplete;var request=Jugl.Request.createXMLHttpRequest();request.open("GET",url);request.onreadystatechange=function(){if(request.readyState==4){complete(request);}}
-request.send(null);},createXMLHttpRequest:function(){if(typeof XMLHttpRequest!="undefined"){return new XMLHttpRequest();}else if(typeof ActiveXObject!="undefined"){return new ActiveXObject("Microsoft.XMLHTTP");}else{throw new Error("XMLHttpRequest not supported");}}};Jugl.Class=function(){var Class=function(){if(this===Jugl){var msg="Create an instance of a Jugl "+"class with the new keyword";throw Error(msg);}
-this.initialize.apply(this,arguments);}
-var extended={toString:function(){return"["+this.CLASS_NAME+"]";}};var parent;for(var i=0;i<arguments.length;++i){if(typeof arguments[i]=="function"){parent=arguments[i].prototype;}else{parent=arguments[i];}
-Jugl.Object.extend(extended,parent);}
-Class.prototype=extended;return Class;};Jugl.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){}};(function(){if(window.console){var scripts=document.getElementsByTagName("script");for(var i=0;i<scripts.length;++i){if(scripts[i].src.indexOf("firebug.js")!=-1){Jugl.Object.extend(Jugl.Console,console);break;}}}})();Jugl.Attribute=Jugl.Class({element:null,node:null,type:null,nodeValue:null,template:null,initialize:function(element,node,type){this.element=element;this.node=node;this.type=type;this.nodeValue=node.nodeValue;this.nodeName=node.nodeName;this.template=element.template;},splitAttributeValue:function(value){value=(value!=null)?value:this.nodeValue;var matches=this.template.regExes.trimSpace.exec(value);var
  items;if(matches&&matches.length==3){items=[matches[1],matches[2]];}
-return items;},splitExpressionPrefix:function(){var items=this.splitAttributeValue();if(!items||(items[0]!='structure'&&items[0]!='text')){items=[null,this.nodeValue];}
-return items;},getAttributeValues:function(){var trimmed=this.nodeValue.replace(/[\t\n]/g,"").replace(/;\s*$/,"");var tabbed=trimmed.replace(/;;/g,"\t");var newlined=tabbed.split(";").join("\n");return newlined.replace(/\t/g,";").split(/\n/g);},removeSelf:function(){this.element.removeAttributeNode(this);},process:function(){return this.processAttribute[this.type].apply(this,[]);},evalInScope:function(str){var expression="with(this.element.scope){"+str+"}";return eval(expression);},processAttribute:{"define":function(){var values=this.getAttributeValues();var pair;for(var i=0;i<values.length;++i){pair=this.splitAttributeValue(values[i]);this.element.scope[pair[0]]=this.evalInScope(pair[1]);}
-this.removeSelf();return true;},"condition":function(){var proceed;try{proceed=!!(this.evalInScope(this.nodeValue));}catch(err){var message=err.name+": "+err.message+"\n"+"attribute: "+this.nodeName;Jugl.Console.error(message);throw err;}
-this.removeSelf();if(!proceed){this.element.removeSelf();}
-return proceed;},"repeat":function(){var pair=this.splitAttributeValue();var key=pair[0];var list=this.evalInScope(pair[1]);this.removeSelf();if(!(list instanceof Array)){var items=new Array();for(var p in list){items.push(p);}
-list=items;}
-var element;var previousSibling=this.element;var length=list.length;for(var i=0;i<length;++i){element=this.element.clone();element.scope[key]=list[i];element.scope.repeat[key]={index:i,number:i+1,even:!(i%2),odd:!!(i%2),start:(i==0),end:(i==length-1),length:length};previousSibling.insertAfter(element);element.process();previousSibling=element;}
-this.element.removeSelf();return false;},"content":function(){var pair=this.splitExpressionPrefix();var str;try{str=this.evalInScope(pair[1]);}catch(err){Jugl.Console.error("Failed to eval in element scope: "+
-pair[1]);throw err;}
-this.removeSelf();if(pair[0]=='structure'){try{this.element.node.innerHTML=str;}catch(err){var wrapper=document.createElement('div');var msg;try{wrapper.innerHTML=str;}catch(invalidHTML){msg="Can't transform string into valid HTML : "+
-str;Jugl.Console.error(msg);throw invalidHTML;}
-if(this.element.node.xml&&this.template.xmldom){while(this.element.node.firstChild){this.element.node.removeChild(this.element.node.firstChild);}
-this.template.xmldom.loadXML(wrapper.outerHTML);var children=this.template.xmldom.firstChild.childNodes;try{for(var i=0;i<children.length;++i){this.element.node.appendChild(children[i]);}}catch(invalidXML){msg="Can't transform string into valid XHTML : "+
-str;Jugl.Console.error(msg);throw invalidXML;}}else{try{this.element.node.innerHTML=wrapper.innerHTML;}catch(invalidXML){msg="Can't transform string into valid XHTML : "+
-str;Jugl.Console.error(msg);throw invalidXML;}}}}else{var text;if(this.element.node.xml&&this.template.xmldom){text=this.template.xmldom.createTextNode(str);}else{text=document.createTextNode(str);}
-var child=new Jugl.Element(this.template,text);this.element.removeChildNodes();this.element.appendChild(child);}
-return true;},"replace":function(){var pair=this.splitExpressionPrefix();var str;try{str=this.evalInScope(pair[1]);}catch(err){Jugl.Console.error("Failed to eval in element scope: "+
-pair[1]);throw err;}
-this.removeSelf();if(pair[0]=='structure'){var wrapper=document.createElement('div');try{wrapper.innerHTML=str;}catch(err){msg="Can't transform string into valid HTML : "+
-str;Jugl.Console.error(msg);throw err;}
-if(this.element.node.xml&&this.template.xmldom){try{this.template.xmldom.loadXML(wrapper.outerHTML);}catch(err){msg="Can't transform string into valid XML : "+
-str;Jugl.Console.error(msg);throw err;}
-wrapper=this.template.xmldom.firstChild;}
-while(wrapper.firstChild){var child=wrapper.removeChild(wrapper.firstChild);if(this.element.node.ownerDocument&&this.element.node.ownerDocument.importNode){if(child.ownerDocument!=this.element.node.ownerDocument){child=this.element.node.ownerDocument.importNode(child,true);}}
-this.element.node.parentNode.insertBefore(child,this.element.node);}}else{var text;if(this.element.node.xml&&this.template.xmldom){text=this.template.xmldom.createTextNode(str);}else{text=document.createTextNode(str);}
-var replacement=new Jugl.Element(this.template,text);this.element.insertBefore(replacement);}
-this.element.removeSelf();return true;},"attributes":function(){var values=this.getAttributeValues();var pair,name,value;for(var i=0;i<values.length;++i){pair=this.splitAttributeValue(values[i]);name=pair[0];value=this.evalInScope(pair[1]);if(value!==false){this.element.setAttribute(name,value);}}
-this.removeSelf();return true;},"omit-tag":function(){var omit;try{omit=((this.nodeValue=="")||!!(this.evalInScope(this.nodeValue)));}catch(err){Jugl.Console.error("Failed to eval in element scope: "+
-this.nodeValue);throw err;}
-this.removeSelf();if(omit){var children=this.element.getChildNodes();var child;for(var i=0;i<children.length;++i){this.element.insertBefore(children[i]);}
-this.element.removeSelf();}},"reflow":function(){var reflow;try{reflow=((this.nodeValue=="")||!!(this.evalInScope(this.nodeValue)));}catch(err){Jugl.Console.error("Failed to eval in element scope: "+
-this.nodeValue);throw err;}
-this.removeSelf();if(reflow){if(this.element.node.outerHTML){this.element.node.outerHTML=this.element.node.outerHTML;}else{this.element.node.innerHTML=this.element.node.innerHTML;}}}},CLASS_NAME:"Jugl.Attribute"});Jugl.Element=Jugl.Class({template:null,node:null,scope:null,initialize:function(template,node){this.template=template;this.node=node;this.scope=new Object();this.scope.repeat=new Object();},clone:function(){var node=this.node.cloneNode(true);node.removeAttribute("id");var element=new Jugl.Element(this.template,node);Jugl.Object.extend(element.scope,this.scope);return element;},getAttribute:function(localName){var node;if(this.node.nodeType==1){if(this.template.usingNS){node=this.node.getAttributeNodeNS(Jugl.namespaceURI,localName);}else{node=this.node.getAttributeNode(Jugl.prefix+":"+
-localName);}
-if(node&&!node.specified){node=false;}}
-var attribute;if(node){attribute=new Jugl.Attribute(this,node,localName);}else{attribute=node;}
-return attribute;},setAttribute:function(name,value){this.node.setAttribute(name,value);},removeAttributeNode:function(attribute){this.node.removeAttributeNode(attribute.node);},getChildNodes:function(){var numNodes=this.node.childNodes.length;var children=new Array(numNodes);var node,scope;for(var i=0;i<numNodes;++i){node=new Jugl.Element(this.template,this.node.childNodes[i]);node.scope=Jugl.Object.extend({},this.scope);children[i]=node;}
-return children;},removeChildNodes:function(){while(this.node.hasChildNodes()){this.node.removeChild(this.node.firstChild);}},removeChild:function(element){this.node.removeChild(element.node);return node;},removeSelf:function(){this.node.parentNode.removeChild(this.node);},importNode:function(element){if(this.node.ownerDocument&&this.node.ownerDocument.importNode){if(element.node.ownerDocument!=this.node.ownerDocument){element.node=this.node.ownerDocument.importNode(element.node,true);}}},appendChild:function(element){this.importNode(element);this.node.appendChild(element.node);},insertAfter:function(element){this.importNode(element);var parent=this.node.parentNode;var sibling=this.node.nextSibling;if(sibling){parent.insertBefore(element.node,sibling);}else{parent.appendChild(element.node);}},insertBefore:function(element){this.importNode(element);var parent=this.node.parentNode;parent.insertBefore(element.node,this.node);},process:function(){var attribute;var keepProcessing
 =true;var series=["define","condition","repeat"];for(var i=0;i<series.length;++i){attribute=this.getAttribute(series[i]);if(attribute){try{keepProcessing=attribute.process();}catch(err){Jugl.Console.error("Failed to process "+
-series[i]+" attribute");throw err;}
-if(!keepProcessing){return;}}}
-var content=this.getAttribute("content");if(content){try{content.process();}catch(err){Jugl.Console.error("Failed to process content attribute");throw err;}}else{var replace=this.getAttribute("replace");if(replace){try{replace.process();}catch(err){Jugl.Console.error("Failed to process replace attribute");throw err;}}}
-var attributes=this.getAttribute("attributes");if(attributes){try{attributes.process();}catch(err){Jugl.Console.error("Failed to process attributes attribute");throw err;}}
-if(!content&&!replace){this.processChildNodes();}
-var omit=this.getAttribute("omit-tag");if(omit){try{omit.process();}catch(err){Jugl.Console.error("Failed to process omit-tag attribute");throw err;}}
-var reflow=this.getAttribute("reflow");if(reflow){try{reflow.process();}catch(err){Jugl.Console.error("Failed to process reflow attribute");throw err;}}},processChildNodes:function(){var children=this.getChildNodes();for(var i=0;i<children.length;++i){try{children[i].process();}catch(err){Jugl.Console.error("Failed to process child node: "+i);throw err;}}},CLASS_NAME:"Jugl.Element"});Jugl.Template=Jugl.Class({node:null,usingNS:false,xhtmlns:"http://www.w3.org/1999/xhtml",xmldom:window.ActiveXObject?new ActiveXObject("Microsoft.XMLDOM"):null,regExes:{trimSpace:(/^\s*(\w+)\s+(.*?)\s*$/)},loaded:false,loading:false,initialize:function(config){if(typeof config=="string"||(config&&config.nodeType==1)){config={node:config};}
-config=config||{};if(typeof(config.node)=="string"){config.node=document.getElementById(config.node);if(!config.node){throw Error("Element id not found: "+config.node);}}
-if(config.node){this.node=config.node;this.loaded=true;}else if(config.url){this.load({url:config.url,callback:config.callback,scope:config.scope});}},process:function(config){if(config&&!config.context&&!config.clone&&!config.string&&!config.parent){config={context:config}}
-config=Jugl.Object.applyDefaults(config,{context:null,clone:false,string:false});if(this.node.getAttributeNodeNS){if(this.node.getAttributeNodeNS(Jugl.xhtmlns,Jugl.prefix)){this.usingNS=true;}}
-var element=new Jugl.Element(this,this.node);if(config.clone){element=element.clone();}
-if(config.context){element.scope=config.context;}
-try{element.process();}catch(err){Jugl.Console.error("Failed to process "+
-this.node.nodeName+" node");throw err;}
-var data;if(config.string){if(element.node.innerHTML){data=element.node.innerHTML;}else{if(this.xmldom){data=element.node.xml;}else{var serializer=new XMLSerializer();data=serializer.serializeToString(element.node);}}}else{data=element.node;if(config.parent){if(config.clone){data=Jugl.Node.appendChild(config.parent,element.node);}else{this.appendTo(config.parent);}}}
-return data;},load:function(config){if(typeof config=="string"){config={url:config};}
-config=config||{};this.loading=true;var setNode=function(template){this.node=template.node;this.loading=false;this.loaded=true;if(config.callback){config.callback.apply(config.scope,[template]);}}
-Jugl.Request.loadTemplate(config.url,setNode,this);},appendTo:function(parent){this.node=Jugl.Node.appendChild(parent,this.node);return this;},CLASS_NAME:"Jugl.Template"});window["http://jugl.tschaub.net/trunk/lib/Jugl.js"]=Jugl;})();
\ No newline at end of file
+(function(){var f={prefix:"jugl",namespaceURI:null,loadTemplate:function(h){var i=function(l){var m,k,n=!l.status||(l.status>=200&&l.status<300);if(n){try{m=l.responseXML;k=new e(m.documentElement)}catch(j){m=document.createElement("div");m.innerHTML=l.responseText;k=new e(m.firstChild)}if(h.callback){h.callback.call(h.scope,k)}}else{if(h.failure){h.failure.call(h.scope,l)}}};d(h.url,i)}};var g=function(h,j){h=h||{};j=j||{};for(var i in j){h[i]=j[i]}return h};var a=function(l,o){var m,n,k,j,h;if(typeof(l)==="string"){m=document.getElementById(l);if(!m){throw Error("Element id not found: "+l)}l=m}if(typeof(o)==="string"){m=document.getElementById(o);if(!m){throw Error("Element id not found: "+o)}o=m}if(o.namespaceURI&&o.xml){n=document.createElement("div");n.innerHTML=o.xml;k=n.childNodes;for(j=0,h=k.length;j<h;++j){l.appendChild(k[j])}}else{if(l.ownerDocument&&l.ownerDocument.importNode&&l.ownerDocument!==o.ownerDocument){o=l.ownerDocument.importNode(o,true)}l.appendChild(o)
 }return o};var d=function(h,k,i){var j;if(typeof XMLHttpRequest!=="undefined"){j=new XMLHttpRequest()}else{if(typeof ActiveXObject!=="undefined"){j=new ActiveXObject("Microsoft.XMLHTTP")}else{throw new Error("XMLHttpRequest not supported")}}j.open("GET",h);j.onreadystatechange=function(){if(j.readyState===4){k.call(i,j)}};j.send(null)};var b=function(h,i){this.template=h;this.node=i;this.scope={};this.scope.repeat={}};g(b.prototype,{clone:function(){var i=this.node.cloneNode(true);i.removeAttribute("id");var h=new b(this.template,i);g(h.scope,this.scope);return h},getAttribute:function(h){var j;if(this.node.nodeType===1){if(this.template.usingNS){j=this.node.getAttributeNodeNS(f.namespaceURI,h)}else{j=this.node.getAttributeNode(f.prefix+":"+h)}if(j&&!j.specified){j=false}}var i;if(j){i=new c(this,j,h)}else{i=j}return i},setAttribute:function(h,i){this.node.setAttribute(h,i)},removeAttributeNode:function(h){this.node.removeAttributeNode(h.node)},getChildNodes:function(){var k
 =this.node.childNodes.length;var j=new Array(k);var l;for(var h=0;h<k;++h){l=new b(this.template,this.node.childNodes[h]);l.scope=g({},this.scope);j[h]=l}return j},removeChildNodes:function(){while(this.node.hasChildNodes()){this.node.removeChild(this.node.firstChild)}},removeChild:function(h){this.node.removeChild(h.node);return node},removeSelf:function(){this.node.parentNode.removeChild(this.node)},importNode:function(h){if(this.node.ownerDocument&&this.node.ownerDocument.importNode){if(h.node.ownerDocument!==this.node.ownerDocument){h.node=this.node.ownerDocument.importNode(h.node,true)}}},appendChild:function(h){this.importNode(h);this.node.appendChild(h.node)},insertAfter:function(h){this.importNode(h);var j=this.node.parentNode;var i=this.node.nextSibling;if(i){j.insertBefore(h.node,i)}else{j.appendChild(h.node)}},insertBefore:function(h){this.importNode(h);var i=this.node.parentNode;i.insertBefore(h.node,this.node)},process:function(){var j;var r=true;var n=["define"
 ,"condition","repeat"];for(var o=0,p=n.length;o<p;++o){j=this.getAttribute(n[o]);if(j){r=j.process();if(!r){return}}}var q=this.getAttribute("content");if(q){q.process()}else{var k=this.getAttribute("replace");if(k){k.process()}}var m=this.getAttribute("attributes");if(m){m.process()}if(!q&&!k){this.processChildNodes()}var h=this.getAttribute("omit-tag");if(h){h.process()}var l=this.getAttribute("reflow");if(l){l.process()}},processChildNodes:function(){var k=this.getChildNodes();for(var j=0,h=k.length;j<h;++j){k[j].process()}}});var e=function(h){h=h||{};if(typeof h==="string"||(h.nodeType===1)){h={node:h}}if(typeof(h.node)==="string"){h.node=document.getElementById(h.node);if(!h.node){throw Error("Element id not found: "+h.node)}}if(h.node){this.node=h.node;this.loaded=true}else{if(h.url){this.load({url:h.url,callback:h.callback,scope:h.scope})}}};g(e.prototype,{node:null,usingNS:false,xmldom:window.ActiveXObject?new ActiveXObject("Microsoft.XMLDOM"):null,trimSpace:(/^\s*(
 \w+)\s+(.*?)\s*$/),loaded:false,loading:false,process:function(h){var i,j;h=g({context:null,clone:false,string:false},h);this.usingNS=this.node.getAttributeNodeNS&&f.namespaceURI;i=new b(this,this.node);if(h.clone||h.string){i=i.clone()}if(h.context){i.scope=h.context}i.process();if(h.string){if(i.node.innerHTML){j=i.node.innerHTML}else{if(this.xmldom){j=i.node.xml}else{j=(new XMLSerializer).serializeToString(i.node)}}}else{j=i.node;if(h.parent){if(h.clone){j=a(h.parent,i.node)}else{this.appendTo(h.parent)}}}return j},load:function(j){if(typeof j==="string"){j={url:j}}j=j||{};this.loading=true;var h=function(k){this.node=k.node;this.loading=false;this.loaded=true;if(j.callback){j.callback.apply(j.scope,[k])}};var i;if(j.failure){i=(function(){return function(k){j.failure.call(j.scope,k)}})()}f.loadTemplate({url:j.url,callback:h,failure:i,scope:this})},appendTo:function(h){this.node=a(h,this.node);return this}});var c=function(h,j,i){this.element=h;this.node=j;this.type=i;thi
 s.nodeValue=j.nodeValue;this.nodeName=j.nodeName;this.template=h.template};g(c.prototype,{splitAttributeValue:function(i){i=(i!=null)?i:this.nodeValue;var h=this.template.trimSpace.exec(i);return h&&h.length===3&&[h[1],h[2]]},splitExpressionPrefix:function(){var h=this.splitAttributeValue();if(!h||(h[0]!="structure"&&h[0]!="text")){h=[null,this.nodeValue]}return h},getAttributeValues:function(){return this.nodeValue.replace(/[\t\n]/g,"").replace(/;\s*$/,"").replace(/;;/g,"\t").split(";").join("\n").replace(/\t/g,";").split(/\n/g)},removeSelf:function(){this.element.removeAttributeNode(this)},process:function(){return this.processAttribute[this.type].apply(this,[])},evalInScope:function(k){var i=this.element.scope;var h=[];var j=[];for(key in i){h.push(key);j.push(i[key])}var l=new Function(h.join(","),"return "+k);return l.apply({},j)},processAttribute:{define:function(){var l,k,j,h=this.getAttributeValues();for(k=0,j=h.length;k<j;++k){l=this.splitAttributeValue(h[k]);this.e
 lement.scope[l[0]]=this.evalInScope(l[1])}this.removeSelf();return true},condition:function(){var h=!!(this.evalInScope(this.nodeValue));this.removeSelf();if(!h){this.element.removeSelf()}return h},repeat:function(){var l=this.splitAttributeValue();var r=l[0];var o=this.evalInScope(l[1]);this.removeSelf();if(!(o instanceof Array)){var q=new Array();for(var j in o){q.push(j)}o=q}var m;var h=this.element;for(var n=0,k=o.length;n<k;++n){m=this.element.clone();m.scope[r]=o[n];m.scope.repeat[r]={index:n,number:n+1,even:!(n%2),odd:!!(n%2),start:(n===0),end:(n===k-1),length:k};h.insertAfter(m);m.process();h=m}this.element.removeSelf();return false},content:function(){var m=this.splitExpressionPrefix();var p=this.evalInScope(m[1]);this.removeSelf();if(m[0]==="structure"){try{this.element.node.innerHTML=p}catch(l){var h=document.createElement("div");h.innerHTML=p;if(this.element.node.xml&&this.template.xmldom){while(this.element.node.firstChild){this.element.node.removeChild(this.ele
 ment.node.firstChild)}this.template.xmldom.loadXML(h.outerHTML);var k=this.template.xmldom.firstChild.childNodes;for(var n=0,o=k.length;n<o;++n){this.element.node.appendChild(k[n])}}else{this.element.node.innerHTML=h.innerHTML}}}else{var q;if(this.element.node.xml&&this.template.xmldom){q=this.template.xmldom.createTextNode(p)}else{q=document.createTextNode(p)}var j=new b(this.template,q);this.element.removeChildNodes();this.element.appendChild(j)}return true},replace:function(){var k=this.splitExpressionPrefix();var j=this.evalInScope(k[1]);this.removeSelf();if(k[0]==="structure"){var m=document.createElement("div");m.innerHTML=j;if(this.element.node.xml&&this.template.xmldom){this.template.xmldom.loadXML(m.outerHTML);m=this.template.xmldom.firstChild}while(m.firstChild){var l=m.removeChild(m.firstChild);if(this.element.node.ownerDocument&&this.element.node.ownerDocument.importNode){if(l.ownerDocument!=this.element.node.ownerDocument){l=this.element.node.ownerDocument.impor
 tNode(l,true)}}this.element.node.parentNode.insertBefore(l,this.element.node)}}else{var i;if(this.element.node.xml&&this.template.xmldom){i=this.template.xmldom.createTextNode(j)}else{i=document.createTextNode(j)}var h=new b(this.template,i);this.element.insertBefore(h)}this.element.removeSelf();return true},attributes:function(){var h=this.getAttributeValues();var n,k,m;for(var l=0,j=h.length;l<j;++l){n=this.splitAttributeValue(h[l]);k=n[0];m=this.evalInScope(n[1]);if(m!==false){this.element.setAttribute(k,m)}}this.removeSelf();return true},"omit-tag":function(){var l=((this.nodeValue==="")||!!(this.evalInScope(this.nodeValue)));this.removeSelf();if(l){var k=this.element.getChildNodes();for(var j=0,h=k.length;j<h;++j){this.element.insertBefore(k[j])}this.element.removeSelf()}},reflow:function(){var h=((this.nodeValue==="")||!!(this.evalInScope(this.nodeValue)));this.removeSelf();if(h){if(this.element.node.outerHTML){this.element.node.outerHTML=this.element.node.outerHTML}el
 se{this.element.node.innerHTML=this.element.node.innerHTML}}}}});window.jugl=g(f,{Template:e})})();
\ No newline at end of file

Modified: sandbox/tschaub/canvas/examples/example-list.html
===================================================================
--- sandbox/tschaub/canvas/examples/example-list.html	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/examples/example-list.html	2010-10-13 19:04:29 UTC (rev 10825)
@@ -98,8 +98,6 @@
         <script type="text/javascript" src="Jugl.js"></script>
         <script type="text/javascript" src="example-list.js"></script>
         <script type="text/javascript">
-            // import
-            var Jugl = window["http://jugl.tschaub.net/trunk/lib/Jugl.js"];
             var template, target;
 
             function listExamples(examples) {
@@ -201,7 +199,7 @@
                 }
             }
             window.onload = function() {
-                template = new Jugl.Template("template");
+                template = new jugl.Template("template");
                 target = document.getElementById("examples");
                 listExamples(info.examples);
                 document.getElementById("exwin").src = "../examples/example.html";

Modified: sandbox/tschaub/canvas/examples/strategy-cluster.html
===================================================================
--- sandbox/tschaub/canvas/examples/strategy-cluster.html	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/examples/strategy-cluster.html	2010-10-13 19:04:29 UTC (rev 10825)
@@ -66,7 +66,6 @@
         <script src="animator.js"></script>
         <script type="text/javascript">
             var map, template;
-            var Jugl = window["http://jugl.tschaub.net/trunk/lib/Jugl.js"];
             OpenLayers.ProxyHost = (window.location.host == "localhost") ?
                 "/cgi-bin/proxy.cgi?url=" : "proxy.cgi?url=";
 
@@ -135,7 +134,7 @@
                 map.setCenter(new OpenLayers.LonLat(0, 0), 1);
                 
                 // template setup
-                template = new Jugl.Template("template");
+                template = new jugl.Template("template");
 
             }
             

Modified: sandbox/tschaub/canvas/lib/OpenLayers/SingleFile.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/SingleFile.js	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/lib/OpenLayers/SingleFile.js	2010-10-13 19:04:29 UTC (rev 10825)
@@ -4,7 +4,16 @@
  * full text of the license. */
 
 var OpenLayers = {
-    singleFile: true
+    singleFile: true,
+    _getScriptLocation: (function() {
+        var s = document.getElementsByTagName('script');
+        var match = s[s.length-1].getAttribute("src").match(/(^|(.*?\/))(OpenLayers\.js)(\?|$)/);
+        var l = match ? match[1] : "";
+        return (function() { return l; });
+    })()
 };
 
-
+/**
+ * Constant: VERSION_NUMBER
+ */
+OpenLayers.VERSION_NUMBER="$Revision$";


Property changes on: sandbox/tschaub/canvas/lib/OpenLayers/SingleFile.js
___________________________________________________________________
Added: svn:keywords
   + Revision

Modified: sandbox/tschaub/canvas/lib/OpenLayers.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers.js	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/lib/OpenLayers.js	2010-10-13 19:04:29 UTC (rev 10825)
@@ -14,55 +14,34 @@
      * Before creating the OpenLayers namespace, check to see if
      * OpenLayers.singleFile is true.  This occurs if the
      * OpenLayers/SingleFile.js script is included before this one - as is the
-     * case with single file builds.
+     * case with old single file build profiles that included both
+     * OpenLayers.js and OpenLayers/SingleFile.js.
      */
     var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
     
     /**
-     * Cache for the script location returned from
-     * OpenLayers._getScriptLocation
+     * Relative path of this script.
      */
-    var scriptLocation;
+    var scriptName = (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js";
     
     /**
      * Namespace: OpenLayers
      * The OpenLayers object provides a namespace for all things OpenLayers
      */
     window.OpenLayers = {
-        
         /**
-         * Property: _scriptName
-         * {String} Relative path of this script.
-         */
-        _scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js",
-
-        /**
          * Function: _getScriptLocation
          * Return the path to this script.
          *
          * Returns:
          * {String} Path to this script
          */
-        _getScriptLocation: function () {
-            if (scriptLocation != undefined) {
-                return scriptLocation;
-            }
-            scriptLocation = "";            
-            var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
-         
-            var scripts = document.getElementsByTagName('script');
-            for (var i=0, len=scripts.length; i<len; i++) {
-                var src = scripts[i].getAttribute('src');
-                if (src) {
-                    var match = src.match(isOL);
-                    if(match) {
-                        scriptLocation = match[1];
-                        break;
-                    }
-                }
-            }
-            return scriptLocation;
-        }
+        _getScriptLocation: (function() {
+            var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)");
+            var s = document.getElementsByTagName('script');
+            var l = s[s.length-1].getAttribute("src").match(r)[1];
+            return (function() { return l; });
+        })()
     };
     /**
      * OpenLayers.singleFile is a flag indicating this file is being included

Deleted: sandbox/tschaub/canvas/tests/OpenLayers.html
===================================================================
--- sandbox/tschaub/canvas/tests/OpenLayers.html	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/tests/OpenLayers.html	2010-10-13 19:04:29 UTC (rev 10825)
@@ -1,31 +0,0 @@
-<html>
-<head>
-    <script src="bogus/1/OpenLayers.js-foo"></script>
-    <script src="bogus/2/foo-OpenLayers.js"></script>
-    <script id="script" src="../lib/OpenLayers.js"></script>
-    <script type="text/javascript">
-        function test_OpenLayers(t) {
-            t.plan(3);
-
-            var script = document.getElementById("script");
-
-            t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
-            
-            // create a clone of OpenLayers._getScriptLocation
-            eval("var getScriptLocation = " + OpenLayers._getScriptLocation.toString());
-            var scriptLocation;
-            
-            script.setAttribute("src", "../lib/OpenLayers.js?foo");
-            t.eq(getScriptLocation(), "../", "Script location with search string correctly detected.");
-            scriptLocation = null;
-
-            // now pretend we're using a built script
-            OpenLayers._scriptName = "OpenLayers.js";
-            t.eq(getScriptLocation(), "../lib/", "not fooled by bogus paths");
-            
-        }
-    </script>
-</head>
-<body>
-</body>
-</html>

Copied: sandbox/tschaub/canvas/tests/OpenLayers1.html (from rev 10824, trunk/openlayers/tests/OpenLayers1.html)
===================================================================
--- sandbox/tschaub/canvas/tests/OpenLayers1.html	                        (rev 0)
+++ sandbox/tschaub/canvas/tests/OpenLayers1.html	2010-10-13 19:04:29 UTC (rev 10825)
@@ -0,0 +1,32 @@
+<html>
+<head>
+    <script src="../lib/OpenLayers.js"></script>
+    <script type="text/javascript">
+        function test_OpenLayers(t) {
+            t.plan(1);
+
+            var script = document.getElementById("script");
+
+            t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
+        }
+    </script>
+</head>
+<body>
+</body>
+</html>
+<html>
+<head>
+    <script src="../lib/OpenLayers.js"></script>
+    <script type="text/javascript">
+        function test_OpenLayers(t) {
+            t.plan(1);
+
+            var script = document.getElementById("script");
+
+            t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
+        }
+    </script>
+</head>
+<body>
+</body>
+</html>

Copied: sandbox/tschaub/canvas/tests/OpenLayers2.html (from rev 10824, trunk/openlayers/tests/OpenLayers2.html)
===================================================================
--- sandbox/tschaub/canvas/tests/OpenLayers2.html	                        (rev 0)
+++ sandbox/tschaub/canvas/tests/OpenLayers2.html	2010-10-13 19:04:29 UTC (rev 10825)
@@ -0,0 +1,38 @@
+<html>
+<head>
+    <script src="bogus/1/OpenLayers.js-foo"></script>
+    <script src="bogus/2/foo-OpenLayers.js"></script>
+    <script src="../lib/OpenLayers.js?foo"></script>
+    <script src="bogus/3/after-OpenLayers.js"></script>
+    <script type="text/javascript">
+        function test_OpenLayers(t) {
+            t.plan(1);
+
+            var script = document.getElementById("script");
+
+            t.eq(OpenLayers._getScriptLocation(), "../", "Script location with search string correctly detected, and not fooled by other scripts.");
+        }
+    </script>
+</head>
+<body>
+</body>
+</html>
+<html>
+<head>
+    <script src="bogus/1/OpenLayers.js-foo"></script>
+    <script src="bogus/2/foo-OpenLayers.js"></script>
+    <script src="../lib/OpenLayers.js?foo"></script>
+    <script src="bogus/3/after-OpenLayers.js"></script>
+    <script type="text/javascript">
+        function test_OpenLayers(t) {
+            t.plan(1);
+
+            var script = document.getElementById("script");
+
+            t.eq(OpenLayers._getScriptLocation(), "../", "Script location with search string correctly detected, and not fooled by other scripts.");
+        }
+    </script>
+</head>
+<body>
+</body>
+</html>

Copied: sandbox/tschaub/canvas/tests/OpenLayers3.html (from rev 10824, trunk/openlayers/tests/OpenLayers3.html)
===================================================================
--- sandbox/tschaub/canvas/tests/OpenLayers3.html	                        (rev 0)
+++ sandbox/tschaub/canvas/tests/OpenLayers3.html	2010-10-13 19:04:29 UTC (rev 10825)
@@ -0,0 +1,38 @@
+<html>
+<head>
+    <script>
+    var OpenLayers = {singleFile: true};
+    </script>
+    <script src="../lib/OpenLayers.js"></script>
+    <script type="text/javascript">
+        function test_OpenLayers(t) {
+            t.plan(1);
+
+            var script = document.getElementById("script");
+
+            t.eq(OpenLayers._getScriptLocation(), "../lib/", "Script location for single file build correctly detected.");
+        }
+    </script>
+</head>
+<body>
+</body>
+</html>
+<html>
+<head>
+    <script>
+    var OpenLayers = {singleFile: true};
+    </script>
+    <script src="../lib/OpenLayers.js"></script>
+    <script type="text/javascript">
+        function test_OpenLayers(t) {
+            t.plan(1);
+
+            var script = document.getElementById("script");
+
+            t.eq(OpenLayers._getScriptLocation(), "../lib/", "Script location for single file build correctly detected.");
+        }
+    </script>
+</head>
+<body>
+</body>
+</html>

Modified: sandbox/tschaub/canvas/tests/list-tests.html
===================================================================
--- sandbox/tschaub/canvas/tests/list-tests.html	2010-10-13 19:01:00 UTC (rev 10824)
+++ sandbox/tschaub/canvas/tests/list-tests.html	2010-10-13 19:04:29 UTC (rev 10825)
@@ -156,7 +156,9 @@
     <li>Map.html</li>
     <li>Marker.html</li>
     <li>Marker/Box.html</li>
-    <li>OpenLayers.html</li>
+    <li>OpenLayers1.html</li>
+    <li>OpenLayers2.html</li>
+    <li>OpenLayers3.html</li>
     <li>Popup.html</li>
     <li>Popup/Anchored.html</li>
     <li>Popup/AnchoredBubble.html</li>



More information about the Commits mailing list