|
|
|
@ -14,9 +14,9 @@
|
|
|
|
|
'use strict';
|
|
|
|
|
/** global: Base64 */
|
|
|
|
|
/** global: FileReader */
|
|
|
|
|
/** global: RawDeflate */
|
|
|
|
|
/** global: history */
|
|
|
|
|
/** global: navigator */
|
|
|
|
|
/** global: pako */
|
|
|
|
|
/** global: prettyPrint */
|
|
|
|
|
/** global: prettyPrintOne */
|
|
|
|
|
/** global: showdown */
|
|
|
|
@ -25,7 +25,16 @@
|
|
|
|
|
// Immediately start random number generator collector.
|
|
|
|
|
sjcl.random.startCollectors();
|
|
|
|
|
|
|
|
|
|
jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|
|
|
|
if (typeof RawDeflate === 'undefined')
|
|
|
|
|
{
|
|
|
|
|
var compression = 'pako';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var compression = 'RawDeflate';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jQuery.PrivateBin = function($, compression, sjcl, Base64) {
|
|
|
|
|
/**
|
|
|
|
|
* static helper methods
|
|
|
|
|
*
|
|
|
|
@ -518,7 +527,14 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|
|
|
|
*/
|
|
|
|
|
compress: function(message)
|
|
|
|
|
{
|
|
|
|
|
return Base64.toBase64( RawDeflate.deflate( Base64.utob(message) ) );
|
|
|
|
|
if (typeof RawDeflate === 'undefined')
|
|
|
|
|
{
|
|
|
|
|
return Base64.toBase64( pako.deflate( Base64.utob(message), { to: 'string' } ) );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return Base64.toBase64( RawDeflate.deflate( Base64.utob(message), { to: 'string' } ) );
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -531,7 +547,14 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|
|
|
|
*/
|
|
|
|
|
decompress: function(data)
|
|
|
|
|
{
|
|
|
|
|
return Base64.btou( RawDeflate.inflate( Base64.fromBase64(data) ) );
|
|
|
|
|
if (typeof RawDeflate === 'undefined')
|
|
|
|
|
{
|
|
|
|
|
return Base64.btou( pako.inflate( Base64.fromBase64(data), { to: 'string' } ) );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return Base64.btou( RawDeflate.inflate( Base64.fromBase64(data), { to: 'string' } ) );
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -1850,4 +1873,4 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|
|
|
|
filter: filter,
|
|
|
|
|
controller: controller
|
|
|
|
|
};
|
|
|
|
|
}(jQuery, sjcl, Base64, RawDeflate);
|
|
|
|
|
}(jQuery, compression, sjcl, Base64);
|
|
|
|
|