X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Ffragment.js;h=4ffbf8fc3ad063c57d659527bc0aa22c10829515;hp=ef087f45e35dc1f4c67fc972495536ffc6bbb8d7;hb=5d9992368bb386d2e606ae037c5478fe10ac70e8;hpb=9be780a2fbd68bf4c71431d94e8e8c07666468fb diff --git a/js/fragment.js b/js/fragment.js index ef087f4..4ffbf8f 100644 --- a/js/fragment.js +++ b/js/fragment.js @@ -21,12 +21,18 @@ */ Fragment = function() { var thisFragment = this; + // remplacement des codes de type %22 (en hexa) + var replaceHtmlCode = function(str) { + return str.replace(/%(\d\d)/g, function(text, code) { + return String.fromCharCode(parseInt(code, 16)); + }); + }; this.fragments = {}; if (!window.location.hash) { return; } try { - var fragmentsStr = window.location.hash.slice(1).split(";"); + var fragmentsStr = replaceHtmlCode(window.location.hash.slice(1)).split(";"); fragmentsStr.each(function(i, tuple) { tuple = tuple.split("="); thisFragment.fragments[tuple[0]] = JSON.parse(tuple[1]);