v1.5 #7
					 1 changed files with 12 additions and 6 deletions
				
			
		|  | @ -1,10 +1,16 @@ | ||||||
| function getCookie(name) { | function getCookie(name) { | ||||||
|     nom = name + "="; |     let lookingFor = name + "="; | ||||||
|     let liste = document.cookie.split (';'); |     let arr = document.cookie.split(";"); | ||||||
|     for (let i = 0; i < liste.length; i++) { |     for(let str of arr) | ||||||
|         let c = liste[i]; |     { | ||||||
|         while (c.charAt(0) == ' ') c = c.substring(1, c.length); |         while(str[0] == ' ') // removing potential unwanted spaces
 | ||||||
|         if (c.indexOf(nom) == 0) return c.substring(nom.length, c.length); |         { | ||||||
|  |             str = str.slice(1); | ||||||
|  |         } | ||||||
|  |         if (str.slice(0,lookingFor.length)==lookingFor) | ||||||
|  |         { | ||||||
|  |             return str.slice(lookingFor.length); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     return null; |     return null; | ||||||
| } | } | ||||||
		Loading…
	
		Reference in a new issue