src/js/utils.js
branchlab-port
changeset 502 0b3523c65578
parent 497 f671cbaae9db
child 553 10d08f43c534
equal deleted inserted replaced
501:63e7b66d2a80 502:0b3523c65578
   120 IriSP.encodeURI = function(str) {
   120 IriSP.encodeURI = function(str) {
   121   return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').  
   121   return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').  
   122                                  replace(/\)/g, '%29').replace(/\*/g, '%2A');  
   122                                  replace(/\)/g, '%29').replace(/\*/g, '%2A');  
   123 }  
   123 }  
   124 
   124 
       
   125 IriSP.__guidCounter = 0;
   125 IriSP.guid = function(prefix) {
   126 IriSP.guid = function(prefix) {
   126   var str = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
   127   IriSP.__guidCounter += 1;
   127       var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
   128   return prefix + IriSP.__guidCounter;
   128       return v.toString(16);
       
   129   });
       
   130 
       
   131   return prefix + str;
       
   132 };
   129 };
   133 /* for ie compatibility
   130 /* for ie compatibility
   134 if (Object.prototype.__defineGetter__&&!Object.defineProperty) {
   131 if (Object.prototype.__defineGetter__&&!Object.defineProperty) {
   135    Object.defineProperty=function(obj,prop,desc) {
   132    Object.defineProperty=function(obj,prop,desc) {
   136       if ("get" in desc) obj.__defineGetter__(prop,desc.get);
   133       if ("get" in desc) obj.__defineGetter__(prop,desc.get);