Hi, First of all, im new here, and im (not) a pro ;) (but i want to... lol). Okay, im starting a little php application to manage my icons (huge) collection... but i realise that i wrote everything in javascript (no jQuery) and my life would by a little more easier if i use jQuery... So now im trying to understand how to do that i i'll need your hints and your patience to help me... (if someday your make a trip in montreal, i'll pay you a coffee :))
So i'll explain my template structure... (see the screenshot---EDIT: new user, not allowed to post images)
((Image explanation))
Left: Div ID=nav its all folder and sub-folder.
A button Create library calling mkdir() JS function
|-IconShock (X) <--to delete folder
|---Vista collection (X)
|-New folder 1 (X)
At the right: Div ID=container...
Contain icons like in windows explorer, showing icon image, onclick on an icon = show_info(url, height, width, size, etc..), update the bottom div id=show_info that show some information on the icon.
Just take a look at the JS, you'll that i need jquery XD (i already started basic js to jquery)
CODE
//When adding a folder (Create Library), deleting folder, etc...
function refresh_nav() {
$.ajax({
type: 'GET',
url: './nav.php',
timeout: 10000,
success: function(data) {
$("#nav").html(data);
folder_selected(folder);
}
});
}
//When deleting file, changing folder or view
//filter_display = thumb or details
function refresh_container(fd, filter_display) {
folder = fd;
filter_display = filter_display;
$.ajax({
type: 'GET',
url: './container.php?path='+fd+'&filter_display='+filter_display,
success: function(data) {
$("#container").html(data);
}
});
}
//When clicking "Create library" form NAV
function mkdir() {
var dir = prompt("New folder's name", 'New folder');
$.ajax({
type: 'GET',
url: './action.php?action=mkdir&file='+dir,
timeout: 10000,
success: function(data) {
refresh_nav();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
//?
}
});
}
//delete a directory from NAV
function deldir(dir) {
var answer = confirm('You\'re about to delete '+dir+' and all files inside.');
if (answer){
$.ajax({
type: 'GET',
url: 'action.php?action=delete_dir&file='+dir,
success: function() {
refresh_nav();
}
});
}
}
//When click Edit menu, Convert
//show_icons is a form that have all div inside containing icon images, and a invisible checkbox
//if an icon (we
function convert(file) {
if(file) {
var c_value= "";
var f_value= "";
var count = "";
// For each checkbox
for (var i=0; i < document.show_icons.file_check.length; i++)
{
//If its selected
if (show_icons.elements[i].checked)
{
//Put path in variable and add a spliter
c_value = c_value + document.show_icons.file_check[i].value + "|";
//Increase counter
count++;
}
}
for (var i=0; i < document.show_folders.folder_check.length; i++)
{
//If its selected
if (show_folders.elements[i].checked)
{
//Put path in variable and add a spliter
f_value = f_value + document.show_folders.folder_check[i].value + "|";
//Increase counter
count++;
}
}
//If no files checked
if(c_value.length == 0) {
//If no folder is checked
if(f_value.length == 0) {
//Single file convertion
newmodal('execConvert/?act=convert&file='+file, 'Convert', 500, 400);
}
} else {
//Else multiple file selected
var file = c_value;
newmodal('execConvert/?act=convert&multi_file=1&file='+c_value, 'Convert', 500, 400);
}
} else {
alert('No selected item');
}
}
<body onLoad="refresh_nav(); refresh_container('', '<?=$default_container_display?>'); get_info_erease();">
I dont know if im understandable (?) but if not ill be more precise. I just want to know if there is any way i can get every JS above in jQuery. Because its a mess trying to figure everything with want im doing right now without jquery. Or more simple code... for now, i have a little piece of code in a nav.php file, another code in container.php (showing icons) a func_php file, a core.js file.. its really hard to understand and code i these situation.. lol
if someone here have tutorials for creating php application with jQuery cause i really need to know jquery..
Thanks for reading me guys! ( :) and girls )
And please say me its not a too big mess XD
Have a nice evening!