|
@@ -40,12 +40,18 @@ function hackpoint_part_search(callback){
|
|
|
resource : $('#sketch-editor').attr('data-id'),
|
|
|
showItems : false
|
|
|
},function(){
|
|
|
- $('#parts li:not(:eq(0)) [data-stream]').each(function(i,div){
|
|
|
+ $('#parts li:not(:eq(0))').each(function(i,li){
|
|
|
+
|
|
|
+ hackpoint_resource_part_upload(li);
|
|
|
+
|
|
|
+ var div = $('[data-stream]',li);
|
|
|
+
|
|
|
if($(div).attr('data-stream') =='') return;
|
|
|
$(div).css('background','url(data:'+$(div).attr('data-stream')+')')
|
|
|
.css('background-size','cover');
|
|
|
});
|
|
|
|
|
|
+
|
|
|
$('#parts li:not(:eq(0))').css('transform','scale(0)').removeClass('hidden')
|
|
|
|
|
|
$('#parts li:not(:eq(0))').each(function(i,li){
|
|
@@ -116,6 +122,16 @@ function hackpoint_part_add(){
|
|
|
|
|
|
init_components(item);
|
|
|
|
|
|
+ hackpoint_resource_part_upload(item);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+function hackpoint_resource_part_upload(item){
|
|
|
+ var item = $(item);
|
|
|
var image = item.find('.part-image');
|
|
|
image.click(function(e){
|
|
|
e.preventDefault();
|
|
@@ -126,7 +142,8 @@ function hackpoint_part_add(){
|
|
|
var file = picker.get(0).files[0];
|
|
|
var reader = new FileReader();
|
|
|
reader.addEventListener("load", function () {
|
|
|
- image.css('background','url(data:'+reader.result+')')
|
|
|
+
|
|
|
+ image.css('background','url('+reader.result+')')
|
|
|
.attr('data-stream',reader.result)
|
|
|
.css('background-size','cover');
|
|
|
}, false);
|
|
@@ -142,15 +159,17 @@ function hackpoint_part_add(){
|
|
|
var reader = new FileReader();
|
|
|
reader.readAsDataURL(droppedFiles[0]);
|
|
|
reader.onload = function () {
|
|
|
- image.css('background','url(data:image/jpeg;'+reader.result+')');
|
|
|
- image.css('background-size','cover');
|
|
|
+
|
|
|
+ image.css('background','url('+reader.result+')')
|
|
|
+ .attr('data-stream',reader.result)
|
|
|
+ .css('background-size','cover');
|
|
|
};
|
|
|
reader.onerror = function (error) {
|
|
|
console.log('Error: ', error);
|
|
|
};
|
|
|
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
var preload = $('<div class="preload progress-bar progress-bar-striped progress-bar-animated"></div>');
|
|
|
item.find('.part-image').append(preload);
|
|
|
item.find('.part-image').attr('id','part-image-'+$('#parts li').length());
|
|
@@ -173,12 +192,8 @@ function hackpoint_part_add(){
|
|
|
preload.fadeOut();
|
|
|
}
|
|
|
});*/
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
function hackpoint_resource_part_delete(element){
|
|
|
if(!confirm('Êtes vous sûr de vouloir supprimer cet item ?')) return;
|