{if MODULE_LIKE && $__wcf->session->getPermission('user.like.canLike') && (LIKE_ALLOW_FOR_OWN_CONTENT || $article->userID != $__wcf->user->userID)}
<div class="col-xs-12 col-md-6">
<ul class="articleLikeButtons buttonGroup">
- <li class="jsOnly"><span class="button reactButton{if $articleLikeData[$article->articleID]|isset && $articleLikeData[$article->articleID]->reactionTypeID} active{/if}" title="{lang}wcf.reactions.react{/lang}">{if $articleLikeData[$article->articleID]|isset && $articleLikeData[$article->articleID]->reactionTypeID}{@$__wcf->getReactionHandler()->getReactionTypeByID($articleLikeData[$article->articleID]->reactionTypeID)->renderIcon()}{else}<img src="{$__wcf->getPath()}/images/reaction/reactionIcon.svg" class="reactionType" alt="">{/if}</span></li>
+ <li class="jsOnly"><span class="button reactButton{if $articleLikeData[$article->articleID]|isset && $articleLikeData[$article->articleID]->reactionTypeID} active{/if}" title="{lang}wcf.reactions.react{/lang}" data-reaction-type-id="{if $articleLikeData[$article->articleID]|isset && $articleLikeData[$article->articleID]->reactionTypeID}{$articleLikeData[$article->articleID]->reactionTypeID}{else}0{/if}"><span class="icon icon16 fa-smile-o"></span> <span class="invisible">{lang}wcf.reactions.react{/lang}</span></span></li>
<li class="jsReportArticle jsOnly" data-object-id="{@$articleContent->articleContentID}"><a href="#" title="{lang}wcf.moderation.report.reportContent{/lang}" class="button jsTooltip"><span class="icon icon16 fa-exclamation-triangle"></span> <span class="invisible">{lang}wcf.moderation.report.reportContent{/lang}</span></a></li>
</ul>
</div>
{/if}
{if MODULE_LIKE && $__wcf->session->getPermission('user.like.canLike') && (LIKE_ALLOW_FOR_OWN_CONTENT || $comment->userID != $__wcf->user->userID)}
- <li class="jsOnly"><a href="#" class="reactButton jsTooltip" title="{lang}wcf.reactions.react{/lang}">{if $likeData[comment][$comment->commentID]|isset && $likeData[comment][$comment->commentID]->reactionTypeID}{@$__wcf->getReactionHandler()->getReactionTypeByID($likeData[comment][$comment->commentID]->reactionTypeID)->renderIcon()}{else}<img src="{$__wcf->getPath()}/images/reaction/reactionIcon.svg" class="reactionType">{/if} <span class="invisible">{lang}wcf.reactions.react{/lang}</span></a></li>
+ <li class="jsOnly"><a href="#" class="reactButton jsTooltip {if $likeData[comment][$comment->commentID]|isset && $likeData[comment][$comment->commentID]->reactionTypeID} active{/if}" title="{lang}wcf.reactions.react{/lang}" data-reaction-type-id="{if $likeData[comment][$comment->commentID]|isset && $likeData[comment][$comment->commentID]->reactionTypeID}{$likeData[comment][$comment->commentID]->reactionTypeID}{else}0{/if}"><span class="icon icon16 fa-smile-o"></span> <span class="invisible">{lang}wcf.reactions.react{/lang}</span></a></li>
{/if}
{event name='commentOptions'}
<li class="jsReportCommentResponse jsOnly" data-object-id="{@$response->responseID}"><a href="#" title="{lang}wcf.moderation.report.reportContent{/lang}" class="jsTooltip"><span class="icon icon16 fa-exclamation-triangle"></span> <span class="invisible">{lang}wcf.moderation.report.reportContent{/lang}</span></a></li>
{/if}
- {if MODULE_LIKE && $__wcf->session->getPermission('user.like.canLike') && (LIKE_ALLOW_FOR_OWN_CONTENT || $response->userID != $__wcf->user->userID)}<li class="jsOnly"><a href="#" class="reactButton jsTooltip" title="{lang}wcf.reactions.react{/lang}">{if $likeData[response][$response->responseID]|isset && $likeData[response][$response->responseID]->reactionTypeID}{@$__wcf->getReactionHandler()->getReactionTypeByID($likeData[response][$response->responseID]->reactionTypeID)->renderIcon()}{else}<img src="{$__wcf->getPath()}/images/reaction/reactionIcon.svg" class="reactionType">{/if} <span class="invisible">{lang}wcf.reactions.react{/lang}</span></a></li>{/if}
+ {if MODULE_LIKE && $__wcf->session->getPermission('user.like.canLike') && (LIKE_ALLOW_FOR_OWN_CONTENT || $response->userID != $__wcf->user->userID)}<li class="jsOnly"><a href="#" class="reactButton jsTooltip {if $likeData[response][$comment->commentID]|isset && $likeData[response][$comment->commentID]->reactionTypeID} active{/if}" title="{lang}wcf.reactions.react{/lang}" data-reaction-type-id="{if $likeData[response][$comment->commentID]|isset && $likeData[response][$comment->commentID]->reactionTypeID}{$likeData[response][$comment->commentID]->reactionTypeID}{else}0{/if}"><span class="icon icon16 fa-smile-o"></span> <span class="invisible">{lang}wcf.reactions.react{/lang}</span></a></li>{/if}
{event name='commentOptions'}
</ul>
button.href = '#';
button.title = title;
- var icon = elCreate('img');
- icon.className = 'reactionType';
+ var icon = elCreate('span');
+ icon.className = 'icon icon16 fa-smile-o';
if (reactionTypeID === undefined || reactionTypeID == 0) {
- icon.src = WCF_PATH+'images/reaction/reactionIcon.svg';
elData(icon, 'reaction-type-id', 0);
}
else {
- icon.src = REACTION_TYPES[reactionTypeID].iconPath;
- elData(icon, 'reaction-type-id', reactionTypeID);
-
+ elData(button, 'reaction-type-id', reactionTypeID);
button.classList.add("active");
}
messageFooterGroup.appendChild(button);
},
- _rebuildMobileView: function(objectID) {
- if (this._containers.get(objectID).reactButton.closest('.messageFooterGroup > .jsMobileNavigation')) {
- var messageFooterGroup = this._containers.get(objectID).reactButton.parentElement.parentElement.parentElement;
- var button = elBySel('.mobileReactButton', messageFooterGroup);
-
- if (button !== null) {
- button.innerHTML = this._containers.get(objectID).reactButton.innerHTML;
- }
- }
- },
-
_updateReactButton: function(objectID, reactionTypeID) {
if (reactionTypeID) {
this._containers.get(objectID).reactButton.classList.add('active');
-
- // update icon
- elBySel('img', this._containers.get(objectID).reactButton).src = REACTION_TYPES[reactionTypeID].iconPath;
- elData(elBySel('img', this._containers.get(objectID).reactButton), 'reaction-type-id', reactionTypeID);
+ elData(this._containers.get(objectID).reactButton, 'reaction-type-id', reactionTypeID);
}
else {
+ elData(this._containers.get(objectID).reactButton, 'reaction-type-id', 0);
this._containers.get(objectID).reactButton.classList.remove('active');
-
- // update icon
- elBySel('img', this._containers.get(objectID).reactButton).src = WCF_PATH + 'images/reaction/reactionIcon.svg';
- elData(elBySel('img', this._containers.get(objectID).reactButton), 'reaction-type-id', 0);
}
+ },
+
+ _markReactionAsActive() {
+ var reactionTypeID = elData(this._containers.get(this._popoverCurrentObjectId).reactButton, 'reaction-type-id');
- this._rebuildMobileView(objectID);
+ // clear old active state
+ var elements = elBySelAll('.reactionTypeButton.active', this._getPopover());
+ for (var i = 0, length = elements.length; i < length; i++) {
+ elements[i].classList.remove('active');
+ }
+
+ if (reactionTypeID != 0) {
+ elBySel('.reactionTypeButton[data-reaction-type-id="'+reactionTypeID+'"]', this._getPopover()).classList.add('active');
+ }
},
/**
this._closePopover(this._popoverCurrentObjectId, this._containers.get(this._popoverCurrentObjectId).reactButton);
}
+ this._popoverCurrentObjectId = objectId;
+ this._markReactionAsActive();
+
UiAlignment.set(this._getPopover(), element, {
pointer: true,
horizontal: (this._options.isButtonGroupNavigation) ? 'left' :'center',
vertical: 'top'
});
- this._popoverCurrentObjectId = objectId;
-
if (this._options.isButtonGroupNavigation) {
// find nav element
var nav = element.closest('nav');
background-color: $wcfContentBackground;
border-radius: 3px;
color: $wcfContentText;
- padding: 15px;
a {
color: $wcfContentLink;
}
@include screen-md-down {
+ padding: 5px 0px;
+
> ul > li.reactionTypeButton {
margin: 0px;
display: block;
- padding: 5px 10px;
+ padding: 5px 25px;
}
> ul > li.reactionTypeButton > .reactionTypeButtonTitle {
vertical-align: middle;
padding-left: 5px;
}
+
+ > ul > li.reactionTypeButton.active {
+ background-color: $wcfContentBorderInner; // @TODO maybe find a better color value
+ }
}
@include screen-lg {
+ padding: 5px 15px;
+
> ul > li.reactionTypeButton > .reactionTypeButtonTitle {
display: none;
}
> ul > li.reactionTypeButton {
- display: inline;
+ display: inline-block;
+ padding-top: 10px;
+ padding-bottom: 10px;
cursor: pointer;
margin-left: 10px;
}
+ > ul > li.reactionTypeButton.active {
+ padding-left: 5px;
+ padding-right: 5px;
+ }
+
+ > ul > li.reactionTypeButton.active > img {
+ transform: scale(1.4);
+ }
+
+ > ul > li.reactionTypeButton.active > img:hover {
+ transform: scale(1.2);
+ }
+
> ul > li.reactionTypeButton:first-child {
margin-left: 0px;
}