Greasy Fork

1688获取缩略图

获取1688产品大缩略图

目前为 2016-12-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         1688获取缩略图
// @namespace    http://detail.1688.com/offer
// @version      0.1
// @description  获取1688产品大缩略图
// @author       Richard He
// @match        https://detail.1688.com/offer/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    //获取原图地址
    var count = document.getElementsByClassName('tab-trigger').length;
    for(var i=0;i<count;i++)
    {
        var thumb1 = document.getElementsByClassName('tab-trigger')[i].childNodes[1].childNodes[1].childNodes[1];
        var arr = thumb1.src.split(".");
        arr.splice(-2,1);
        var addr = arr.join(".");
        
    //生成按钮
        var buttonR = document.createElement('a');
        buttonR.href = addr;
        buttonR.target = '_blank';
        buttonR.innerHTML = '打开第'+(i+1)+'张图原图';
        buttonR.style.position = 'absolute';
        buttonR.style.left = '200px';
        buttonR.style.top = 300+i*40+"px";
        buttonR.style.border='1px solid #000';
        buttonR.style.padding = '6px 6px 6px 6px';
        buttonR.style.color = '#000';
        document.getElementById('dt-tab').insertBefore(buttonR,document.get
        document.body.appendChild(buttonR);
    }
})();