#0 | Phalcon\Text::lower
/var/www/html/cache/_var_www_html_app_views_index_chord.volt.php (94) <script>
function addRecentChord(slug, title, artist) {
console.log('[addRecentChord] Called with:', { slug, title, artist });
try {
const recents = JSON.parse(localStorage.getItem('recentChords') || '[]');
console.log('[addRecentChord] Existing recents:', recents);
const filtered = recents.filter(item => item.slug !== slug);
filtered.unshift({ slug, title, artist });
const limited = filtered.slice(0, 6);
localStorage.setItem('recentChords', JSON.stringify(limited));
console.log('[addRecentChord] Updated recents:', limited);
} catch (e) {
console.error('[addRecentChord] Error:', e);
}
}
function renderRecentChords() {
const container = document.getElementById('recentChordsContainer');
if (!container) {
console.warn('[renderRecentChords] Container not found');
return;
}
const recentsRaw = localStorage.getItem('recentChords');
console.log('[renderRecentChords] Raw local data:', recentsRaw);
let recents = [];
try {
recents = JSON.parse(recentsRaw || '[]');
} catch (err) {
console.error('[renderRecentChords] JSON parse error:', err);
}
console.log('[renderRecentChords] Parsed recents:', recents);
if (!Array.isArray(recents) || recents.length === 0) {
container.innerHTML = '';
container.style.display = 'none';
console.log('[renderRecentChords] No recent chords found. Container hidden.');
return;
}
let html = `<div class="suggestion-header">Recent Open</div>`;
html += recents.map(chord => `
<div class="suggestion-item">
<a href="/chords/${chord.slug[0]}/${chord.slug}.html">
<span class="icon">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="23 6 13.5 15.5 8.5 10.5 1 18"></polyline>
<polyline points="17 6 23 6 23 12"></polyline>
</svg>
</span>
<span class="title">${chord.title} <span class="text-muted">by ${chord.artist}</span></span>
</a>
</div>
`).join('');
container.innerHTML = html;
container.style.display = 'block';
console.log('[renderRecentChords] Rendered HTML inserted, container shown.');
}
document.addEventListener('DOMContentLoaded', function () {
// Run addRecentChord if data is available
const el = document.getElementById('recentChordData');
if (el) {
const slug = el.dataset.slug;
const title = el.dataset.title;
const artist = el.dataset.artist;
if (slug && title && artist) {
addRecentChord(slug, title, artist);
console.log('[chord.volt] addRecentChord fired');
}
}
// Always render the recent list
renderRecentChords();
});
</script>
<div class="page-bg chord-bg" style="background-image: url('<?= $this->url->get(($chord->Artist->artwork != null ? $chord->Artist->artwork : 'images/bg_default.jpg')) ?>');background-position: top"></div>
<div class="row-col">
<?= $this->partial('components/left-sidebar') ?>
<div class="col-lg-9 b-r no-border-md">
<div class="padding b-b">
<nav aria-label="breadcrumb">
<ol class="breadcrumb text-sm">
<li class="breadcrumb-item"><a href="https://www.musikord.com/">Home</a></li>
<li class="breadcrumb-item"><a href="#"><?= $this->tag->linkTo(['artists/' . substr(Phalcon\Text::lower($chord->Artist->slug), 0, 1) . '/' . (Phalcon\Text::lower($chord->Artist->slug)) . '.html', $chord->Artist->title]) ?></a></li>
<li style="width: max-content" class="breadcrumb-item active text-ellipsis" aria-current="page"><?= $chord->title ?></li>
</ol>
</nav>
<div class="row-col">
<div class="col-sm w w-auto-xs m-b">
<div class="item w r" data-id="item-<?= $chord->id ?>" data-src="https://www.youtube.com/watch?v=<?= $chord->video ?>">
<div class="item-media semi-rounded hidden-xs-down">
<div class="item-media-content" style="background-image: url('<?= $this->url->get(($chord->Artist->artwork != null ? $chord->Artist->artwork : 'images/bg_default.jpg')) ?>')" alt="<?= $chord->title ?>">
<div style="display: none" class="item-overlay center mejs-button mejs-playpause-button">
<button class="btn-playpause" aria-controls="mep_0"></button>
</div>
</div>
<div class="item-info" style="display: none">
<div class="item-title text-allipsis">
<?= $this->tag->linkTo([$_SERVER['REQUEST_URI'], $chord->title]) ?>
</div>
<div class="item-author text-sm text-ellipsis">
<?= $this->tag->linkTo(['artist/' . Phalcon\Text::lower($chord->Artist->slug)]) ?>
</div>
</div>
</div>
<!--
<?php if ($this->length($chord->Artist->wallpaper) > 0) { ?>
<span style="position: absolute; right: 5px; bottom: 5px;">
<?= $this->tag->image([$chord->Artist->artwork, 'style' => 'border:4px solid white;width: 50px;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 4px 8px 0 rgba(0, 0, 0, 0.19);', 'class' => 'avatar-w-60']) ?>
</span>
<?php } ?>
-->
</div>
</div>
<div class="col-sm">
<div class="p-l-md no-padding-xs">
<div class="page-title">
<h1 class="inline title-mobile" alt="<?= $chord->title ?>" title="<?= $chord->title ?>">
<?= $chord->title ?>
</h1>
<?= $this->partial('components/explicit') ?>
</div>
<p class="item-author text-ellipsis text-muted"><span class="text-muted">by</span>
<?= $this->tag->linkTo(['artists/' . substr(Phalcon\Text::lower($chord->Artist->slug), 0, 1) . '/' . (Phalcon\Text::lower($chord->Artist->slug)) . '.html', $chord->Artist->title]) ?>
<?php if ($this->length($featuring) > 0) { ?>
<span class="text-muted">feat</span> <?php $v166114941458396728911iterator = $featuring; $v166114941458396728911incr = 0; $v166114941458396728911loop = new stdClass(); $v166114941458396728911loop->self = &$v166114941458396728911loop; $v166114941458396728911loop->length = count($v166114941458396728911iterator); $v166114941458396728911loop->index = 1; $v166114941458396728911loop->index0 = 1; $v166114941458396728911loop->revindex = $v166114941458396728911loop->length; $v166114941458396728911loop->revindex0 = $v166114941458396728911loop->length - 1; ?><?php foreach ($v166114941458396728911iterator as $featured_artist) { ?><?php $v166114941458396728911loop->first = ($v166114941458396728911incr == 0); $v166114941458396728911loop->index = $v166114941458396728911incr + 1; $v166114941458396728911loop->index0 = $v166114941458396728911incr; $v166114941458396728911loop->revindex = $v166114941458396728911loop->length - $v166114941458396728911incr; $v166114941458396728911loop->revindex0 = $v166114941458396728911loop->length - ($v166114941458396728911incr + 1); $v166114941458396728911loop->last = ($v166114941458396728911incr == ($v166114941458396728911loop->length - 1)); ?>
<?= $this->tag->linkTo(['artists/' . substr(Phalcon\Text::lower($featured_artist->slug), 0, 1) . '/' . (Phalcon\Text::lower($featured_artist->slug)) . '.html', $featured_artist->title]) ?><?= (!$v166114941458396728911loop->last ? ', ' : null) ?>
<?php $v166114941458396728911incr++; } ?>
<?php } ?>
</p>
<div class="item-action m-b">
<a href="#" id="share-btn-2" class="btn btn-icon white rounded btn-share pull-right" title="Share this page">
<i class="fa fa-share-alt"></i>
</a>
<button style="display: none" class="btn-playpause text-primary m-r-sm"></button>
<a href="#" style="display:none" class="btn btn-icon rounded btn-favorite" data-toggle="modal" data-target="#modal-scrolling" title="Expand chord dan lirik">
<i class="fa fa-expand" aria-hidden="true"></i>
</a>
<a href="#" class="btn btn-icon btn-xs rounded btn-favorite" aria-label="View">
<i class="fa fa-eye"></i>
</a>
<span class="text-muted">
<span dataconvert>
<?= $this->getDI()->get("shortNumber")->__invoke($chord->view) ?>
</span>
</span>
<!--
<a href="#" class="btn btn-icon rounded btn-favorite" data-toggle="modal" data-target="#list-modal" title="Lihat semua lagu" aria-label="Modal">
<i class="fa fa-list-ul" aria-hidden="true"></i>
</a>
-->
<span style="display: inline-block; margin-left: 10px;">
<a href="<?= $this->url->get('add-favourite/' . $chord->id) ?>"
data-id="<?= $chord->id ?>"
title="Like"
class="btn m-b-xs btn-outline btn-xs rounded favourite-toggle <?= (!$is_favourite ? 'b-success text-success' : 'b-danger text-danger') ?>"
type="submit" name="submit">
<i class="fa fa-heart" aria-hidden="true"></i>
<?php if (isset($chord->fav_count) && $chord->fav_count > 0) { ?>
<span class="fav-count"><?= $chord->fav_count ?></span>
<?php } ?>
</a>
</span>
<div class="inline dropdown m-l-xs">
<a href="#" class="btn btn-icon rounded btn-more m-b-xs" data-toggle="dropdown" aria-label="Dropdown">
<i class="fa fa-ellipsis-h"></i>
</a>
<div class="dropdown-menu dropdown-menu-scale pull-right">
<?php if ($chord->itunes != null) { ?>
<a class="dropdown-item" href="<?= $chord->itunes ?>" target="_blank">
<i class="fa fa-apple" aria-hidden="true"></i> Buy on iTunes
</a>
<?php } ?>
<a class="dropdown-item" href="<?= $this->url->get('submit/chord') ?>">
<span class="material-icons">add</span> Submit Chords
</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#share-modal">
<i class="fa fa-share-alt" aria-hidden="true"></i> Share
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#list-modal">
<i class="fa fa-list-ul" aria-hidden="true"></i> All Songs
</a>
</div>
</div>
</div>
<?php if ($chord->soundcloud != null) { ?>
<span style="display: none" class='progress'>
<div class='progress-bar'></div>
</span>
<?php } ?>
<div class="item-meta">
<?php $v166114941458396728911iterator = $chord->Artist->genre; $v166114941458396728911incr = 0; $v166114941458396728911loop = new stdClass(); $v166114941458396728911loop->self = &$v166114941458396728911loop; $v166114941458396728911loop->length = count($v166114941458396728911iterator); $v166114941458396728911loop->index = 1; $v166114941458396728911loop->index0 = 1; $v166114941458396728911loop->revindex = $v166114941458396728911loop->length; $v166114941458396728911loop->revindex0 = $v166114941458396728911loop->length - 1; ?><?php foreach ($v166114941458396728911iterator as $genre) { ?><?php $v166114941458396728911loop->first = ($v166114941458396728911incr == 0); $v166114941458396728911loop->index = $v166114941458396728911incr + 1; $v166114941458396728911loop->index0 = $v166114941458396728911incr; $v166114941458396728911loop->revindex = $v166114941458396728911loop->length - $v166114941458396728911incr; $v166114941458396728911loop->revindex0 = $v166114941458396728911loop->length - ($v166114941458396728911incr + 1); $v166114941458396728911loop->last = ($v166114941458396728911incr == ($v166114941458396728911loop->length - 1)); ?>
<a style="text-transform: capitalize" href="<?= $this->url->get('artists/genre/' . urldecode($genre)) ?>" class="btn btn-xs rounded white">
<?= urldecode($genre) ?>
</a>
<?php $v166114941458396728911incr++; } ?>
</div>
</div>
</div>
</div>
</div>
<div id="chord-section" class="padding <?= ($chord->chord != null ? 'col-lg-11' : 'col-lg-12') ?>">
<?php if ($chord->chord != null) { ?>
<div class="nav-active-border b-danger bottom m-b-md">
<ul class="nav l-h-2x">
<li class="nav-item m-r inline"> <a class="nav-link active" href="#chord" data-toggle="tab" data-target="#chord">Chords</a> </li>
<li class="nav-item m-r inline"> <a class="nav-link" href="#lirik" data-toggle="tab" data-target="#lirik">Lyrics</a> </li>
<li class="nav-item m-r inline"> <a class="nav-link" href="#tab1" data-toggle="tab" data-target="#tab1">Tab</a> </li>
<li class="nav-item m-r inline"> <a class="nav-link" href="#video" data-toggle="tab" data-target="#video">Listen</a> </li>
<?php if ($chord->itunes != null) { ?>
<li class="nav-item m-r inline"> <a class="nav-link" href="#buy" data-toggle="tab" data-target="#buy"><i class="fa fa-apple" aria-hidden="true"></i> Buy</a> </li>
<?php } ?>
</ul>
</div>
<?php } ?>
<div class="tab-content">
<div class="tab-pane active" id="chord">
<div class="row item-list item-list-md item-list-li" id="tracks">
<div id="printableArea" class="col-md-12 col-lg-11">
<?php if ($chord->chord != null) { ?>
<div id="instrument-tabs" style="margin-bottom: 10px;">
<button onclick="setInstrument('guitar')" class="active">Guitar</button>
<button onclick="setInstrument('ukulele')">Ukulele</button>
<button onclick="setInstrument('piano')">Piano</button>
</div>
<div id="chord-diagram-bar"></div>
<div id="chord-wrapper">
<pre class="chord-content" id="tab" style="background: transparent !important;width: 100%;"><?= $chord->chord ?></pre>
</div>
<?php } ?>
</div>
</div>
<?php if ($chord->chord == null) { ?>
<center class="m-t-lg text-center">
<h3 class="hidden-xs-down">Chord not Available</h3>
<h4 class="hidden-md-up">Chord not Available</h4>
<p>Be the first to submit <span class="text-danger"><?= $chord->title ?></span> and earn points for every chord you contribute!</p>
<a style="margin-bottom:80px" href="<?= $this->url->get('submit/' . Phalcon\Text::lower($chord->slug)) ?>" class="btn btn-lg btn-outline danger rounded">
<span class="material-icons">add</span> Submit chords
</a>
</center>
<?php } ?>
</div>
<div class="tab-pane" id="lirik">
<div class="row m-b">
<div class="col-md-12 col-lg-9">
<?php if ($chord->lyric != null) { ?>
<pre class="chord" style="font-family: Helvetica;background: transparent !important;white-space: pre-line;font-weight: normal !important;padding: 0px" class="lyric-font">
<?= $chord->lyric ?>
</pre>
<?php } else { ?>
<div class="text-muted">Lyrics not available</div>
<?php } ?>
</div>
</div>
</div>
<div class="tab-pane" id="tab1">
<div class="row m-b">
<div class="col-md-12 col-lg-9">
<?php if ($chord->tab != null) { ?>
<pre style="background: transparent !important;white-space: pre-line;" class="lyric-font">
<?= $chord->tab ?>
</pre>
<?php } else { ?>
<div class="text-muted">Tab not available</div>
<?php } ?>
</div>
</div>
</div>
<div class="tab-pane" id="video">
<div class="row">
<div style="display:none;" class="col-xs-6 col-sm-6 col-md-4">
<?= $this->partial('components/sponsor-card') ?>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="item r" data-id="item-3" data-src="https://api.soundcloud.com/tracks/79031167/stream?client_id=a10d44d431ad52868f1bce6d36f5234c">
<div class="item-media semi-rounded item-media-4by3">
<?php if ($chord->video != null) { ?>
<a href="#" data-theVideo="https://www.youtube.com/embed/<?= $chord->video ?>" data-toggle="modal" data-target="#videoModal" class="item-media-content" style="background-image: url('https://img.youtube.com/vi/<?= $chord->video ?>/0.jpg');width: 100%;height: 350px;object-fit: cover;background-position: 60% -50px;" alt="<?= $chord->title ?>" title="<?= $chord->title ?>" aria-label="Artwork"></a>
<?php } else { ?>
<a href="<?= $this->url->get('chord/' . $chord->slug) ?>" target="_blank" class="item-media-content" style="background-image: url('<?= $this->url->get('images/bg_default.jpg') ?>');" alt="<?= $chord->title ?>" title="<?= $chord->title ?>"></a>
<?php } ?>
<div class="item-overlay center overlay-play-video">
<button href="#" data-theVideo="https://www.youtube.com/embed/<?= $chord->video ?>" data-toggle="modal" data-target="#videoModal" class="btn-playpause">Play</button>
</div>
</div>
<div style="display: none" class="item-info">
<div class="item-overlay bottom text-right">
<a href="#" class="btn-favorite">
<i class="fa fa-heart-o"></i>
</a>
<a href="#" class="btn-more" data-toggle="dropdown">
<i class="fa fa-ellipsis-h"></i>
</a>
<div class="dropdown-menu pull-right black lt"></div>
</div>
<div class="item-title text-ellipsis">
<a href="#" onclick="window.location.href='<?= $this->url->get('chord/' . $chord->slug) ?>'" href="<?= $this->url->get('chord/' . $chord->slug) ?>">
<?= $chord->title ?>
</a>
</div>
<div class="item-author text-sm text-ellipsis ">
<a href="#" onclick="window.location.href='<?= $this->url->get('artist/' . $chord->Artist->slug) ?>" href="<?= $this->url->get('artist/' . $chord->Artist->slug) ?>" class="text-muted">
<?= $chord->Artist->title ?>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="buy">
<div class="row m-b">
<div class="col-md-12 col-lg-9">
<a href="<?= $chord->itunes ?>" target="_blank">
<i class="fa fa-apple" aria-hidden="true"></i> Buy song
<span class="text-danger"><?= $chord->title ?> on iTunes store
</a>
<small>
<i>
<p class="text-mute">Support artists with purchashing the original song!</p>
</i>
</small>
</div>
</div>
</div>
<?php if ($chord->RequestBy != null) { ?>
<div class="list box box-shadow-z2">
<div class="list-item">
<div class="list-body">
<span class="_500"><span class="text-muted"><i class="material-icons">account_circle</i> Chord request by </span>
<?= $chord->RequestBy->name ?>
</span>
<small class="block text-muted">
<?= $chord->RequestBy->bio ?>
</small>
</div>
</div>
</div>
<?php } ?>
<?php if ($chord->chord != null) { ?>
<div class="see-more-container text-left m-t-md">
<button id="share-btn-3" class="share-chord-button text-info">Share<span class="material-icons">arrow_outward</span></button>
<button onclick="savePdf()" class="share-chord-button text-info">Save PDF<span style="font-size: 20px" class="material-icons">picture_as_pdf</span></button>
<span class="share-chord-button pull-right text-muted m-r-0">
<?php if (!empty($chord->update_time)) { ?>
<span style="margin-right: 3px;font-size: 20px" class="material-icons">access_time</span>Last updated: <?= $this->getDI()->get("timeAgoNoDay")->__invoke($chord->update_time) ?>
<?php } ?>
</span>
</div>
<?php } ?>
</div>
<!--
<?php if (isset($current_artist)) { ?>
<div class="hidden-sm-up p-t-md">
<div sty id="tracks" class="row item-list item-list-xs item-list-li m-b no-padding-xs">
<div class="col-lg-12 col-xs-12 no-padding-xs">
<?php $v166114941458396728911iterator = $chord_list; $v166114941458396728911incr = 0; $v166114941458396728911loop = new stdClass(); $v166114941458396728911loop->self = &$v166114941458396728911loop; $v166114941458396728911loop->length = count($v166114941458396728911iterator); $v166114941458396728911loop->index = 1; $v166114941458396728911loop->index0 = 1; $v166114941458396728911loop->revindex = $v166114941458396728911loop->length; $v166114941458396728911loop->revindex0 = $v166114941458396728911loop->length - 1; ?><?php foreach ($v166114941458396728911iterator as $chord) { ?><?php $v166114941458396728911loop->first = ($v166114941458396728911incr == 0); $v166114941458396728911loop->index = $v166114941458396728911incr + 1; $v166114941458396728911loop->index0 = $v166114941458396728911incr; $v166114941458396728911loop->revindex = $v166114941458396728911loop->length - $v166114941458396728911incr; $v166114941458396728911loop->revindex0 = $v166114941458396728911loop->length - ($v166114941458396728911incr + 1); $v166114941458396728911loop->last = ($v166114941458396728911incr == ($v166114941458396728911loop->length - 1)); ?>
<?= $this->callMacro('chord_list', [$chord]) ?>
<?php $v166114941458396728911incr++; } ?>
</div>
</div>
</div>
<?php } ?>
-->
<div id="stopper"></div>
</div>
<div id="sticky-anchor"></div>
<div class="padding col-lg-1 static-sticky hide-mobile stick" id="sticky">
<div class="nav-active-border b-danger bottom m-b-md">
<ul class="nav l-h-2x">
<li class="nav-item inline pull-right button-transpose hide-mobile">
<?php if ($chord->chord != null) { ?>
<div class="scroll-control-container" id="scroll-controls-desktop">
<!-- Left buttons -->
<button onclick="transpose(1)" class="extra-btn btn circle btn-outline b-black rounded text-black btn-night"><span class="material-icons">plus_one</span></button>
<button onclick="transpose(-1)" class="extra-btn btn circle btn-outline b-black rounded text-black btn-night"><span class="material-icons">exposure_neg_1</span></button>
<button onclick="savePdf()" class="extra-btn btn circle btn-outline b-black rounded text-black btn-night"><span class="material-icons">picture_as_pdf</span></button>
<!-- Center play button group -->
<div id="center-controls-desktop" style="display: flex; flex-direction: column; align-items: center; gap: 0.6em;">
<!-- add = top -->
<!-- play = center -->
<button id="play-btn-desktop" class="scroll-btn btn circle btn-outline black text-black btn-night-play">
<span class="material-icons">north</span>
</button>
<button id="speed-up-btn-desktop" class="scroll-btn hidden btn circle btn-outline black text-black btn-night-play">
<span class="material-icons">add</span>
</button>
<!-- remove = bottom -->
<button id="speed-down-btn-desktop" class="scroll-btn hidden btn circle btn-outline black text-black btn-night-play">
<span class="material-icons">remove</span>
</button>
</div>
<!-- Right buttons -->
<button id="large" class="extra-btn btn circle btn-outline b-black rounded text-black btn-night"><span class="material-icons">text_increase</span></button>
<button id="medium" class="extra-btn btn circle btn-outline b-black rounded text-black btn-night"><span class="material-icons">text_format</span></button>
<button id="small" class="extra-btn btn circle btn-outline b-black rounded text-black btn-night"><span class="material-icons">text_decrease</span></button>
</div>
<?php } ?>
<!--
<?php if ($this->session->has('user')) { ?>
<form style="display: none" method="post" action="/vote/vote">
<input type="hidden" name="division" value="chords">
<input type="hidden" name="content" value="<?= $chord->id ?>">
<label>Rate this chord:</label>
<select name="value" required>
<option value="5">⭐️⭐️⭐️⭐️⭐️</option>
<option value="4">⭐️⭐️⭐️⭐️</option>
<option value="3">⭐️⭐️⭐️</option>
<option value="2">⭐️⭐️</option>
<option value="1">⭐️</option>
</select>
<button type="submit">Vote</button>
</form>
<?php } else { ?>
<p><a href="/auth">Login</a> to vote</p>
<?php } ?>
<?php if ($this->session->has('user')) { ?>
<a href="/share/chord/<?= $chord->id ?>" class="btn btn-share">Share</a>
<?php } else { ?>
<a href="/auth?r=preview/<?= $chord->id ?>" class="btn btn-share">Login to Share</a>
<?php } ?>
-->
</li>
</ul>
</div>
</div>
<?= $this->partial('components/footer-content', ['chord_id' => $chord->id]) ?>
</div>
<?= $this->partial('components/right-sidebar') ?>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.favourite-toggle').forEach(function (el) {
el.addEventListener('click', function (e) {
e.preventDefault();
const link = this;
const id = link.dataset.id;
fetch(`/add-favourite/${id}`, {
method: 'POST',
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(res => res.json())
.then(data => {
if (data.success) {
const countEl = link.querySelector('.fav-count');
if (data.count > 0) {
if (countEl) {
countEl.textContent = data.count;
} else {
const newCountEl = document.createElement('span');
newCountEl.className = 'fav-count';
newCountEl.textContent = data.count;
link.appendChild(newCountEl);
}
} else {
// If count is 0, remove the span if it exists
if (countEl) countEl.remove();
}
// Toggle color class
link.classList.remove('b-success', 'text-success', 'b-danger', 'text-danger');
if (data.status === 'added') {
link.classList.add('b-danger', 'text-danger');
} else {
link.classList.add('b-success', 'text-success');
}
} else if (data.error === 'not_logged_in') {
window.location.href = '/auth?r=' + encodeURIComponent(window.location.href);
}
});
});
});
});
</script> |