| @@ -1656,8 +1656,15 @@ | ||
| 1656 | 1656 | seodState.scanAborted = true; |
| 1657 | 1657 | $(this).prop('disabled', true).find('span').text('Stopping...'); |
| 1658 | 1658 | }); |
| 1659 | 1659 | |
| 1660 | + // "Connect Search Console" hint row → jump to the Settings section, | |
| 1661 | + // where the add-on's GSC card lives (eadc60). | |
| 1662 | + $(document).on('click', '.mxch-seod-gsc-hint-link', function(e) { | |
| 1663 | + e.preventDefault(); | |
| 1664 | + $('.mxch-nav-link[data-target="content-settings"]').trigger('click'); | |
| 1665 | + }); | |
| 1666 | + | |
| 1660 | 1667 | // Sortable column headers (all columns sort server-side) |
| 1661 | 1668 | $(document).on('click', '.mxch-seod-header-cell[data-sort]', function() { |
| 1662 | 1669 | var col = $(this).data('sort'); |
| 1663 | 1670 | if (seodState.sortBy === col) { |
| @@ -1785,9 +1792,16 @@ | ||
| 1785 | 1792 | var $table = $('#mxch-seod-table'); |
| 1786 | 1793 | $table.empty(); |
| 1787 | 1794 | seodState.expandedId = null; |
| 1788 | 1795 | |
| 1789 | - // Column headers | |
| 1796 | + // Column headers. | |
| 1797 | + // gscUnlinked: the add-on unlocked the GSC columns, but Search Console | |
| 1798 | + // itself isn't linked yet — every cell is a dash, so sorting Clicks / | |
| 1799 | + // Impr. is noise. Keep the unlocked look, drop data-sort, and show one | |
| 1800 | + // slim hint row pointing at the Settings tab (eadc60). When linked, | |
| 1801 | + // rendering below is byte-identical to before. | |
| 1802 | + var gscUnlinked = mxchatContent.hasGSC && !mxchatContent.gscLinked; | |
| 1803 | + var gscSortable = mxchatContent.hasGSC && !gscUnlinked; | |
| 1790 | 1804 | var activeClass = function(col) { return seodState.sortBy === col ? ' mxch-seod-header-active' : ''; }; |
| 1791 | 1805 | $table.append( |
| 1792 | 1806 | '<div class="mxch-seod-header">' + |
| 1793 | 1807 | '<div class="mxch-seod-header-cell mxch-seod-header-check"><input type="checkbox" class="mxch-seod-check-all" title="Select all"></div>' + |
| @@ -1793,13 +1807,24 @@ | ||
| 1793 | 1807 | '<div class="mxch-seod-header-cell mxch-seod-header-check"><input type="checkbox" class="mxch-seod-check-all" title="Select all"></div>' + |
| 1794 | 1808 | '<div class="mxch-seod-header-cell mxch-seod-header-title' + activeClass('title') + '" data-sort="title">Title' + seodSortArrow('title') + '</div>' + |
| 1795 | 1809 | '<div class="mxch-seod-header-cell mxch-seod-header-date' + activeClass('date') + '" data-sort="date">Date' + seodSortArrow('date') + '</div>' + |
| 1796 | 1810 | '<div class="mxch-seod-header-cell mxch-seod-header-score' + activeClass('score') + '" data-sort="score">Score' + seodSortArrow('score') + '</div>' + |
| 1797 | - '<div class="mxch-seod-header-cell mxch-seod-header-clicks' + (!mxchatContent.hasGSC ? ' mxch-seod-header-locked' : '') + '"' + (mxchatContent.hasGSC ? ' data-sort="clicks"' : '') + '>Clicks' + (mxchatContent.hasGSC ? seodSortArrow('clicks') : ' <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>') + '</div>' + | |
| 1798 | - '<div class="mxch-seod-header-cell mxch-seod-header-impressions' + (!mxchatContent.hasGSC ? ' mxch-seod-header-locked' : '') + '"' + (mxchatContent.hasGSC ? ' data-sort="impressions"' : '') + '>Impr.' + (mxchatContent.hasGSC ? seodSortArrow('impressions') : ' <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>') + '</div>' + | |
| 1811 | + '<div class="mxch-seod-header-cell mxch-seod-header-clicks' + (!mxchatContent.hasGSC ? ' mxch-seod-header-locked' : '') + '"' + (gscSortable ? ' data-sort="clicks"' : '') + '>Clicks' + (gscSortable ? seodSortArrow('clicks') : '') + (!mxchatContent.hasGSC ? ' <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>' : '') + '</div>' + | |
| 1812 | + '<div class="mxch-seod-header-cell mxch-seod-header-impressions' + (!mxchatContent.hasGSC ? ' mxch-seod-header-locked' : '') + '"' + (gscSortable ? ' data-sort="impressions"' : '') + '>Impr.' + (gscSortable ? seodSortArrow('impressions') : '') + (!mxchatContent.hasGSC ? ' <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>' : '') + '</div>' + | |
| 1813 | + '<div class="mxch-seod-header-cell mxch-seod-header-position' + (!mxchatContent.hasGSC ? ' mxch-seod-header-locked' : '') + '" title="Average search position, last 28 days">Pos.' + (!mxchatContent.hasGSC ? ' <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>' : '') + '</div>' + | |
| 1799 | 1814 | '</div>' |
| 1800 | 1815 | ); |
| 1801 | 1816 | |
| 1817 | + if (gscUnlinked) { | |
| 1818 | + $table.append( | |
| 1819 | + '<div class="mxch-seod-gsc-hint">' + | |
| 1820 | + '<span class="mxch-seod-gsc-hint-dot"></span>' + | |
| 1821 | + '<span>Connect Google Search Console to fill the Clicks, Impressions and Position columns — ' + | |
| 1822 | + '<a href="#" class="mxch-seod-gsc-hint-link">open Settings</a></span>' + | |
| 1823 | + '</div>' | |
| 1824 | + ); | |
| 1825 | + } | |
| 1826 | + | |
| 1802 | 1827 | posts.forEach(function(p) { |
| 1803 | 1828 | var scoreHtml; |
| 1804 | 1829 | if (p.score !== null) { |
| 1805 | 1830 | var cls = p.score >= 80 ? 'mxch-seod-good' : p.score >= 50 ? 'mxch-seod-ok' : 'mxch-seod-bad'; |
| @@ -1823,8 +1848,9 @@ | ||
| 1823 | 1848 | '</div>' + |
| 1824 | 1849 | '<div class="mxch-seod-cell mxch-seod-cell-score">' + scoreHtml + '</div>' + |
| 1825 | 1850 | '<div class="mxch-seod-cell mxch-seod-cell-clicks' + (!mxchatContent.hasGSC ? ' mxch-seod-cell-locked' : '') + '" data-clicks="' + (p.clicks !== null ? p.clicks : 0) + '">' + (!mxchatContent.hasGSC ? '—' : (p.clicks !== null ? p.clicks : '—')) + '</div>' + |
| 1826 | 1851 | '<div class="mxch-seod-cell mxch-seod-cell-impressions' + (!mxchatContent.hasGSC ? ' mxch-seod-cell-locked' : '') + '" data-impressions="' + (p.impressions !== null ? p.impressions : 0) + '">' + (!mxchatContent.hasGSC ? '—' : (p.impressions !== null ? seodFormatNum(p.impressions) : '—')) + '</div>' + |
| 1852 | + '<div class="mxch-seod-cell mxch-seod-cell-position' + (!mxchatContent.hasGSC ? ' mxch-seod-cell-locked' : '') + '">—</div>' + | |
| 1827 | 1853 | '</div>' + |
| 1828 | 1854 | '</div>' |
| 1829 | 1855 | ); |
| 1830 | 1856 | }); |