Image DoubleCube bicolor
This commit is contained in:
parent
4f12e7c643
commit
36f38fc059
@ -55,13 +55,11 @@ $(function() {
|
||||
|
||||
function initFaces()
|
||||
{
|
||||
// reset faces
|
||||
// Reset faces
|
||||
$('.container-db').find('.noms-holder').remove();
|
||||
$('.container-db').find('.date-holder').remove();
|
||||
$('.chocos-holder').find('.noms-holder').remove();
|
||||
$('.chocos-holder').find('.date-holder').remove();
|
||||
$('.face-custom-txt').removeClass('face-custom-txt');
|
||||
$('.face-custom-img').removeClass('face-custom-img');
|
||||
|
||||
$(".container-db").empty()
|
||||
$(".chocos-holder").empty()
|
||||
@ -81,8 +79,8 @@ function initFaces()
|
||||
|
||||
$('.container-db .cubeface').html('<div class="colorface color_1"></div><div class="colorface color_2"></div>');
|
||||
|
||||
$(".container-db .db-cube1 .back .color_2").addClass('face-custom-img');
|
||||
$(".container-db .db-cube1 .back .color_1").addClass('face-custom-txt');
|
||||
$('.container-db .db-cube1 .back .color_2').addClass('face-custom-img');
|
||||
$('.container-db .db-cube1 .back .color_1').addClass('face-custom-txt');
|
||||
|
||||
// DC
|
||||
$('#custom_elmts .noms-holder').clone().appendTo(".container-db .db-cube1 .front .color_2")
|
||||
@ -283,6 +281,11 @@ $('#PELLICULAGE').on('change', function(e) {
|
||||
defPELLICULAGE($(this));
|
||||
});
|
||||
|
||||
$('#DOUBLECUBEIMAGE').on('change', function(e) {
|
||||
defDOUBLECUBEIMAGE(this);
|
||||
rotateDC(0,145);
|
||||
});
|
||||
|
||||
$('#colorpicker1').simplecolorpicker({picker: true, theme: 'glyphicons'})
|
||||
.on('change', function() {
|
||||
color1 = $('#colorpicker1 option:selected').attr('data-id');
|
||||
@ -343,7 +346,7 @@ function defFACELIBRE(obj){
|
||||
if (choice == "Aucune") {
|
||||
//Nothing
|
||||
} else if(choice == "Image") {
|
||||
|
||||
defDOUBLECUBEIMAGE($('#DOUBLECUBEIMAGE'));
|
||||
} else if(choice == "Texte") {
|
||||
var txt = $('#PERSOTXT').val().replace(/\n/g, "<br/>");
|
||||
$('.face-custom-txt').html('<div class="freetext-holder"></div>');
|
||||
@ -375,6 +378,32 @@ function defEMBALLAGE(obj){
|
||||
}
|
||||
}
|
||||
|
||||
function defDOUBLECUBEIMAGE(obj){
|
||||
if (obj.files && obj.files[0]) {
|
||||
$('.face-custom-txt').empty();
|
||||
$('.face-custom-img').html('<div class="image-holder"></div>');
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
$('.image-holder').css('background-image', 'url('+e.target.result+')');
|
||||
}
|
||||
reader.readAsDataURL(obj.files[0]);
|
||||
} else {
|
||||
$('.face-custom-txt').empty();
|
||||
$('.face-custom-img').html('<div class="image-holder"></div>');
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', $('input[name='+$('input#DOUBLECUBEIMAGE').data('field')+']').data('url'), true);
|
||||
request.responseType = 'blob';
|
||||
request.onload = function() {
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(request.response);
|
||||
reader.onload = function(e){
|
||||
$('.image-holder').css('background-image', 'url('+e.target.result+')');
|
||||
};
|
||||
};
|
||||
request.send();
|
||||
}
|
||||
}
|
||||
|
||||
function formatDateInput(date)
|
||||
{
|
||||
var day = date.substring(6,8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user