1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 00:37:42 +02:00

[ticket/16237] fix ajax subscribe icons

PHPBB3-16237
This commit is contained in:
hanakin
2020-05-02 17:46:58 -10:00
parent dc4fe2d4b7
commit 8f4b546958
7 changed files with 61 additions and 35 deletions

View File

@@ -1052,11 +1052,11 @@ phpbb.addAjaxCallback('alt_text', function() {
* and changes the link itself.
*/
phpbb.addAjaxCallback('toggle_link', function() {
var $anchor,
updateAll = $(this).data('update-all') ,
toggleText,
toggleUrl,
toggleClass;
let $anchor;
let updateAll = $(this).data('update-all');
let toggleText;
let toggleUrl;
let toggleIcon;
if (updateAll !== undefined && updateAll.length) {
$anchor = $(updateAll);
@@ -1067,21 +1067,19 @@ phpbb.addAjaxCallback('toggle_link', function() {
$anchor.each(function() {
var $this = $(this);
// Toggle link text
toggleText = $.trim($this.attr('data-toggle-text'));
$this.attr('data-toggle-text', $.trim($this.children('span').text()));
$this.attr('title', toggleText);
$this.children('span').last().text(toggleText);
// Toggle link url
toggleUrl = $this.attr('data-toggle-url');
$this.attr('data-toggle-url', $this.attr('href'));
$this.attr('href', toggleUrl);
// Toggle class of link parent
toggleClass = $this.attr('data-toggle-class');
$this.attr('data-toggle-class', $this.children().attr('class'));
$this.children('.icon').attr('class', toggleClass);
// Toggle link text
toggleText = $this.attr('data-toggle-text');
$this.attr('data-toggle-text', $this.children('span').text());
$this.attr('title', $.trim(toggleText));
$this.children('span').text(toggleText);
// Toggle Icon
$this.children().first().toggleClass('is-active').next().toggleClass('is-active')
});
});