Greasy Fork is available in English.
自动获取阿里巴巴商品收录关键词并展示在详情页顶部
当前为
// ==UserScript==
// @icon https://www.thfou.com/wp-content/uploads/2019/04/cropped-thfou1-32x32.png
// @name 阿里巴巴商品关键词获取(内测)
// @namespace https://www.thfou.com/
// @version 1.0.0
// @description 自动获取阿里巴巴商品收录关键词并展示在详情页顶部
// @author 头号否
// @match *://detail.1688.com/offer/*
// @require https://libs.baidu.com/jquery/1.10.2/jquery.min.js
// @supportURL https://www.thfou.com/message#respond
// @contributionURL https://www.thfou.com/
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(function(){
//获取关键词
var getkeywords = document.createElement('div'); // 新增元素
getkeywords.className = 'item';
getkeywords.id = 'offer-keywords';
var data = document.querySelector('#sell-sku-analyze'); // 获取元素
var sc = document.getElementsByName("keywords")[0].content;
var sca = '<p>关键词:</p><span>';
var scb = '</span>';
var scc = sc;
getkeywords.innerHTML = sca + scc + scb;
data.parentNode.insertBefore(getkeywords, data); // 在这个元素前面增加上去
//获取登录ID
var getloginid = document.createElement('div'); // 新增元素
getloginid.className = 'item';
getloginid.id = 'wp-loginid';
var id = document.querySelector('#offer-cate'); // 获取元素
var datas = $('.ww-inline').attr('href');
var url = decodeURI(datas);
var reg = /.*uid[\s\=]+([^\&]+)\&.*/;
url = url.replace(reg, "$1");
var urla = '<p>登录ID:</p><span>';
var urlb = '</span>';
getloginid.innerHTML = urla + url + urlb;
id.parentNode.insertBefore(getloginid, id); // 在这个元素前面增加上去
//插入直播按钮
var addlive = document.createElement('div'); // 新增元素
addlive.className = 'btn';
addlive.id = 'wp-live';
var live = document.querySelector('#sell-sku-analyze'); // 获取元素
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 = '<a style="color:#fff" target="_blank" href="';
var lived = '">';
var livee = '进入直播间';
var livef = '</a>';
var liveg = encodeURI(liveb);
addlive.innerHTML = livee;
live.parentNode.insertBefore(addlive, live); // 在这个元素前面增加上去
document.getElementById('wp-live').innerHTML = livec + livea + liveg + lived + livee + livef;
},1000); // 延迟1秒
})();