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,7 +46,6 @@ var colorRGB =
violet: '#6B1687',
}
// Start when DOM is ready
$(function() {
initInfos();
@ -272,6 +271,15 @@ $('#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});
// 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);
});
@ -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

View File

@ -97,6 +97,7 @@ $('#PERSOTXT').on('keyup click', function(){
$('.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'));
// Rotate
rotateDC(faceDeg[face]['x'],faceDeg[face]['y']);
});
@ -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,13 +216,15 @@ 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") {
var choice = obj.find('option:selected').text();
if(choice == "Mat") {
$('.cubeface').append('<div class="matface"></div>')
}
}