购物党比价脚本 TENG

仅在html标签中插入购物党官方js脚本,不含其他个人广告

目前为 2021-04-13 提交的版本。查看 最新版本

        // ==UserScript==
        // @name         购物党比价脚本 TENG
        // @namespace    none
        // @version      1.16beta
        // @description  仅在html标签中插入购物党官方js脚本,不含其他个人广告
        // @author       teng
        // @note         更新支持京东苏宁等站点
        // @include      http*://item.taobao.com/*
        // @include      http*://s.taobao.com/*
        // @include      http*://detail.tmall.com/item.htm*
        // @include      http*://detail.liangxinyao.com/item.htm*
        // @include      http*://chaoshi.detail.tmall.com/item.htm*
        // @include      http*://item.jd.com/*
        // @include      https://item.jd.hk/*
        // @include      https://detail.tmall.hk/*
        // @include      https://*.suning.com/*
        // @connect      gwdang.com
        // @run-at       document-end
        // @license      GPL-3.0-only
        // ==/UserScript==
                (function () {
            function addStyle(css) {
                var pi = document.createProcessingInstruction(
                    'xml-stylesheet',
                    'type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"'
                );
                return document.insertBefore(pi, document.documentElement);
            }

            function addScript(src) {
                let node = document.createElement("script");
                node.src = src;
                node.charset = "UTF-8";
                document.head.appendChild(node);
            }

            function initGWD() {
                let extName = "gwdv1.js";
                var hideStyle = "";
                if (location.host == "jd.com") {
                    extName = "gwdv2.js";
                    hideStyle = ".gwd-minibar-bg, #favor_box{display:none !important;}" +
                        "#gwdang_main > a.gwd-topbar-logo, #gwdang_main > div.gwd-topbar-right{display:none !important;}";
                } else {
                    //隐藏购物党顶部栏
                    hideStyle = "div#gwdang_main {display: none!important}";
                    //"#gwdang-main>div.logo, #gwdang-feed-close, #gwdang-history, #coupon_box, #bjd_yifenqian_detail{display:none !important}" +
                    //"#favor_box{display:none !important;}#tb-amount .tb-count{font-weight:bold;margin:0 5px;}"
                }
                addScript("https://cdn.gwdang.com/js/gwdang-notifier.js");
                //官方js文件备份https://browser.gwdang.com/get.js?f=/js/gwdang_extension.js
                //官方插件介绍页https://www.gwdang.com/app/extension?page=question
                addStyle(hideStyle);
                //去掉gwdang顶部空白
            }
            initGWD();
           window.onload=
                function(){
                    document.body.style.paddingTop = 0;}
        })()