whose parent has the following code:
Code: Select all
if(nuFormType() == 'browse'){
nuShowBrowseImages()
}else{
nuShowFile();
}
function nuBeforeSave(){
$('[data-nu-table="Docs"]').each(function(index,item){
if (item.children[2].classList.contains("nuEdited")){
var j = JSON.parse(item.children[2].value);
var d = Date.now();
item.children[5].value = j.name; //'File Name' column
item.children[4].value = Date(d);//'Last Modified' column
nuHasBeenEdited();
}
});
return true;
}
function nuShowFile(){
$('[data-nu-table="Docs"]').each(function(index){
var t = $(this)[0].children;
if (t[1].value !== '') {
$.ajax({
url: 'https://' + window.location.hostname + '/upload-target/' + t[5].value,
method: 'GET',
xhrFields: {
responseType: 'blob'
},
success: function (data) {
var ur = window.URL.createObjectURL(data);
var x = document.createElement("EMBED");
var ty = data.type
x.setAttribute("type", ty);
x.setAttribute("src", ur);
x.setAttribute("width", "140px");
x.setAttribute("height", "140px");
t[0].innerHTML = '';
t[0].appendChild(x);
},
error: function(data) {
alert("Failed to get file")
}
});
}
});
}
function nuShowBrowseImages(){
//console.log($('[data-nu-column="0"]')[0].innerText);
}