It is possible to unpack by creating an HTML document with the packed script as the content and by replacing eval() with document.write().
This will dump script contents to screen - I did this in WebKit/Inspect Element, but there seem to be some errors that have crept in, unfortunately my knowledge of jQuery (and time) is quite limited so I haven’t managed to get too far with it.
treasurechest.js - TreasureChest-specific functions
function emptyCart() {
$.post(cart_doc,{ action:'count' }, function(a) { cart_count = eval("("+a+")"); if(!cart_count.length) { tb_remove(); $(cart_el).animate({ opacity:'0.0' }, 'slow', function() { $(cart_el).html('') });
return false
} else {
if(confirm(cart_warn)) {
$.post(cart_doc, { action:'empty' });
$(cart_el).animate({ opacity:'0.0' }, 'slow', function() { $(cart_el).html('') } )
}
}});
return false
}
function checkout(a) {
TB_remove();
jQuery('#treasureChestCheckout').remove();
jQuery('<div id="treasureChestCheckout">'+a+'</div>').appendTo('body').hide();
document.paypal.submit()
}
function cartCount() {
$.post(cart_doc,{action:'count'},function(a) {
cart_count=eval("("+a+")");
if(cart_count.length) {
cart_string='<a class="thickbox tc_view" title="'+cart_view+'" href="#" onclick="return false;">
'+'
<span class="tc_cart_view_text">'+cart_view+'</span>
<span class="tc_cart_count">'+cart_count.length+'</span>
</a>
'+'
<a class="tc_cart_empty '+class_empty+'" href="#" title="'+cart_empty+'">'+cart_empty+'</a>';
$(cart_el).show().html(cart_string);
$('.tc_view').click(function() {
if(!cart_count.length) {
emptyCart()
}
TB_show(cart_name,cart_doc+'&TB_iframe=true&height=350&width=500&action=view',false);
return false
})
} else {
$(cart_el).hide();
return false
}
$('a.'+class_empty).click(emptyCart);
return true
})
}
function addToCart(a,b,c) {
$.post(cart_doc,{ action:'add',selector:b,item:c }, cartCount);
$(cart_el).animate({ opacity:'0.2' },'fast').animate({ opacity:'1.0' },'normal');
$(a).animate({ opacity:'0.0' },'fast').animate({ opacity:'1.0' },'normal');
return false
}
function tcConfig(a) {
config = eval("("+a+")");
cart_name=config['business_name'];
cart_view=config['cart_view'];
cart_empty=config['cart_empty'];
cart_warn=config['cart_warn'];
cart_el=config['cart_el'];
class_add=config['class_add'];
class_empty=config['class_empty'];
$('.'+class_add).click(function() { addToCart(this,this.rel,this.name); return false });
cartCount()
}
function paypalForm(a) {
$.post(cart_doc,{
action:'item_opts', name:a.name, value:a.value } );
op_field=a.name;
$('.'+op_field).val(a.value)
}
emptyCartFunction = emptyCart;
checkoutFunction = checkout;
cartCountFunction = cartCount;
addToCartFunction = addToCart;
checkoutFunction = checkout;
prepPaypal = paypalForm;
$(document).ready(function() { $.post(cart_doc,{ action:'config' },tcConfig);
$('.hover-info').Tooltip({ track:true, delay:0, showURL:false, fixPNG:true, showBody:' - ',extraClass:'hover', top:-15, left:5 });
$('<span style="display:none;" id="treasureChestCopyright">Powered By ©Treasure Chest 1.0 by Scotty Delicious</span>').appendTo('body').hide() });
$(document).keypress(function(e) {
if(e.which==27) {
tb_remove();
cartCount()
}
});
}