[+] Project : default theme added

This commit is contained in:
mMarinetti
2011-12-02 15:24:40 +00:00
parent a2be24ee90
commit 7320307212
431 changed files with 21629 additions and 1679 deletions
@@ -0,0 +1,61 @@
$(document).ready(function(){
$('select#id_country').change(function(){
updateState();
updateNeedIDNumber();
updateZipCode();
});
updateState();
updateNeedIDNumber();
updateZipCode();
if ($('select#id_country_invoice').length != 0)
{
$('select#id_country_invoice').change(function(){
updateState('invoice');
updateNeedIDNumber('invoice');
updateZipCode();
});
if ($('select#id_country_invoice:visible').length != 0)
{
updateState('invoice');
updateNeedIDNumber('invoice');
updateZipCode('invoice');
}
}
});
function updateState(suffix)
{
$('select#id_state'+(suffix !== undefined ? '_'+suffix : '')+' option:not(:first-child)').remove();
var states = countries[$('select#id_country'+(suffix !== undefined ? '_'+suffix : '')).val()];
if(typeof(states) != 'undefined')
{
$(states).each(function (key, item){
$('select#id_state'+(suffix !== undefined ? '_'+suffix : '')).append('<option value="'+item.id+'"'+ (idSelectedCountry == item.id ? ' selected="selected"' : '') + '>'+item.name+'</option>');
});
$('p.id_state'+(suffix !== undefined ? '_'+suffix : '')+':hidden').slideDown('slow');
}
else
$('p.id_state'+(suffix !== undefined ? '_'+suffix : '')).slideUp('fast');
}
function updateNeedIDNumber(suffix)
{
var idCountry = parseInt($('select#id_country'+(suffix !== undefined ? '_'+suffix : '')).val());
if ($.inArray(idCountry, countriesNeedIDNumber) >= 0)
$('.dni'+(suffix !== undefined ? '_'+suffix : '')).slideDown('slow');
else
$('.dni'+(suffix !== undefined ? '_'+suffix : '')).slideUp('fast');
}
function updateZipCode(suffix)
{
var idCountry = parseInt($('select#id_country'+(suffix !== undefined ? '_'+suffix : '')).val());
if (countriesNeedZipCode[idCountry] != 0)
$('.postcode'+(suffix !== undefined ? '_'+suffix : '')).slideDown('slow');
else
$('.postcode'+(suffix !== undefined ? '_'+suffix : '')).slideUp('fast');
}
+57
View File
@@ -0,0 +1,57 @@
//animate the opening of the branch (span.grower jQueryElement)
function openBranch(jQueryElement, noAnimation) {
jQueryElement.addClass('OPEN').removeClass('CLOSE');
if(noAnimation)
jQueryElement.parent().find('ul:first').show();
else
jQueryElement.parent().find('ul:first').slideDown();
}
//animate the closing of the branch (span.grower jQueryElement)
function closeBranch(jQueryElement, noAnimation) {
jQueryElement.addClass('CLOSE').removeClass('OPEN');
if(noAnimation)
jQueryElement.parent().find('ul:first').hide();
else
jQueryElement.parent().find('ul:first').slideUp();
}
//animate the closing or opening of the branch (ul jQueryElement)
function toggleBranch(jQueryElement, noAnimation) {
if(jQueryElement.hasClass('OPEN'))
closeBranch(jQueryElement, noAnimation);
else
openBranch(jQueryElement, noAnimation);
}
//when the page is loaded...
$(document).ready(function () {
//to do not execute this script as much as it's called...
if(!$('ul.tree.dhtml').hasClass('dynamized'))
{
//add growers to each ul.tree elements
$('ul.tree.dhtml ul').prev().before("<span class='grower OPEN'> </span>");
//dynamically add the '.last' class on each last item of a branch
$('ul.tree.dhtml ul li:last-child, ul.tree.dhtml li:last-child').addClass('last');
//collapse every expanded branch
$('ul.tree.dhtml span.grower.OPEN').addClass('CLOSE').removeClass('OPEN').parent().find('ul:first').hide();
$('ul.tree.dhtml').show();
//open the tree for the selected branch
$('ul.tree.dhtml .selected').parents().each( function() {
if ($(this).is('ul'))
toggleBranch($(this).prev().prev(), true);
});
toggleBranch( $('ul.tree.dhtml .selected').prev(), true);
//add a fonction on clicks on growers
$('ul.tree.dhtml span.grower').click(function(){
toggleBranch($(this));
});
//mark this 'ul.tree' elements as already 'dynamized'
$('ul.tree.dhtml').addClass('dynamized');
$('ul.tree.dhtml').removeClass('dhtml');
}
});