mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-01 05:55:02 +03:00
fix developer-jquery
This commit is contained in:
parent
c98ad406a0
commit
a5bd56aa23
|
@ -29,7 +29,7 @@
|
|||
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="#" onclick="favourite.toggle({$oTalk->getId()},this,'talk'); return false;" class="favourite {if $oTalk->getIsFavourite()}active{/if}"></a>
|
||||
<a href="#" onclick="return ls.favourite.toggle({$oTalk->getId()},this,'talk');" class="favourite {if $oTalk->getIsFavourite()}active{/if}"></a>
|
||||
</td>
|
||||
<td>
|
||||
{if $oTalkUserAuthor->getCommentCountNew() or !$oTalkUserAuthor->getDateLast()}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
{/foreach}
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="#" onclick="favourite.toggle({$oTalk->getId()},this,'talk'); return false;" class="favourite {if $oTalk->getIsFavourite()}active{/if}"></a>
|
||||
<a href="#" onclick="return ls.favourite.toggle({$oTalk->getId()},this,'talk');" class="favourite {if $oTalk->getIsFavourite()}active{/if}"></a>
|
||||
</td>
|
||||
<td>
|
||||
{if $oTalkUserAuthor->getCommentCountNew() or !$oTalkUserAuthor->getDateLast()}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<ul class="info">
|
||||
<li class="username"><a href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a></li>
|
||||
<li class="date">{date_format date=$oTalk->getDate()}</li>
|
||||
<li><a href="#" onclick="lsFavourite.toggle({$oTalk->getId()},this,'talk'); return false;" class="favorite {if $oTalk->getIsFavourite()}active{/if}"></a></li>
|
||||
<li><a href="#" onclick="return ls.favourite.toggle({$oTalk->getId()},this,'talk');" class="favourite {if $oTalk->getIsFavourite()}active{/if}"></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
{/if}
|
||||
<li class="goto-comment-child"><a href="#" title="{$aLang.comment_goto_child}">↓</a></li>
|
||||
{if $oUserCurrent and !$bNoCommentFavourites}
|
||||
<li><a href="#" onclick="favourite.toggle({$oComment->getId()},this,'comment'); return false;" class="favourite {if $oComment->getIsFavourite()}active{/if}"></a></li>
|
||||
<li><a href="#" onclick="return ls.favourite.toggle({$oComment->getId()},this,'comment');" class="favourite {if $oComment->getIsFavourite()}active{/if}"></a></li>
|
||||
{/if}
|
||||
{if !$oComment->getDelete() and $oUserCurrent and $oUserCurrent->isAdministrator()}
|
||||
<li><a href="#" class="delete" onclick="comments.toggle(this,{$oComment->getId()}); return false;">{$aLang.comment_delete}</a></li>
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
var favourite = {
|
||||
//==================
|
||||
// Опции
|
||||
//==================
|
||||
var ls = ls || {};
|
||||
|
||||
classes: {
|
||||
/**
|
||||
* Добавление в избранное
|
||||
*/
|
||||
ls.favourite = (function ($) {
|
||||
/**
|
||||
* Опции
|
||||
*/
|
||||
this.options = {
|
||||
active: 'active',
|
||||
favourite: 'favourite'
|
||||
},
|
||||
|
||||
typeFavourite: {
|
||||
type: {
|
||||
topic: {
|
||||
url: aRouter['ajax']+'favourite/topic/',
|
||||
targetName: 'idTopic'
|
||||
|
@ -21,44 +22,35 @@ var favourite = {
|
|||
url: aRouter['ajax']+'favourite/comment/',
|
||||
targetName: 'idComment'
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//==================
|
||||
// Функции
|
||||
//==================
|
||||
|
||||
// Добавить/удалить из избранного
|
||||
toggle: function(idTarget, objFavourite, type) {
|
||||
if (!this.typeFavourite[type]) { return false; }
|
||||
/**
|
||||
* Переключение избранного
|
||||
*/
|
||||
this.toggle = function(idTarget, objFavourite, type) {
|
||||
if (!this.options.type[type]) { return false; }
|
||||
|
||||
this.objFavourite = $(objFavourite);
|
||||
this.type = type;
|
||||
thisObj = this;
|
||||
|
||||
var value = 1;
|
||||
if (this.objFavourite.hasClass(this.classes.active)) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
var params = {};
|
||||
params['type'] = value;
|
||||
params[this.typeFavourite[type].targetName] = idTarget;
|
||||
params['security_ls_key'] = LIVESTREET_SECURITY_KEY;
|
||||
params['type'] = !this.objFavourite.hasClass(this.options.active);
|
||||
params[this.options.type[type].targetName] = idTarget;
|
||||
|
||||
$.post(this.typeFavourite[type].url, params, function(result) {
|
||||
ls.ajax(this.options.type[type].url, params, function(result) {
|
||||
$(this).trigger('toggle',[idTarget,objFavourite,type,params,result]);
|
||||
if (result.bStateError) {
|
||||
$.notifier.error(null, result.sMsg);
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
$.notifier.notice(null, result.sMsg);
|
||||
|
||||
var divFavourite = thisObj.objFavourite;
|
||||
divFavourite.removeClass(thisObj.classes.active);
|
||||
|
||||
ls.msg.notice(null, result.sMsg);
|
||||
this.objFavourite.removeClass(this.options.active);
|
||||
if (result.bState) {
|
||||
divFavourite.addClass(thisObj.classes.active);
|
||||
this.objFavourite.addClass(this.options.active);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}.bind(this));
|
||||
return false;
|
||||
}
|
||||
|
||||
return this;
|
||||
}).call(ls.favourite || {},jQuery);
|
|
@ -9,7 +9,7 @@ var vote = {
|
|||
minus: 'minus',
|
||||
positive: 'positive',
|
||||
negative: 'negative',
|
||||
total: 'total',
|
||||
total: 'total'
|
||||
},
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
</li>
|
||||
<li class="username"><a href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a></li>
|
||||
<li class="date">{date_format date=$oTopic->getDateAdd()}</li>
|
||||
<li><a href="#" onclick="favourite.toggle({$oTopic->getId()},this,'topic'); return false;" class="favourite {if $oUserCurrent && $oTopic->getIsFavourite()}active{/if}"></a></li>
|
||||
<li><a href="#" onclick="return ls.favourite.toggle({$oTopic->getId()},this,'topic');" class="favourite {if $oUserCurrent && $oTopic->getIsFavourite()}active{/if}"></a></li>
|
||||
{if $oTopic->getType()=='link'}
|
||||
<li><a href="{router page='link'}go/{$oTopic->getId()}/" title="{$aLang.topic_link_count_jump}: {$oTopic->getLinkCountJump()}">{$oTopic->getLinkUrl(true)}</a></li>
|
||||
{/if}
|
||||
|
|
Loading…
Reference in a new issue