PageSourceSearch

https://big-voice.co.uk/wp-content/plugins/getautoseo-ai-content-publisher/assets/js/frontend.js?ver=1.3.115

js big-voice.co.uk collected 2026-10-08 23:00:21 UTC 3,358 bytes, 105 lines download raw bytes

1/**
2 * AutoSEO WordPress Plugin - Frontend JavaScript
3 * Version: 1.3.112
4 */
5
6(function($) {
7    'use strict';
8
9    function normalizeCopyText(html) {
10        var text = $('<div>').html(html).text() || '';
11        return text.replace(/\s+/g, ' ').trim();
12    }
13
14    function isDuplicateCopy(htmlA, htmlB) {
15        var a = normalizeCopyText(htmlA);
16        var b = normalizeCopyText(htmlB);
17        if (a.length < 80 || b.length < 80) {
18            return false;
19        }
20        if (a === b) {
21            return true;
22        }
23        if (a.length < 160 || b.length < 160) {
24            return false;
25        }
26        var prefixA = a.substring(0, 160).toLowerCase();
27        var prefixB = b.substring(0, 160).toLowerCase();
28        if (b.toLowerCase().indexOf(prefixA) !== 0 && a.toLowerCase().indexOf(prefixB) !== 0) {
29            return false;
30        }
31        return Math.min(a.length, b.length) / Math.max(a.length, b.length) >= 0.85;
32    }
33
34    /**
35     * DesignThemes LMS (and similar themes) can print the full article in
36     * .first-post-div and again in each .all-post-div page. The server-side
37     * output buffer removes those copies; this is a fallback when that
38     * buffer does not run (cached HTML from before the plugin update).
39     */
40    function collapseRepeatedThemeCopies() {
41        var $first = $('.autoseo .first-post-div').first();
42        var $copies = $('.autoseo .all-post-div');
43        if (!$copies.length) {
44            return;
45        }
46
47        if ($first.length && $copies.length) {
48            var firstHtml = $first.html() || '';
49            $copies.each(function() {
50                if (isDuplicateCopy(firstHtml, $(this).html() || '')) {
51                    $(this).remove();
52                }
53            });
54            return;
55        }
56
57        var $remaining = $('.autoseo .all-post-div');
58        if ($remaining.length < 2) {
59            return;
60        }
61        var keepHtml = $remaining.first().html() || '';
62        $remaining.slice(1).each(function() {
63            if (isDuplicateCopy(keepHtml, $(this).html() || '')) {
64                $(this).remove();
65            }
66        });
67    }
68
69    $(document).ready(function() {
70        collapseRepeatedThemeCopies();
71
72        // Lazy load infographic images if needed
73        $('.autoseo-infographic-container img').each(function() {
74            const $img = $(this);
75            if ($img.attr('data-src')) {
76                $img.attr('src', $img.attr('data-src'));
77                $img.removeAttr('data-src');
78            }
79        });
80
81        // Add smooth scroll to anchor links within AutoSEO articles
82        // Uses getElementById instead of jQuery selector to handle Unicode/URL-encoded IDs
83        $('.autoseo-article a[href^="#"]').on('click', function(e) {
84            var hash = this.getAttribute('href');
85            if (!hash || hash === '#') return;
86
87            var decoded;
88            try {
89                decoded = decodeURIComponent(hash.substring(1));
90            } catch (ex) {
91                decoded = hash.substring(1);
92            }
93
94            var el = document.getElementById(decoded);
95            if (el) {
96                e.preventDefault();
97                $('html, body').stop().animate({
98                    scrollTop: $(el).offset().top - 100
99                }, 500);
100            }
101        });
102    });
103
104})(jQuery);
105

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.