WordPress.com



*****LZ-string.js

// Copyright (c) 2013 Pieroxy

// This work is free. You can redistribute it and/or modify it

// under the terms of the WTFPL, Version 2

// For more information see LICENSE.txt or

//

// For more information, the home page:

//

//

// LZ-based compression algorithm, version 1.4.3

var LZString = (function() {

// private property

var f = String.fromCharCode;

var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";

var baseReverseDic = {};

function getBaseValue(alphabet, character) {

if (!baseReverseDic[alphabet]) {

baseReverseDic[alphabet] = {};

for (var i=0 ; i> 8;

buf[i*2+1] = current_value % 256;

}

return buf;

},

//decompress from uint8array (UCS-2 big endian format)

decompressFromUint8Array:function (compressed) {

if (compressed===null || compressed===undefined){

return LZString.decompress(compressed);

} else {

var buf=new Array(compressed.length/2); // 2 bytes per character

for (var i=0, TotalLen=buf.length; i 3)) + 32);

current = (c & 7) > 4)) + 32);

current = (c & 15) > 5)) + 32);

current = (c & 31) > 6)) + 32);

current = (c & 63) > 7)) + 32);

current = (c & 127) > 8)) + 32);

current = (c & 255) > 9)) + 32);

current = (c & 511) > 10)) + 32);

current = (c & 1023) > 11)) + 32);

current = (c & 2047) > 12)) + 32);

current = (c & 4095) > 13)) + 32);

current = (c & 8191) > 14)) + 32);

current = (c & 16383) > 15)) + 32);

output += (char)((c & 32767) + 32);

status = 0;

break;

}

}

}

catch (Exception ex)

{

throw ex;

}

return output + (char)(current + 32);

}

public static string decompressFromUTF16(string input)

{

string output = "";

int status = 0;

int current = 0;

int i = 0;

try

{

if (input == null)

throw new Exception("input is Null");

while (i < input.Length)

{

int c = ((int)input[i]) - 32;

switch (status++)

{

case 0:

current = c > 14));

current = (c & 16383) > 13));

current = (c & 8191) > 12));

current = (c & 4095) > 11));

current = (c & 2047) > 10));

current = (c & 1023) > 9));

current = (c & 511) > 8));

current = (c & 255) > 7));

current = (c & 127) > 6));

current = (c & 63) > 5));

current = (c & 31) > 4));

current = (c & 15) > 3));

current = (c & 7) > 2));

current = (c & 3) > 1));

current = (c & 1) 4);

}

if (!double.IsNaN(chr2) && !double.IsNaN(chr3))

{

enc3 = (((int)(Math.Round(chr2)) & 15) > 6);

}

// added per issue #3 logged by ReuvenT

else

{

enc3 = 0;

}

if (!double.IsNaN(chr3))

{

enc4 = (int)(Math.Round(chr3)) & 63;

}

if (double.IsNaN(chr2)) //if (isNaN(chr2)) 2);

chr3 = ((enc3 & 3) ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download