diff --git a/lib/client/zip.js b/lib/client/zip.js index 859fa49b..7c71c0c6 100644 --- a/lib/client/zip.js +++ b/lib/client/zip.js @@ -3,13 +3,9 @@ var Util, Zip, pako; (function () { 'use strict'; - /*jshint nonstandard:false */ - var UTF8 = { - unescape: typeof unescape === 'function' ? unescape : decode - }; - /*jshint nonstandard:true */ - - Zip = new ZipProto(); + var UTF8 = new UTF8Proto(); + + Zip = new ZipProto(); function ZipProto() { this.pack = function(str, callback) { @@ -44,13 +40,23 @@ var Util, Zip, pako; return arr; } - } + } - /* jshint bitwise:false */ - /* unescape polyfill + function UTF8Proto() { + /*jshint nonstandard:true */ + var isUnescape = typeof unescape === 'function', + func = isUnescape ? unescape : decode; + + this.unescape = func; + } + + /* + * unescape polyfill * http://unixpapa.com/js/querystring.html */ + function decode(s) { + /*jshint bitwise:false */ s = s.replace(/%([EF][0-9A-F])%([89AB][0-9A-F])%([89AB][0-9A-F])/gi, function(code,hex1,hex2,hex3) { var n, n3, @@ -88,5 +94,4 @@ var Util, Zip, pako; return s; } - /* jshint bitwise:true */ })();