| 1 |
// $Id: photos.js,v 1.1.2.3 2008/08/27 17:02:16 eastcn Exp $
|
| 2 |
Drupal.behaviors.photos = function (context) {
|
| 3 |
$('a.click-des').click( function() {
|
| 4 |
$('#edit-des').val($('.desbody').text());
|
| 5 |
$('#imgedit').show(300);
|
| 6 |
$('.editdes').hide(300);
|
| 7 |
});
|
| 8 |
$('#edit-editnone').bind('click', function(){
|
| 9 |
$('.editdes').show(300);
|
| 10 |
$('#imgedit').hide(300);
|
| 11 |
return false;
|
| 12 |
});
|
| 13 |
$('a.photos-vote').click(function(){
|
| 14 |
//$(this).addClass('photos-vote-load');
|
| 15 |
u = $(this).attr('href');
|
| 16 |
url = u.split('destination');
|
| 17 |
c = $(this).attr('class');
|
| 18 |
cc = c.indexOf('photos-vote-up',0);
|
| 19 |
$.get(url[0], function(x){
|
| 20 |
v = x.replace(',','/');
|
| 21 |
$('span.photos-vote-sum').text(v);
|
| 22 |
});
|
| 23 |
if(cc != -1 ) {
|
| 24 |
$(this).addClass('photos-vote-up-x');
|
| 25 |
$('span.photos-vote-down').removeClass('photos-vote-down-x') ;
|
| 26 |
}else {
|
| 27 |
$(this).addClass('photos-vote-down-x') ;
|
| 28 |
$('span.photos-vote-up').removeClass('photos-vote-up-x') ;
|
| 29 |
}
|
| 30 |
$(this).removeClass('photos-vote-load');
|
| 31 |
return false;
|
| 32 |
});
|
| 33 |
$('#imagesedit input[@type="checkbox"]').click( function(){
|
| 34 |
$(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');
|
| 35 |
});
|
| 36 |
$('.allck').click(function() {
|
| 37 |
$("input[@class='form-checkbox']").each(function() {
|
| 38 |
$(this).attr("checked", true);
|
| 39 |
$(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');
|
| 40 |
})
|
| 41 |
});
|
| 42 |
$('.allnone').click(function() {
|
| 43 |
$("input[@class='form-checkbox']").each(function() {
|
| 44 |
$(this).attr("checked", false);
|
| 45 |
$(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');
|
| 46 |
})
|
| 47 |
});
|
| 48 |
$('input[@class="image-quote-link"]').hover(function(){
|
| 49 |
$(this).select();
|
| 50 |
},function(){
|
| 51 |
return;
|
| 52 |
});
|
| 53 |
$('input[@class="photos-p"]').change(function() {
|
| 54 |
i = 0;
|
| 55 |
$('#edit-insert-wrapper').show(500);
|
| 56 |
$("input[@class='photos-p'],input[@class='photos-pp']").each(function() {
|
| 57 |
if($(this).attr("checked")) {
|
| 58 |
t = $(this).val().split('&&&');
|
| 59 |
img = '<a class="image-quote" href="http://' + window.location.host +'/photos/image/' + t[2] + '">' + '<img alt="' + t[1] + '" src="' + t[0] + '" /></a>\n';
|
| 60 |
inval = $('#edit-insert').val();
|
| 61 |
$('#edit-insert').val(inval + img).select();
|
| 62 |
$(this).parents('.photos-quote').hide(600,function(){
|
| 63 |
$(this).remove();
|
| 64 |
});
|
| 65 |
i++;
|
| 66 |
}
|
| 67 |
})
|
| 68 |
if(i > 0) {
|
| 69 |
$('.photo-msg').text(Drupal.t('Please copy the above code.')).show(500);
|
| 70 |
}
|
| 71 |
return false;
|
| 72 |
})
|
| 73 |
};
|