Как удалить дополнительный совпадающий код тега из кода jQuery - PullRequest
0 голосов
/ 01 ноября 2019

Пожалуйста, помогите мне.

Я создал скрипт jQuery, описанный ниже.

Проблема, с которой я сталкиваюсь, заключается в том, что я не знаю, как удалить эти дополнительные теги из кода JavaScript.

Может кто-нибудь помочь мне с удалением тегов, таких как _0xeb6ex2

Как мне удалить эти теги из JavaScript, не затрагивая код JavaScript?

Я застрял, чтобы удалить и заменить должным образом

$(function() {
    $('')['each'](function() {
        var _0xeb6ex2 = $(this)['find']('.LinkList ul > li')['children']('a'),
            _0xeb6ex3 = _0xeb6ex2['length'];
        for (var _0xeb6ex4 = 0; _0xeb6ex4 < _0xeb6ex3; _0xeb6ex4++) {
            var _0xeb6ex5 = _0xeb6ex2['eq'](_0xeb6ex4),
                _0xeb6ex6 = _0xeb6ex5['text']();
            if (_0xeb6ex6['charAt'](0) !== '_') {
                var _0xeb6ex7 = _0xeb6ex2['eq'](_0xeb6ex4 + 1),
                    _0xeb6ex8 = _0xeb6ex7['text']();
                if (_0xeb6ex8['charAt'](0) === '_') {
                    var _0xeb6ex9 = _0xeb6ex5['parent']();
                    _0xeb6ex9['append']('')
                }
            };
            if (_0xeb6ex6['charAt'](0) === '_') {
                _0xeb6ex5['text'](_0xeb6ex6['replace']('_', ''));
                _0xeb6ex5['parent']()['appendTo'](_0xeb6ex9['children'](''))
            }
        };
        for (var _0xeb6ex4 = 0; _0xeb6ex4 < _0xeb6ex3; _0xeb6ex4++) {
            var _0xeb6exa = _0xeb6ex2['eq'](_0xeb6ex4),
                _0xeb6exb = _0xeb6exa['text']();
            if (_0xeb6exb['charAt'](0) !== '_') {
                var _0xeb6exc = _0xeb6ex2['eq'](_0xeb6ex4 + 1),
                    _0xeb6exd = _0xeb6exc['text']();
                if (_0xeb6exd['charAt'](0) === '_') {
                    var _0xeb6exe = _0xeb6exa['parent']();
                    _0xeb6exe['append']('')
                }
            };
            if (_0xeb6exb['charAt'](0) === '_') {
                _0xeb6exa['text'](_0xeb6exb['replace']('_', ''));
                _0xeb6exa['parent']()['appendTo'](_0xeb6exe['children'](''))
            }
        };
        $('')['parent']('li')['addClass']('has-sub');
        $('')['addClass']('')
    });
    $('')['clone']()['appendTo']('');
    $('')['append']('');
    $('')['each'](function() {
        var _0xeb6exf = $(this),
            _0xeb6ex10 = _0xeb6exf['attr']('href')['trim'](),
            _0xeb6ex11 = _0xeb6ex10['toLowerCase'](),
            _0xeb6ex12 = _0xeb6ex10['split']('/'),
            _0xeb6ex13 = _0xeb6ex12[0];
        if (_0xeb6ex11['match']('')) {
            _0xeb6exf['attr']('href', '/search/label/' + _0xeb6ex13 + '?&max-results=' + postPerPage)
        }
    });
    $('.slide-menu-toggle')['on']('click', function() {
        $('body')['toggleClass']('nav-active')
    });
    $('.mobile-menu ul li .submenu-toggle')['on']('click', function(_0xeb6exf) {
        if ($(this)['parent']()['hasClass']('has-sub')) {
            _0xeb6exf['preventDefault']();
            if (!$(this)['parent']()['hasClass']('show')) {
                $(this)['parent']()['addClass']('show')['children']('.m-sub')['slideToggle'](170)
            } else {
                $(this)['parent']()['removeClass']('show')['find']('> .m-sub')['slideToggle'](170)
            }
        }
    });
    $('.Label a, a.b-label')['attr']('href', function(_0xeb6exf, _0xeb6ex14) {
        return _0xeb6ex14['replace'](_0xeb6ex14, _0xeb6ex14 + '?&max-results=' + postPerPage)
    });
    $('.avatar-image-container img')['attr']('src', function(_0xeb6exf, _0xeb6ex4) {
        _0xeb6ex4 = _0xeb6ex4['replace']('/s35-c/', '/s45-c/');
        _0xeb6ex4 = _0xeb6ex4['replace']('//img1.blogblog.com/img/blank.gif', '//4.bp.blogspot.com/-uCjYgVFIh70/VuOLn-mL7PI/AAAAAAAADUs/Kcu9wJbv790hIo83rI_s7lLW3zkLY01EA/s55-r/avatar.png');
        return _0xeb6ex4
    });
    $('.author-description a')['each'](function() {
        $(this)['attr']('target', '_blank')
    });
    $('.post-nav')['each'](function() {
        var _0xeb6ex15 = $('a.prev-post-link')['attr']('href'),
            _0xeb6ex16 = $('a.next-post-link')['attr']('href');
        $['ajax']({
            url: _0xeb6ex15,
            type: 'get',
            success: function(_0xeb6ex17) {
                var _0xeb6ex18 = $(_0xeb6ex17)['find']('.blog-post h1.post-title')['text']();
                $('.post-prev a .post-nav-inner p')['text'](_0xeb6ex18)
            }
        });
        $['ajax']({
            url: _0xeb6ex16,
            type: 'get',
            success: function(_0xeb6ex19) {
                var _0xeb6ex18 = $(_0xeb6ex19)['find']('.blog-post h1.post-title')['text']();
                $('.post-next a .post-nav-inner p')['text'](_0xeb6ex18)
            }
        })
    });
    $('.post-body strike')['each'](function() {
        var _0xeb6exf = $(this),
            _0xeb6ex11 = _0xeb6exf['text']();
        if (_0xeb6ex11['match']('left-sidebar')) {
            _0xeb6exf['replaceWith']('<style>.item #main-wrapper{float:right}.item #sidebar-wrapper{float:left}</style>')
        };
        if (_0xeb6ex11['match']('right-sidebar')) {
            _0xeb6exf['replaceWith']('<style>.item #main-wrapper{float:left}.item #sidebar-wrapper{float:right}</style>')
        };
        if (_0xeb6ex11['match']('full-width')) {
            _0xeb6exf['replaceWith']('<style>.item #main-wrapper{width:100%}.item #sidebar-wrapper{display:none}</style>')
        }
    });
    $('#main-wrapper, #sidebar-wrapper')['each'](function() {
        if (fixedSidebar == true) {
            $(this)['theiaStickySidebar']({
                additionalMarginTop: 30,
                additionalMarginBottom: 30
            })
        }
    });
    $('.back-top')['each'](function() {
        var _0xeb6exf = $(this);
        $(window)['on']('scroll', function() {
            $(this)['scrollTop']() >= 100 ? _0xeb6exf['fadeIn'](250) : _0xeb6exf['fadeOut'](250)
        }), _0xeb6exf['click'](function() {
            $('html, body')['animate']({
                scrollTop: 0
            }, 500)
        })
    });
    $('#main-menu #main-menu-nav li')['each'](function() {
        var _0xeb6ex1a = $(this),
            _0xeb6ex10 = _0xeb6ex1a['find']('a')['attr']('href')['trim'](),
            _0xeb6exf = _0xeb6ex1a,
            _0xeb6ex11 = _0xeb6ex10['toLowerCase'](),
            _0xeb6ex12 = _0xeb6ex10['split']('/'),
            _0xeb6ex13 = _0xeb6ex12[0];
        _0xeb6ex30(_0xeb6exf, _0xeb6ex11, 4, _0xeb6ex13)
    });
    $('#hot-section .widget-content')['each'](function() {
        var _0xeb6exf = $(this),
            _0xeb6ex10 = _0xeb6exf['text']()['trim'](),
            _0xeb6ex11 = _0xeb6ex10['toLowerCase'](),
            _0xeb6ex12 = _0xeb6ex10['split']('/'),
            _0xeb6ex13 = _0xeb6ex12[0];
        _0xeb6ex30(_0xeb6exf, _0xeb6ex11, 3, _0xeb6ex13)
    });
    $('#feat-section .widget-content')['each'](function() {
        var _0xeb6exf = $(this),
            _0xeb6ex10 = _0xeb6exf['text']()['trim'](),
            _0xeb6ex11 = _0xeb6ex10['toLowerCase'](),
            _0xeb6ex12 = _0xeb6ex10['split']('/'),
            _0xeb6ex1b = _0xeb6ex12[0],
            _0xeb6ex13 = _0xeb6ex12[1];
        _0xeb6ex30(_0xeb6exf, _0xeb6ex11, _0xeb6ex1b, _0xeb6ex13)
    });
    $('.common-widget .widget-content')['each'](function() {
        var _0xeb6exf = $(this),
            _0xeb6ex10 = _0xeb6exf['text']()['trim'](),
            _0xeb6ex11 = _0xeb6ex10['toLowerCase'](),
            _0xeb6ex12 = _0xeb6ex10['split']('/'),
            _0xeb6ex1b = _0xeb6ex12[0],
            _0xeb6ex13 = _0xeb6ex12[1];
        _0xeb6ex30(_0xeb6exf, _0xeb6ex11, _0xeb6ex1b, _0xeb6ex13)
    });
    $('.related-ready')['each'](function() {
        var _0xeb6exf = $(this),
            _0xeb6ex13 = _0xeb6exf['find']('.related-tag')['data']('label');
        _0xeb6ex30(_0xeb6exf, 'related', 3, _0xeb6ex13)
    });

    function _0xeb6ex1c(_0xeb6ex1d, _0xeb6ex4) {
        for (var _0xeb6ex1e = 0; _0xeb6ex1e < _0xeb6ex1d[_0xeb6ex4]['link']['length']; _0xeb6ex1e++) {
            if (_0xeb6ex1d[_0xeb6ex4]['link'][_0xeb6ex1e]['rel'] == 'alternate') {
                var _0xeb6ex1f = _0xeb6ex1d[_0xeb6ex4]['link'][_0xeb6ex1e]['href'];
                break
            }
        };
        return _0xeb6ex1f
    }

    function _0xeb6ex20(_0xeb6ex1d, _0xeb6ex4, _0xeb6ex1f) {
        var _0xeb6ex21 = _0xeb6ex1d[_0xeb6ex4]['title']['$t'],
            _0xeb6ex22 = '<a href="' + _0xeb6ex1f + '">' + _0xeb6ex21 + '</a>';
        return _0xeb6ex22
    }

    function _0xeb6ex23(_0xeb6ex1d, _0xeb6ex4) {
        var _0xeb6ex24 = _0xeb6ex1d[_0xeb6ex4]['published']['$t'],
            _0xeb6ex25 = _0xeb6ex24['substring'](0, 4),
            _0xeb6ex26 = _0xeb6ex24['substring'](5, 7),
            _0xeb6ex27 = _0xeb6ex24['substring'](8, 10),
            _0xeb6ex28 = monthFormat[parseInt(_0xeb6ex26, 10) - 1] + ' ' + _0xeb6ex27 + ', ' + _0xeb6ex25,
            _0xeb6ex22 = '<span class="post-date">' + _0xeb6ex28 + '</span>';
        return _0xeb6ex22
    }

    function _0xeb6ex29(_0xeb6ex1d, _0xeb6ex4) {
        var _0xeb6ex21 = _0xeb6ex1d[_0xeb6ex4]['title']['$t'],
            _0xeb6ex2a = _0xeb6ex1d[_0xeb6ex4]['content']['$t'],
            _0xeb6ex2b = $('<div>')['html'](_0xeb6ex2a);
        if ('media$thumbnail' in _0xeb6ex1d[_0xeb6ex4]) {
            var _0xeb6ex2c = _0xeb6ex1d[_0xeb6ex4]['media$thumbnail']['url'],
                _0xeb6ex2d = _0xeb6ex2c['replace']('/s72-c', '/w680');
            if (_0xeb6ex2a['indexOf']('youtube.com/embed') > -1) {
                _0xeb6ex2d = _0xeb6ex2c['replace']('/default.', '/hqdefault.')
            }
        } else {
            if (_0xeb6ex2a['indexOf']('<img') > -1) {
                _0xeb6ex2d = _0xeb6ex2b['find']('img:first')['attr']('src')
            } else {
                _0xeb6ex2d = noThumbnail
            }
        };
        var _0xeb6ex22 = '<img class="post-thumb" alt="' + _0xeb6ex21 + '" src="' + _0xeb6ex2d + '"/>';
        return _0xeb6ex22
    }

    function _0xeb6ex2e(_0xeb6ex1d, _0xeb6ex4) {
        if (_0xeb6ex1d[_0xeb6ex4]['category'] != undefined) {
            var _0xeb6ex2f = _0xeb6ex1d[_0xeb6ex4]['category'][0]['term'],
                _0xeb6ex22 = '<span class="post-tag">' + _0xeb6ex2f + '</span>'
        } else {
            _0xeb6ex22 = ''
        };
        return _0xeb6ex22
    }

    function _0xeb6ex30(_0xeb6exf, _0xeb6ex11, _0xeb6ex1b, _0xeb6ex13) {
        if (_0xeb6ex11['match']('mega-menu') || _0xeb6ex11['match']('hot-posts') || _0xeb6ex11['match']('featured') || _0xeb6ex11['match']('post-list') || _0xeb6ex11['match']('related')) {
            var _0xeb6ex31 = '';
            if (_0xeb6ex13 == 'recent') {
                _0xeb6ex31 = '/feeds/posts/default?alt=json-in-script&max-results=' + _0xeb6ex1b
            } else {
                if (_0xeb6ex13 == 'random') {
                    var _0xeb6ex32 = Math['floor'](Math['random']() * _0xeb6ex1b) + 1;
                    _0xeb6ex31 = '/feeds/posts/default?max-results=' + _0xeb6ex1b + '&start-index=' + _0xeb6ex32 + '&alt=json-in-script'
                } else {
                    _0xeb6ex31 = '/feeds/posts/default/-/' + _0xeb6ex13 + '?alt=json-in-script&max-results=' + _0xeb6ex1b
                }
            };
            $['ajax']({
                url: _0xeb6ex31,
                type: 'get',
                dataType: 'jsonp',
                beforeSend: function() {
                    if (_0xeb6ex11['match']('hot-posts')) {
                        _0xeb6exf['html']('')['parent']()['addClass']('show-hot')
                    }
                },
                success: function(_0xeb6ex33) {
                    if (_0xeb6ex11['match']('mega-menu')) {
                        var _0xeb6ex34 = '<ul class="mega-menu-inner">'
                    } else {
                        if (_0xeb6ex11['match']('hot-posts')) {
                            var _0xeb6ex34 = '<ul class="hot-posts">'
                        } else {
                            if (_0xeb6ex11['match']('featured')) {
                                var _0xeb6ex34 = '<ul class="featured-posts">'
                            } else {
                                if (_0xeb6ex11['match']('post-list')) {
                                    var _0xeb6ex34 = '<ul class="custom-widget">'
                                } else {
                                    if (_0xeb6ex11['match']('related')) {
                                        var _0xeb6ex34 = '<ul class="related-posts">'
                                    }
                                }
                            }
                        }
                    };
                    var _0xeb6ex35 = _0xeb6ex33['feed']['entry'];
                    if (_0xeb6ex35 != undefined) {
                        for (var _0xeb6ex4 = 0, _0xeb6ex1d = _0xeb6ex35; _0xeb6ex4 < _0xeb6ex1d['length']; _0xeb6ex4++) {
                            var _0xeb6ex1f = _0xeb6ex1c(_0xeb6ex1d, _0xeb6ex4),
                                _0xeb6ex18 = _0xeb6ex20(_0xeb6ex1d, _0xeb6ex4, _0xeb6ex1f),
                                _0xeb6ex36 = _0xeb6ex29(_0xeb6ex1d, _0xeb6ex4),
                                _0xeb6ex2f = _0xeb6ex2e(_0xeb6ex1d, _0xeb6ex4),
                                _0xeb6ex37 = _0xeb6ex23(_0xeb6ex1d, _0xeb6ex4);
                            var _0xeb6ex38 = '';
                            if (_0xeb6ex11['match']('mega-menu')) {
                                _0xeb6ex38 += '<div class="mega-item item-' + _0xeb6ex4 + '"><div class="mega-content"><div class="post-image-wrap"><a class="post-image-link" href="' + _0xeb6ex1f + '">' + _0xeb6ex36 + '</a></div><h2 class="post-title">' + _0xeb6ex18 + '</h2><div class="post-meta">' + _0xeb6ex2f + '<i>-</i>' + _0xeb6ex37 + '</div></div></div>'
                            } else {
                                if (_0xeb6ex11['match']('hot-posts')) {
                                    _0xeb6ex38 += '<li class="hot-item item-' + _0xeb6ex4 + '"><div class="hot-item-inner"><a class="post-image-link" href="' + _0xeb6ex1f + '">' + _0xeb6ex36 + '</a><div class="post-info"><h2 class="post-title">' + _0xeb6ex18 + '</h2><div class="post-meta">' + _0xeb6ex2f + '<i>-</i>' + _0xeb6ex37 + '</div></div></div></li>'
                                } else {
                                    if (_0xeb6ex11['match']('featured')) {
                                        _0xeb6ex38 += '<li class="feat-item item-' + _0xeb6ex4 + '"><div class="post-image-wrap"><a class="post-image-link" href="' + _0xeb6ex1f + '">' + _0xeb6ex36 + '</a></div><div class="post-info"><h2 class="post-title">' + _0xeb6ex18 + '</h2><div class="post-meta">' + _0xeb6ex2f + '<i>-</i>' + _0xeb6ex37 + '</div></div></li>'
                                    } else {
                                        if (_0xeb6ex11['match']('post-list')) {
                                            _0xeb6ex38 += '<li class="item-' + _0xeb6ex4 + '"><a class="post-image-link" href="' + _0xeb6ex1f + '">' + _0xeb6ex36 + '</a><div class="post-info"><h2 class="post-title">' + _0xeb6ex18 + '</h2><div class="post-meta">' + _0xeb6ex37 + '</div></div></div></li>'
                                        } else {
                                            if (_0xeb6ex11['match']('related')) {
                                                _0xeb6ex38 += '<li class="related-item item-' + _0xeb6ex4 + '"><div class="post-image-wrap"><a class="post-image-link" href="' + _0xeb6ex1f + '">' + _0xeb6ex36 + '</a></div><h2 class="post-title">' + _0xeb6ex18 + '</h2><div class="post-meta">' + _0xeb6ex2f + '<i>-</i>' + _0xeb6ex37 + '</div></li>'
                                            }
                                        }
                                    }
                                }
                            };
                            _0xeb6ex34 += _0xeb6ex38
                        };
                        _0xeb6ex34 += '</ul>'
                    } else {
                        _0xeb6ex34 = '<ul class="no-posts">Error: No Posts Found <i class="fa fa-frown"/></ul>'
                    };
                    if (_0xeb6ex11['match']('mega-menu')) {
                        _0xeb6exf['addClass']('has-sub mega-menu')['append'](_0xeb6ex34);
                        _0xeb6exf['find']('a:first')['attr']('href', function(_0xeb6exf, _0xeb6ex14) {
                            if (_0xeb6ex13 == 'recent' || _0xeb6ex13 == 'random') {
                                _0xeb6ex14 = _0xeb6ex14['replace'](_0xeb6ex14, '/search/?&max-results=' + postPerPage)
                            } else {
                                _0xeb6ex14 = _0xeb6ex14['replace'](_0xeb6ex14, '/search/label/' + _0xeb6ex13 + '?&max-results=' + postPerPage)
                            };
                            return _0xeb6ex14
                        })
                    } else {
                        if (_0xeb6ex11['match']('hot-posts')) {
                            _0xeb6exf['html'](_0xeb6ex34)['parent']()['addClass']('show-hot')
                        } else {
                            if (_0xeb6ex11['match']('featured')) {
                                if (_0xeb6ex13 == 'recent' || _0xeb6ex13 == 'random') {
                                    var _0xeb6ex39 = '/search'
                                } else {
                                    _0xeb6ex39 = '/search/label/' + _0xeb6ex13 + ''
                                };
                                _0xeb6exf['parent']()['find']('.widget-title')['addClass']('title-wrap')['append']('<a class="show-more" href="' + _0xeb6ex39 + '?&max-results=' + postPerPage + '">' + messages['showMore'] + '</a>');
                                _0xeb6exf['html'](_0xeb6ex34)['parent']()['addClass']('show-featured')
                            } else {
                                _0xeb6exf['html'](_0xeb6ex34)
                            }
                        }
                    }
                }
            })
        }
    }
    $('.blog-post-comments')['each'](function() {
        var _0xeb6ex3a = commentsSystem,
            _0xeb6ex3b = disqus_blogger_current_url,
            _0xeb6ex3c = '<div id="disqus_thread"/>',
            _0xeb6ex3d = $(location)['attr']('href'),
            _0xeb6ex3e = '<div class="fb-comments" data-width="100%" data-href="' + _0xeb6ex3d + '" data-numposts="5"></div>',
            _0xeb6ex3f = 'comments-system-' + _0xeb6ex3a;
        if (_0xeb6ex3a == 'blogger') {
            $(this)['addClass'](_0xeb6ex3f)['show']()
        } else {
            if (_0xeb6ex3a == 'disqus') {
                (function() {
                    var _0xeb6ex40 = document['createElement']('script');
                    _0xeb6ex40['type'] = 'text/javascript';
                    _0xeb6ex40['async'] = true;
                    _0xeb6ex40['src'] = '//' + disqusShortname + '.disqus.com/embed.js';
                    (document['getElementsByTagName']('head')[0] || document['getElementsByTagName']('body')[0])['appendChild'](_0xeb6ex40)
                })();
                $('#comments')['remove']();
                $(this)['append'](_0xeb6ex3c)['addClass'](_0xeb6ex3f)['show']()
            } else {
                if (_0xeb6ex3a == 'facebook') {
                    $('#comments')['remove']();
                    $(this)['append'](_0xeb6ex3e)['addClass'](_0xeb6ex3f)['show']()
                } else {
                    if (_0xeb6ex3a == 'hide') {
                        $(this)['hide']()
                    } else {
                        $(this)['addClass']('comments-system-default')['show']()
                    }
                }
            }
        }
    })
})
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...