1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 01:14:24 +03:00
ifhub.club/templates/skin/developer-jquery/js/blocks.js

64 lines
1.3 KiB
JavaScript
Raw Normal View History

2011-04-01 10:49:36 +03:00
var blocks = {
//==================
2011-04-01 12:54:47 +03:00
// Опции
2011-04-01 10:49:36 +03:00
//==================
options: {
active: 'active',
url: {
block_stream_item_comment: aRouter['ajax']+'stream/comment/',
block_stream_item_topic: aRouter['ajax']+'stream/topic/',
block_blogs_item_top: aRouter['ajax']+'blogs/top/',
block_blogs_item_join: aRouter['ajax']+'blogs/join/',
block_blogs_item_self: aRouter['ajax']+'blogs/self/'
}
},
//==================
2011-04-01 12:54:47 +03:00
// Функции
2011-04-01 10:49:36 +03:00
//==================
load: function(obj, block_id){
thisObj = this;
objId = $(obj).attr('id');
content = $('#'+block_id+'_content');
content.html($('<div />').css('text-align','center').append($('<img>', {src: IMG_PATH_LOADER})));
$('[id^="'+block_id+'_item"]').removeClass(this.options.active);
$(obj).addClass(this.options.active);
$.getJSON(this.options.url[objId], {security_ls_key: LIVESTREET_SECURITY_KEY}, function(result){
content.empty();
if (result.bStateError) {
$.notifier.error(null, result.sMsg);
} else {
content.html(result.sText);
}
});
}
}
$(document).ready(function(){
$('[id^="block_stream_item"]').click(function(){
blocks.load(this, 'block_stream');
return false;
});
$('[id^="block_blogs_item"]').click(function(){
blocks.load(this, 'block_blogs');
return false;
});
});