Select and get backup value

This commit is contained in:
Michael RICOIS 2017-09-20 11:56:47 +02:00
parent fe4f010d08
commit 10374e3740
2 changed files with 53 additions and 17 deletions

View File

@ -46,11 +46,10 @@ var colorRGB =
violet: '#6B1687',
}
// Start when DOM is ready
$(function() {
initInfos();
initFaces();
initFaces();
initDrag();
});
@ -271,8 +270,17 @@ $('#PERSOTXT').on('keyup click', function(){
var txt = $(this).val().replace(/\n/g, "<br />");
$('.face-custom-img').empty();
$('.face-custom-txt').html('<div class="freetext-holder"></div>');
$('.freetext-holder').html(txt).css({'margin-top':-$('.freetext-holder').height()*0.5});
rotateDC(0,180);
$('.freetext-holder').html(txt).css({'margin-top':-$('.freetext-holder').height()*0.5});
// Set custom-select
options = $('.ref-FACELIBRE').find('.custom-select li');
options.each(function(i, el) {
el = $(el);
if (el.text() == 'Texte') {
el.trigger('click');
}
});
// Rotate
rotateDC(0,180);
});
$('#DATEMARIAGE').on('change click', function(e) {
@ -295,6 +303,14 @@ $('#PELLICULAGE').on('change', function(e) {
$('#DOUBLECUBEIMAGE').on('change', function(e) {
defDOUBLECUBEIMAGE(this);
// Set custom-select
options = $('.ref-FACELIBRE').find('.custom-select li');
options.each(function(i, el) {
el = $(el);
if (el.text() == "Image") {
el.trigger('click');
}
});
rotateDC(0,145);
});
@ -321,9 +337,26 @@ function initInfos()
defNOM1($('#NOM1'));
defNOM2($('#NOM2'));
defDATEMARIAGE($('#DATEMARIAGE'));
defFACELIBRE($('.FACELIBRE'));
defFACELIBRE($('#FACELIBRE'));
defPELLICULAGE($('#PELLICULAGE'));
defEMBALLAGE($('#EMBALLAGE'));
if ($('input#BICOLOR1').val() != '') {
$('#colorpicker1 > option').each(function(i, el){
if ($(this).text() == $('input#BICOLOR1').val()) {
color1 = $(this).data('id');
}
});
}
if ($('input#BICOLOR2').val() != '') {
$('#colorpicker2 > option').each(function(i, el){
if ($(this).text() == $('input#BICOLOR2').val()) {
color1 = $(this).data('id');
}
});
}
$('#colorpicker1').simplecolorpicker('selectColor', colorRGB[color1]);
$('.color1text').html($('#colorpicker1 option:selected').text());
$('input#BICOLOR1').val($('#colorpicker1 option:selected').text());
@ -353,7 +386,7 @@ function defNOM2(obj){
function defFACELIBRE(obj){
var choice = obj.find('option:selected').text();
$(".face-custom-txt").empty();
$('.face-custom-txt').empty();
$('.face-custom-img').empty();
if (choice == "Aucune") {
//Nothing
@ -362,10 +395,10 @@ function defFACELIBRE(obj){
} else if(choice == "Texte") {
var txt = $('#PERSOTXT').val().replace(/\n/g, "<br/>");
$('.face-custom-txt').html('<div class="freetext-holder"></div>');
$('.freetext-holder').html(txt).css({'margin-top':-$('.freetext-holder').height()*0.5});
$('.freetext-holder').html(txt).css({'margin-top':-$('.freetext-holder').height()*0.5});
} else if(choice == "Initiales") {
$('#custom_elmts .initiales-holder').clone().appendTo(".face-custom-txt");
}
}
}
function defPELLICULAGE(obj){
@ -416,7 +449,7 @@ function defDOUBLECUBEIMAGE(obj){
};
request.send();
}
}
}
}
function formatDateInput(date)

View File

@ -96,7 +96,8 @@ $('#PERSOTXT').on('keyup click', function(){
$('.face-custom-img').empty();
$('.face-custom-txt').html('<div class="freetext-holder"></div>');
$('.freetext-holder').html(txt).css({'margin-top':-$('.freetext-holder').height()*0.5});
var face = facename($('.freetext-holder'));
var face = facename($('.freetext-holder'));
// Rotate
rotateDC(faceDeg[face]['x'],faceDeg[face]['y']);
});
@ -180,7 +181,7 @@ function initInfos()
defFACELIBRE($('#FACELIBRE'));
defPELLICULAGE($('#PELLICULAGE'));
defEMBALLAGE($('#EMBALLAGE'));
defDOUBLECUBEIMAGE($('#DOUBLECUBEIMAGE'));
defDOUBLECUBEIMAGE($('#DOUBLECUBEIMAGE'));
}
function defDATEMARIAGE(obj){
@ -193,12 +194,12 @@ function defDATEMARIAGE(obj){
}
function defNOM1(obj){
$('.nom_1').html(obj.val())
$('.nom_1').html(obj.val());
$('.initiale_1').html(obj.val().substring(0,1));
}
function defNOM2(obj){
$('.nom_2').html(obj.val())
$('.nom_2').html(obj.val());
$('.initiale_2').html(obj.val().substring(0,1));
}
@ -215,15 +216,17 @@ function defFACELIBRE(obj){
$('.face-custom-txt').html('<div class="freetext-holder"></div>');
$('.freetext-holder').html(txt).css({'margin-top':-$('.freetext-holder').height()*0.5});
} else if(choice == "Initiales") {
console.log('coucou');
$('#custom_elmts .initiales-holder').clone().appendTo(".face-custom-txt");
}
}
function defPELLICULAGE(obj){
$('.matface').remove();
if(obj.find('option:selected').text() == "Mat") {
$('.cubeface').append('<div class="matface"></div>')
}
var choice = obj.find('option:selected').text();
if(choice == "Mat") {
$('.cubeface').append('<div class="matface"></div>')
}
}
function defEMBALLAGE(obj){
@ -234,7 +237,7 @@ function defEMBALLAGE(obj){
$('.flip-container').addClass('argent');
} else if (choice == "Doré") {
$('.flip-container').addClass('or');
}
}
}
function defDOUBLECUBEIMAGE(obj){