Mercurial > hg > extraction-interface
comparison geotemco/lib/SimileRemnants.js @ 0:b12c99b7c3f0
commit for previous development
| author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
|---|---|
| date | Mon, 19 Jan 2015 17:13:49 +0100 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:b12c99b7c3f0 |
|---|---|
| 1 // SIMILE is not used anymore (and messes with jQuery!) so it was removed | |
| 2 // TimeplotLoader.load(GeoTemCoLoader.urlPrefix + 'lib/', GeoTemCoLoader.loadScripts); | |
| 3 | |
| 4 // ..but we still need (and use) the following defines, that where copied from there | |
| 5 /* string.js */ | |
| 6 String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,""); | |
| 7 }; | |
| 8 String.prototype.startsWith=function(A){return this.length>=A.length&&this.substr(0,A.length)==A; | |
| 9 }; | |
| 10 String.prototype.endsWith=function(A){return this.length>=A.length&&this.substr(this.length-A.length)==A; | |
| 11 }; | |
| 12 String.substitute=function(B,D){var A=""; | |
| 13 var F=0; | |
| 14 while(F<B.length-1){var C=B.indexOf("%",F); | |
| 15 if(C<0||C==B.length-1){break; | |
| 16 }else{if(C>F&&B.charAt(C-1)=="\\"){A+=B.substring(F,C-1)+"%"; | |
| 17 F=C+1; | |
| 18 }else{var E=parseInt(B.charAt(C+1)); | |
| 19 if(isNaN(E)||E>=D.length){A+=B.substring(F,C+2); | |
| 20 }else{A+=B.substring(F,C)+D[E].toString(); | |
| 21 }F=C+2; | |
| 22 }}}if(F<B.length){A+=B.substring(F); | |
| 23 }return A; | |
| 24 }; | |
| 25 | |
| 26 /* date-time.js */ | |
| 27 SimileAjax=new Object(); | |
| 28 SimileAjax.DateTime=new Object(); | |
| 29 SimileAjax.DateTime.MILLISECOND=0; | |
| 30 SimileAjax.DateTime.SECOND=1; | |
| 31 SimileAjax.DateTime.MINUTE=2; | |
| 32 SimileAjax.DateTime.HOUR=3; | |
| 33 SimileAjax.DateTime.DAY=4; | |
| 34 SimileAjax.DateTime.WEEK=5; | |
| 35 SimileAjax.DateTime.MONTH=6; | |
| 36 SimileAjax.DateTime.YEAR=7; | |
| 37 SimileAjax.DateTime.DECADE=8; | |
| 38 SimileAjax.DateTime.CENTURY=9; | |
| 39 SimileAjax.DateTime.MILLENNIUM=10; | |
| 40 SimileAjax.DateTime.EPOCH=-1; | |
| 41 SimileAjax.DateTime.ERA=-2; | |
| 42 | |
| 43 SimileAjax.includeCssFile = function(doc, url) { | |
| 44 var link = doc.createElement("link"); | |
| 45 link.setAttribute("rel", "stylesheet"); | |
| 46 link.setAttribute("type", "text/css"); | |
| 47 link.setAttribute("href", url); | |
| 48 doc.getElementsByTagName("head")[0].appendChild(link); | |
| 49 }; |
