summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2012-03-30 16:15:53 +0000
committerThomas BrĂ¼derli2012-03-30 16:15:53 +0000
commita3afb6a148ab25fc47d92ecf1285941edef5204f (patch)
tree54bc636234156512305cc94d6f042794269a1259
parenta60fb69ff8e7755ab969298ab85a2b63bbcc8b14 (diff)
downloaditools-a3afb6a148ab25fc47d92ecf1285941edef5204f.tar.gz
itools-a3afb6a148ab25fc47d92ecf1285941edef5204f.tar.bz2
itools-a3afb6a148ab25fc47d92ecf1285941edef5204f.zip
Add unicode-safe equivalent of unescape()
-rw-r--r--itjs/it.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/itjs/it.js b/itjs/it.js
index 54fa5c7..b31423e 100644
--- a/itjs/it.js
+++ b/itjs/it.js
@@ -280,6 +280,24 @@ function it_url_encode(str)
}
/**
+ * Unicode-safe equivalent of unescape()
+ * @param str string URL encoded string to be decoded
+ */
+function it_url_decode(str)
+{
+ str = str.replace(/\+/g, '%20');
+
+ // catch URI malformed errors
+ try {
+ if (window.decodeURIComponent)
+ return decodeURIComponent(str);
+ }
+ catch(e) {}
+
+ return unescape(str);
+}
+
+/**
* Patch PNG transparency for IE 5.5-6 on the given image
*/
function it_pngfix(img, w, h, mode)