Burger King Studio « visit
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Burger King Studio - http://burgerkingstudio.com
BKStudio = window.BKStudio || {};
BKStudio.Store = function() {
function _validate_add_to_cart() {
var ok = false;
$('#form-store :hidden').each(function() {
if ($(this).attr('value') == '1') {
ok = true;
}
});
if (ok) {
$('#form-store').submit();
} else {
alert('Please select a size');
}
}
function _init_add_to_cart_link() {
if ($('#add-to-cart-link').length) {
$('#add-to-cart-link').click(function() {
_validate_add_to_cart();
return false;
});
}
}
function _init_size_selection() {
$('.purchase-sizes > a').click(function() {
// get stock identifier
var this_id = $(this).attr('id');
var id_array = this_id.split('-');
var this_stock_id = id_array[1];
// get the image
var this_img = $(this).find('img:first');
// get the hidden form field
var this_input = $('#add-to-cart-' + this_stock_id);
var state = $(this_img).attr('src').indexOf('_hover');
var new_src;
if (state == -1) {
// add the size
new_src = $(this_img).attr('src').replace(/.png/gi, '_hover.png');
$(this_input).val('1');
} else {
// remove the size
new_src = $(this_img).attr('src').replace(/_hover.png/gi, '.png');
$(this_input).val('0');
}
$(this_img).attr('src', new_src);
return false;
})
}
return {
init: function() {
_init_size_selection();
_init_add_to_cart_link();
}
};
}();
$(document).ready(function() {
BKStudio.Store.init();
$('#checkout-form').submit(function(){
$('input').attr('readonly', true);
$('#submit-order-button').attr('src', '/wp-content/themes/burgerkingstudio/assets/images/button-order-dim.png').attr('disabled', true);
return true;
});
});
BKStudio = window.BKStudio || {};
jQuery.preloadImages = function() {
for (var i = 0; i < arguments.length; i++) {
jQuery("<img>").attr("src", arguments[i]);
}
}
BKStudio.Common = function() {
function _init_image_glow() {
// get all images inside div's with class 'post' or 'store-item' that aren't otherwise classed
$('div.post div.wordtube').each(function() {
if ($(this).attr("class") != 'inline') {
// try and get width from image (either via DOM or width attribute)
var width = ($(this).width != '') ? parseInt($(this).width()) : parseInt($(this).attr('width'));
// debug
_write_to_debug("'" + $(this).attr('src') + "' width = " + width);
if (width != '') {
// if width was found, force wrapper width
var wrapper_width = width + 14;
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper" style="width: ' + wrapper_width + 'px;"></div>');
} else {
// if width cannot be found, let browser determine width
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper"></div>');
}
}
});
$('div.post img').each(function() {
if ($(this).attr("class") != 'inline') {
// try and get width from image (either via DOM or width attribute)
var width = ($(this).width != '') ? parseInt($(this).width()) : parseInt($(this).attr('width'));
// debug
_write_to_debug("'" + $(this).attr('src') + "' width = " + width);
if (width != '') {
// if width was found, force wrapper width
var wrapper_width = width + 14;
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper" style="width: ' + wrapper_width + 'px;"></div>');
} else {
// if width cannot be found, let browser determine width
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper"></div>');
}
}
});
$('div.product img').each(function() {
// make sure image doesn't have any class applied
if ($(this).attr("class") == '') {
// try and get width from image (either via DOM or width attribute)
var width = ($(this).width != '') ? parseInt($(this).width()) : parseInt($(this).attr('width'));
// debug
_write_to_debug("'" + $(this).attr('src') + "' width = " + width);
if (width != '') {
// if width was found, force wrapper width
var wrapper_width = width + 14;
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper" style="width: ' + wrapper_width + 'px;"></div>');
} else {
// if width cannot be found, let browser determine width
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper"></div>');
}
}
});
$('.glow-wrapper').prepend('<div class="glow-top"><div class="glow-top-right-corner"></div></div>').append('<div class="glow-bottom"><div class="glow-bottom-right-corner"></div></div>');
}
function _write_to_debug(msg) {
if ($('#debug')) {
var cur_html = $('#debug').html();
$('#debug').html(msg + '<br />' + cur_html);
}
}
return {
init: function() {
_init_image_glow();
}
};
}();
$.fn.flash = function(flash_file, id, width, height, version, background_color, variables, params) {
return this.each(function() {
this.swfo = new SWFObject(flash_file, id, width, height, version, background_color);
for(variable in variables) this.swfo.addVariable(variable, escape(variables[variable]));
for(param in params) this.swfo.addParam(param, params[param]);
this.swfo.write(this);
});
};
function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}
function check_shipping()
{
if ($('#shipping-state-select').val() == 'IL') {
$('#tax-row').show();
sIFR.replace(memphisltstd, {
selector: '#tax-row .cart-table-heading',
css: [
'.sIFR-root { font-size: 9px; font-weight: bold; text-transform: uppercase; letter-spacing: 1; color: #ec008c; }'
],
wmode: 'transparent'
});
update_prices();
} else {
$('#tax-row').hide();
update_prices();
}
}
function update_prices(){
var grandtotal = 0.00;
var subtotal = 0.00;
var itemcnt = 0;
$('tr.cart-item-row').each(function(){
var price = Number($('.unit-price', this).html());
var qty = Number($('input.unit-qty', this).val());
var newprice = price*qty;
itemcnt+=qty;
$('span.item-price', this).html(roundNumber(newprice, 2).toFixed(2));
subtotal += newprice;
});
var tax = 0.00;
if ($('#tax-row:visible').length > 0) {
var tax = roundNumber(subtotal*0.1025, 2);
$('span#order-tax').html(roundNumber(tax, 2));
}
var shipping = 0.00;
if ($('#shipping-row:visible').length > 0) {
shipcty = itemcnt/3;
shipping = roundNumber(Math.ceil(shipcty)*4.90, 2);
if (shipping < 4.90) shipping = 4.90;
$('span#order-shipping').html(roundNumber(shipping, 2).toFixed(2));
}
$('span#order-subtotal').html(roundNumber(subtotal,2).toFixed(2));
$('#order-total').html(roundNumber(subtotal+tax+shipping, 2).toFixed(2));
$('#receipt-price span').html(roundNumber(subtotal+tax+shipping, 2).toFixed(2));
sIFR.getReplacementByFlashElement($('#receipt-price .sIFR-flash').get(0)).replaceText('$'+roundNumber(subtotal+tax+shipping, 2).toFixed(2));
};
function bind_inputs(){
$('#billing-name-input').blur(function(){
if ($(this).val().length > 0) $('#shipping-name-input').removeClass('has-error');
$('#shipping-name-input').val($(this).val());
});
$('#billing-address1-input').blur(function(){
if ($(this).val().length > 0) $('#shipping-address1-input').removeClass('has-error');
$('#shipping-address1-input').val($(this).val());
});
$('#billing-address2-input').blur(function(){
if ($(this).val().length > 0) $('#shipping-address2-input').removeClass('has-error');
$('#shipping-address2-input').val($(this).val());
});
$('#billing-city-input').blur(function(){
if ($(this).val().length > 0) $('#shipping-city-input').removeClass('has-error');
$('#shipping-city-input').val($(this).val());
});
$('#billing-state-select').blur(function(){
if ($(this).val().length > 0) $('#shipping-state-select').removeClass('has-error');
$('#shipping-state-select').val($(this).val());
check_shipping();
});
$('#billing-zip-input').blur(function(){
if ($(this).val().length > 0) $('#shipping-city-input').removeClass('has-error');
$('#shipping-zip-input').val($(this).val());
});
}
$(document).ready(function() {
BKStudio.Common.init();
$('#comments ol.commentlist li').corner('8px');
$('ul.photo-list li').corner('8px');
$('#recent-posts').corner('8px');
$('#polaroid').flash('/wp-content/themes/burgerkingstudio/assets/flash/polaroid.swf', 'polaroidswf', '254', '251', '8', '#FFFFFF', {}, {allowScriptAccess:'always', wmode:'transparent'});
$('#flash-banner').flash('/wp-content/themes/burgerkingstudio/assets/flash/features.swf', 'featureswf', '825', '300', '8', '#FFFFFF', {}, {allowScriptAccess:'always'});
$('#shirt-creator').flash('/wp-content/themes/burgerkingstudio/assets/flash/custom.swf', 'createswf', '825', '725', '8', '#FFFFFF', {}, {allowScriptAccess:'always'});
$('#shirt-creator-beta').flash('/wp-content/themes/burgerkingstudio/assets/flash/custom-proof.swf', 'createswf', '825', '725', '8', '#FFFFFF', {}, {allowScriptAccess:'always'});
$('#recent-posts li:last').addClass('last');
$('input.unit-qty').keyup(function(){
if ($(this).val() > 0) update_prices();
});
$('#checkout-form input.has-error').blur(function(){
if ($(this).val().length > 0) $(this).removeClass('has-error');
});
$('#checkout-form').submit(function(){
$('form input').attr('readonly', true);
$('form select').attr('readonly', true);
return true;
});
$('#print-receipt-button').click(function(){
window.print();
return false;
});
$('a.product-click-link').click(function(){
window.location = $(this).attr('href');
return false;
});
$('#shipping-state-select').blur(function(){
check_shipping();
});
$('input').blur(function(){
check_shipping();
})
if ($('#shipping-same-checkbox').attr('checked') == true) bind_inputs();
$('#shipping-same-checkbox').click(function(){
if ($(this).attr('checked') == true){
$('.shipping-field.has-error').removeClass('has-error');
$('#shipping-name-input').val($('#billing-name-input').val());
$('#shipping-address1-input').val($('#billing-address1-input').val());
$('#shipping-address2-input').val($('#billing-address2-input').val());
$('#shipping-city-input').val($('#billing-city-input').val());
$('#shipping-state-select').val($('#billing-state-select').val());
$('#shipping-zip-input').val($('#billing-zip-input').val());
bind_inputs();
$('.shipping-field').attr('readonly', true);
check_shipping();
} else {
$('#billing-name-input').unbind('blur');
$('#billing-address1-input').unbind('blur');
$('#billing-address2-input').unbind('blur');
$('#billing-city-input').unbind('blur');
$('#billing-state-select').unbind('blur');
$('#billing-zip-input').unbind('blur');
$('.shipping-field').attr("readonly", false);
$('.shipping-field').removeAttr("readonly");
check_shipping();
}
});
if ($("input[name='payment-type-radio']:checked").val() == 'paypal') {
$('.billing-field').attr('readonly', true);
$('.shipping-field').attr('readonly', true);
$('.extra-field').attr('disabled', true);
}
$('.detect-paypal').click(function(){
if($(this).val() == 'cc') {
$('.billing-field').attr('readonly', false).removeAttr('readonly');
$('.shipping-field').attr('readonly', false).removeAttr('readonly');
$('.extra-field').attr('disabled', false).removeAttr('readonly');
$('#paypal-form').hide();
$('#cc-form').show();
} else {
$('.billing-field').attr('readonly', true);
$('.shipping-field').attr('readonly', true);
$('.extra-field').attr('disabled', true);
$('#paypal-form').show();
$('#cc-form').hide();
}
});
$('a.hts-tab').click(function(){
show_artists_head_to_sole();
});
$('a.hiyw-tab').click(function(){
show_artists_have_it_your_way();
});
$('a.dok-tab').click(function(){
show_artists_deck_of_kings();
});
});
function show_artists_have_it_your_way()
{
$("#head-to-sole-artists").hide();
$("#deck-of-kings-artists").hide();
$("#have-it-your-way-artists").fadeIn();
$('#artists-switch li').removeClass('active');
$('#hiyw-tab-li').addClass('active');
sIFR.replace(memphisltstd, {
selector: '.post-title',
css: [
'.sIFR-root { font-size: 15px; font-weight: bold; text-transform: uppercase; letter-spacing: 1; margin-right: 1px; }',
'a { color: #EC008C; text-decoration: none; }',
'a:hover { color: #EC008C; text-decoration: none; }'
],
wmode: 'transparent'
});
return false;
}
function show_artists_head_to_sole()
{
$("#have-it-your-way-artists").hide();
$("#deck-of-kings-artists").hide();
$("#head-to-sole-artists").fadeIn();
$('#artists-switch li').removeClass('active');
$('#hts-tab-li').addClass('active');
sIFR.replace(memphisltstd, {
selector: '.post-title',
css: [
'.sIFR-root { font-size: 15px; font-weight: bold; text-transform: uppercase; letter-spacing: 1; margin-right: 1px; }',
'a { color: #EC008C; text-decoration: none; }',
'a:hover { color: #EC008C; text-decoration: none; }'
],
wmode: 'transparent'
});
return false;
}
function show_artists_deck_of_kings()
{
$("#have-it-your-way-artists").hide();
$("#head-to-sole-artists").hide();
$("#deck-of-kings-artists").fadeIn();
$('#artists-switch li').removeClass('active');
$('#dok-tab-li').addClass('active');
sIFR.replace(memphisltstd, {
selector: '.post-title',
css: [
'.sIFR-root { font-size: 15px; font-weight: bold; text-transform: uppercase; letter-spacing: 1; margin-right: 1px; }',
'a { color: #EC008C; text-decoration: none; }',
'a:hover { color: #EC008C; text-decoration: none; }'
],
wmode: 'transparent'
});
return false;
}
function _init_image_glow() {
// get all images inside div's with class 'post' or 'store-item' that aren't otherwise classed
$('div.post img').each(function() {
if ($(this).attr("class") != 'inline') {
// try and get width from image (either via DOM or width attribute)
var width = ($(this).width != '') ? parseInt($(this).width()) : parseInt($(this).attr('width'));
// debug
_write_to_debug("'" + $(this).attr('src') + "' width = " + width);
if (width != '') {
// if width was found, force wrapper width
var wrapper_width = width + 14;
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper" style="width: ' + wrapper_width + 'px;"></div>');
} else {
// if width cannot be found, let browser determine width
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper"></div>');
}
}
});
$('div.product img').each(function() {
// make sure image doesn't have any class applied
if ($(this).attr("class") == '') {
// try and get width from image (either via DOM or width attribute)
var width = ($(this).width != '') ? parseInt($(this).width()) : parseInt($(this).attr('width'));
// debug
_write_to_debug("'" + $(this).attr('src') + "' width = " + width);
if (width != '') {
// if width was found, force wrapper width
var wrapper_width = width + 14;
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper" style="width: ' + wrapper_width + 'px;"></div>');
} else {
// if width cannot be found, let browser determine width
$(this).after('<div class="clear"></div>').wrap('<div class="glow-wrapper"></div>');
}
}
});
$('.glow-wrapper').prepend('<div class="glow-top"><div class="glow-top-right-corner"></div></div>').append('<div class="glow-bottom"><div class="glow-bottom-right-corner"></div></div>');
}
Syndicate
Categories
Statistics
There are 330 Sites with 745 Links of Interest in 18 Categories. The latest Site was added 4 months ago.
About
This is a project by Sebastian Senf, for his part jQuery user and lover too. Follow me.