1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-05 07:54:24 +03:00

Исправления в скине developer-jquery и приведение в порядок js-кода

This commit is contained in:
kirsan 2011-06-27 08:57:57 +00:00
parent 8b500d6bca
commit 18b8501296
3 changed files with 40 additions and 36 deletions

View file

@ -31,7 +31,7 @@
<strong>{$aLang.stream_block_users_title}</strong><br /> <strong>{$aLang.stream_block_users_title}</strong><br />
<input type="text" id="stream_users_complete" autocomplete="off" onclick/> <input type="text" id="stream_users_complete" autocomplete="off" onclick/>
<a href="javascript:ls.stream.appendUser()">{$aLang.stream_block_config_append}</a> <a href="javascript:ls.stream.appendUser()">{$aLang.stream_block_config_append}</a>
<ul id="userfeed_block_users_list"> <ul id="stream_block_users_list">
{if count($aStreamSubscribedUsers)} {if count($aStreamSubscribedUsers)}
{foreach from=$aStreamSubscribedUsers item=oUser} {foreach from=$aStreamSubscribedUsers item=oUser}
{assign var=iUserId value=$oUser->getId()} {assign var=iUserId value=$oUser->getId()}

View file

@ -1,32 +1,34 @@
var ls = ls || {};
ls.stream =( function ($) { ls.stream =( function ($) {
this.isBusy = false; this.isBusy = false;
this.subscribe = function (iTargetUserId) { this.subscribe = function (iTargetUserId) {
jQuery.post(aRouter['stream']+'subscribe', {'id':iTargetUserId, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { jls.ajax(aRouter['stream']+'subscribe', {'id':iTargetUserId}, function(data) {
if (!data.bStateError) { if (!data.bStateError) {
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
}); });
} }
this.unsubscribe = function (iId) { this.unsubscribe = function (iId) {
jQuery.post(aRouter['stream']+'unsubscribe', {'id':iId, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { ls.ajax(aRouter['stream']+'unsubscribe', {'id':iId}, function(data) {
if (!data.bStateError) { if (!data.bStateError) {
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
}); });
} }
this.switchEventType = function (iType) { this.switchEventType = function (iType) {
jQuery.post(aRouter['stream']+'switchEventType', { 'type':iType, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { ls.ajax(aRouter['stream']+'switchEventType', { 'type':iType}, function(data) {
if (!data.bStateError) { if (!data.bStateError) {
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
}); });
} }
this.appendUser = function() { this.appendUser = function() {
var sLogin = jQuery('#stream_users_complete').val(); var sLogin = $('#stream_users_complete').val();
if (!sLogin) return; if (!sLogin) return;
jQuery.post(aRouter['stream']+'subscribeByLogin', {'login':sLogin, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { ls.ajax(aRouter['stream']+'subscribeByLogin', {'login':sLogin}, function(data) {
if (!data.bStateError) { if (!data.bStateError) {
var checkbox = jQuery('#strm_u_'+data.uid); var checkbox = $('#strm_u_'+data.uid);
if (checkbox.length) { if (checkbox.length) {
if (checkbox.attr('checked')) { if (checkbox.attr('checked')) {
ls.msg.error(data.lang_error_title,data.lang_error_msg); ls.msg.error(data.lang_error_title,data.lang_error_msg);
@ -35,8 +37,8 @@ ls.stream =( function ($) {
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
} else { } else {
var liElement='<li><input type="checkbox" class="streamUserCheckbox" id="usf_u_'+data.uid+'" checked="checked" onClick="if (jQuery(this).get(\'checked\')) {ls.stream.subscribe(\'users\','+data.uid+')} else {ls.stream.unsubscribe(\'users\','+data.uid+')}" /><a href="'+data.user_web_path+'">'+data.user_login+'</a></li>'; var liElement='<li><input type="checkbox" class="streamUserCheckbox" id="usf_u_'+data.uid+'" checked="checked" onClick="if ($(this).get(\'checked\')) {ls.stream.subscribe(\'users\','+data.uid+')} else {ls.stream.unsubscribe(\'users\','+data.uid+')}" /><a href="'+data.user_web_path+'">'+data.user_login+'</a></li>';
jQuery('#stream_block_users_list').append(liElement); $('#stream_block_users_list').append(liElement);
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
} }
@ -46,21 +48,21 @@ ls.stream =( function ($) {
if (this.isBusy) { if (this.isBusy) {
return; return;
} }
var lastId = jQuery('#stream_last_id').val(); var lastId = $('#stream_last_id').val();
if (!lastId) return; if (!lastId) return;
jQuery('#stream_get_more').addClass('stream_loading'); $('#stream_get_more').addClass('stream_loading');
this.isBusy = true; this.isBusy = true;
jQuery.post(aRouter['stream']+'get_more', {'last_id':lastId, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { ls.ajax(aRouter['stream']+'get_more', {'last_id':lastId}, function(data) {
if (!data.bStateError && data.topics_count) { if (!data.bStateError && data.topics_count) {
jQuery('#stream_loaded_topics').append(data.result); $('#stream_loaded_topics').append(data.result);
jQuery('#stream_last_id').attr('value', data.iStreamLastId); $('#stream_last_id').attr('value', data.iStreamLastId);
} }
if (!data.topics_count) { if (!data.topics_count) {
jQuery('#stream_get_more').css({'display':'none'}); $('#stream_get_more').css({'display':'none'});
} }
jQuery('#stream_get_more').removeClass('stream_loading'); $('#stream_get_more').removeClass('stream_loading');
ls.stream.isBusy = false; this.isBusy = false;
}); }.bind(this));
} }
return this; return this;
}).call(ls.stream || {},jQuery); }).call(ls.stream || {},$);

View file

@ -1,25 +1,27 @@
var ls = ls || {};
ls.userfeed =( function ($) { ls.userfeed =( function ($) {
this.isBusy = false; this.isBusy = false;
this.subscribe = function (sType, iId) { this.subscribe = function (sType, iId) {
jQuery.post(aRouter['feed']+'subscribe', {'type':sType, 'id':iId, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { ls.ajax(aRouter['feed']+'subscribe', {'type':sType, 'id':iId}, function(data) {
if (!data.bStateError) { if (!data.bStateError) {
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
}); });
} }
this.unsubscribe = function (sType, iId) { this.unsubscribe = function (sType, iId) {
jQuery.post(aRouter['feed']+'unsubscribe', {'type':sType, 'id':iId, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { ls.ajax(aRouter['feed']+'unsubscribe', {'type':sType, 'id':iId}, function(data) {
if (!data.bStateError) { if (!data.bStateError) {
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
}); });
} }
this.appendUser = function() { this.appendUser = function() {
var sLogin = jQuery('#userfeed_users_complete').val(); var sLogin = $('#userfeed_users_complete').val();
if (!sLogin) return; if (!sLogin) return;
jQuery.post(aRouter['feed']+'subscribeByLogin', {'login':sLogin, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { ls.ajax(aRouter['feed']+'subscribeByLogin', {'login':sLogin}, function(data) {
if (!data.bStateError) { if (!data.bStateError) {
var checkbox = jQuery('#usf_u_'+data.uid); var checkbox = $('#usf_u_'+data.uid);
if (checkbox.length) { if (checkbox.length) {
if (checkbox.attr('checked')) { if (checkbox.attr('checked')) {
ls.msg.error(data.lang_error_title,data.lang_error_msg); ls.msg.error(data.lang_error_title,data.lang_error_msg);
@ -28,8 +30,8 @@ ls.userfeed =( function ($) {
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
} else { } else {
var liElement='<li><input type="checkbox" class="userfeedUserCheckbox" id="usf_u_'+data.uid+'" checked="checked" onClick="if (jQuery(this).get(\'checked\')) {ls.userfeed.subscribe(\'users\','+data.uid+')} else {ls.userfeed.unsubscribe(\'users\','+data.uid+')}" /><a href="'+data.user_web_path+'">'+data.user_login+'</a></li>'; var liElement='<li><input type="checkbox" class="userfeedUserCheckbox" id="usf_u_'+data.uid+'" checked="checked" onClick="if ($(this).get(\'checked\')) {ls.userfeed.subscribe(\'users\','+data.uid+')} else {ls.userfeed.unsubscribe(\'users\','+data.uid+')}" /><a href="'+data.user_web_path+'">'+data.user_login+'</a></li>';
jQuery('#userfeed_block_users_list').append(liElement); $('#userfeed_block_users_list').append(liElement);
ls.msg.notice(data.sMsgTitle,data.sMsg); ls.msg.notice(data.sMsgTitle,data.sMsg);
} }
} }
@ -39,21 +41,21 @@ ls.userfeed =( function ($) {
if (this.isBusy) { if (this.isBusy) {
return; return;
} }
var lastId = jQuery('#userfeed_last_id').val(); var lastId = $('#userfeed_last_id').val();
if (!lastId) return; if (!lastId) return;
jQuery('#userfeed_get_more').addClass('userfeed_loading'); $('#userfeed_get_more').addClass('userfeed_loading');
this.isBusy = true; this.isBusy = true;
jQuery.post(aRouter['feed']+'get_more', {'last_id':lastId, 'security_ls_key':LIVESTREET_SECURITY_KEY}, function(data) { ls.ajax(aRouter['feed']+'get_more', {'last_id':lastId}, function(data) {
if (!data.bStateError && data.topics_count) { if (!data.bStateError && data.topics_count) {
jQuery('#userfeed_loaded_topics').append(data.result); $('#userfeed_loaded_topics').append(data.result);
jQuery('#userfeed_last_id').attr('value', data.iUserfeedLastId); $('#userfeed_last_id').attr('value', data.iUserfeedLastId);
} }
if (!data.topics_count) { if (!data.topics_count) {
jQuery('#userfeed_get_more').css({'display':'none'}); $('#userfeed_get_more').css({'display':'none'});
} }
jQuery('#userfeed_get_more').removeClass('userfeed_loading'); $('#userfeed_get_more').removeClass('userfeed_loading');
ls.userfeed.isBusy = false; this.isBusy = false;
}); }.bind(this));
} }
return this; return this;
}).call(ls.userfeed || {},jQuery); }).call(ls.userfeed || {},$);