Skip to content

Instantly share code, notes, and snippets.

@dmilith
Created December 6, 2008 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmilith/32903 to your computer and use it in GitHub Desktop.
Save dmilith/32903 to your computer and use it in GitHub Desktop.
// slide down content container
$(document).ready(function() {
$("div#content-container").slideDown("fast");
});
// kill some actions which we don't want to handle ;}
$(document).ready(function() {
$('.show_main').bind('click', function() {
return false;
});
});
// element deleting script
$(document).ready(function() {
$('.list_delete').bind('click',function() {
var link = $(this);
var element = link.parents().filter('.item');
var id = element.attr('id').split('_')[1];
element.slideUp('fast');
$.ajax({ url: '/nargit/delete/'+id });
return false;
});
});
// thumbnail displaying script
$(document).ready(function() {
$('.thumb_photo').bind('click',function() {
var link = $(this);
var this_src = link.attr('src').split('?')[0];
$('.normal_photo').attr( { src: this_src.replace(/min/, "normal") });
return false;
});
});
// normal => max displaying script
$(document).ready(function() {
$('.normal_photo').bind('click',function() {
$(this).attr({ src: $(this).attr('src').replace(/normal/, "max") });
$('.logo').hide("fast");
$('.main-container').hide("fast");
$('.footer-container').hide("fast");
$('.close_max').show("fast");
return false;
});
});
// max => normal displaying script
$(document).ready(function() {
$('.close_max').bind('click',function() {
$('.logo').show();
$('.main-container').show();
$('.footer-container').show();
$('.normal_photo').attr({ src: $('.normal_photo').attr('src').replace(/max/, "normal") });
$(this).hide();
return false;
});
});
//form script:
$(document).ready(function() {
$('form').submit(function() {
var id = $(this).parents().filter('div.item').attr('id').split('_')[1];
$('span#'+id).text('Zapisuję do bazy').show().fadeOut(3000);
$.ajax({ url:'/nargit/update/'+id, data:{
choosen_filename: this.choosen_filename.value, choosen_category: this.choosen_category.value
} });
$(this).children('div.list_image').html("<img src='/images/categories/" +
this.choosen_category.value +"/min/" + this.choosen_filename.value + "'></img>").fadeIn("fast");
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment