// ==UserScript== // @icon https://www.thfou.com/img/favicon.png // @name 阿里巴巴商品关键词获取 // @namespace https://www.thfou.com/ // @version 1.1.1 // @description 自动获取阿里巴巴商品收录关键词并展示在详情页顶部 // @author 头号否 // @match *://detail.1688.com/offer/* // @require https://libs.baidu.com/jquery/1.10.2/jquery.min.js // @supportURL https://www.thfou.com/liuyan // @compatible Chrome // @compatible Firefox // @compatible Edge // @compatible Safari // @compatible Opera // @compatible UC // @license GPL-3.0-only // @downloadURL none // ==/UserScript== (function() { 'use strict'; setTimeout(function(){ var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML=".data-1688-keywords{width:100%;height:46px;margin-top:-10px;margin-bottom:5px;background-color:rgb(242, 242, 242);}.data-1688-keywords .item{width:auto;height:46px;float:left;margin:0px 5px 0px 15px;}.data-1688-keywords .item p{display:inline-block;width:auto;height:46px;line-height:46px;}.data-1688-keywords .item > span{display:inline-block;width:auto;height:46px;line-height:46px;color:rgb(255, 42, 0);}.data-content{width:100%;height:46px;margin-top:10px;margin-bottom:5px;background-color:rgb(242, 242, 242);}.data-1688-keywords .data-content > .btn{width:auto;height:26px;line-height:26px;background-color:rgb(30, 159, 255);color:rgb(242, 242, 242);float:right;cursor:pointer;margin:10px 15px 10px 0px;padding:0px 5px;border-radius:2px;}.thflogo{width:40px;height:40px;margin:3px auto;border-radius:4px;}.data-1688-logo{width:42px;height:100%;float:left;}.inject-1688-ctn{margin-top:0px!important;margin-bottom:0px!important;};"; document.getElementsByTagName('HEAD').item(0).appendChild(style); //插入框架 var addbg = document.createElement('div'); addbg.className = 'data-1688-keywords'; var getclass = document.querySelector('.region-horizontal'); addbg.innerHTML = '
'; getclass.parentNode.insertBefore(addbg, getclass); var addlogo = document.createElement('div'); addlogo.className = 'data-1688-logo'; var getbg = document.querySelector('.data-1688-keywords'); addlogo.innerHTML = '[ 头号代码 ]
'; $('.data-content').append(addbs); //获取登录ID var getloginid = document.createElement('div'); // 新增元素 getloginid.className = 'item'; getloginid.id = 'wp-loginid'; var datas = $('.ww-inline').attr('href'); var url = decodeURI(datas); var reg = /.*uid[\s\=]+([^\&]+)\&.*/; url = url.replace(reg, "$1"); var urla = '登录ID:
'; var urlb = ''; getloginid.innerHTML = urla + url + urlb; $('.data-content').append(getloginid); //获取关键词 var getkeywords = document.createElement('div'); // 新增元素 getkeywords.className = 'item'; getkeywords.id = 'offer-keywords'; var sc = document.getElementsByName("keywords")[0].content; var sca = '关键词:
'; var scb = ''; var scc = sc; getkeywords.innerHTML = sca + scc + scb; $('.data-content').append(getkeywords); //插入直播按钮 var addlive = document.createElement('div'); // 新增元素 addlive.className = 'btn'; addlive.id = 'wp-live'; var livea = 'https://cui.m.1688.com/weex/page/7150.html?spm=a261y.7663282.descBanner.1.42a4319e2l7OAw&__positionId__=live&__pageId__=7150&__weex__=true&loginId='; var liveb = decodeURI(url); var livec = ''; var livee = '进入直播间'; var livef = ''; var liveg = encodeURI(liveb); addlive.innerHTML = livee; $('.data-content').append(addlive); document.getElementById('wp-live').innerHTML = livec + livea + liveg + lived + livee + livef; },1500); // 延迟1.5秒 })();