// ==UserScript==
// @name 京东到家商家运营 - 活动页优化
// @namespace http://tampermonkey.net/
// @version 0.3
// @description try to take over the world!
// @author You
// @match http://*.jddj.com/*
// @grant none
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
// 添加优化配置按钮
var addBtn1 = '
' +
' ' +
'' +
'' +
'
'
$('.resTabNav').append(addBtn1);
$('#wei_open').show();
$('#wei_close').hide();
$('#wei_cutout').hide();
// 打开
$('#wei_open').on('click', function () {
$('#wei_open').hide();
$('#wei_close').show();
$('#wei_cutout').show();
// 展开样式
$($($($('.container-fluid')[1]).children()[0]).children()[1]).css({
'position': 'fixed',
'right': '0',
'top': '0',
'height': '100%',
'box-shadow': '0 0 5px #000',
'background-color': '#fff',
'z-index': '999',
});
$('#resListTab').css({'height': '800px', 'overflow': 'auto'});
$('.condition-panel').css({'max-height': '800px'});
// $('.orgRes').css({'max-height': '720px!important'});
$('.orgBtnGroupNal').children().removeClass('orgRes');
$('.orgStoreDiv').css({'max-height': 'max-content'});
$('.orgGroup').css({'border-bottom': '5px solid #428bca'});
$('.orgGroup:last-child').css({'margin-bottom': '100px'});
$('.saveBtnDiv').css({'position': 'absolute', 'bottom': '0', 'z-index': '1000'});
$('#resListTab').scroll(function() {
$('.orgGroup').each(function (i) {
if ($(this).offset().top < (50 + i * 32)) {
$(this).find('div:first').css({
'position': 'absolute',
'top': i * 32,
'width': '100%',
'left': '0',
'padding': '5px 5px 0 5px',
'border-bottom': '1px solid #c5d0dc',
'background-color': '#fff',
})
} else {
$(this).find('div:first').css({
'position': '',
'top': '',
'width': '',
'left': '',
'padding': '',
'border-bottom': '',
'background-color': '',
})
}
})
});
// 表格第一列缩小
$('.orgStoreDiv').find('thead tr th:first').css({'width': '70px'})
// $('.orgStoreDiv').find('tbody img').css({'width': '40px'})
// $('.orgStoreDiv').find('tbody tr td:nth-child(2)').css({
$(":input[name='skuDesc']").css({
'height': '24px',
'font-size': '12px',
'color': '#03A9F4',
});
$(":input[name='skuTopDesc']").css({
'height': '24px',
'font-size': '12px',
'color': '#03A9F4',
});
$(":input[name='skuName']").css({
'height': '24px',
'font-size': '12px',
'color': '#03A9F4',
});
// 添加遮罩
var mask = '';
$($('.container-fluid')[1]).append(mask);
// 遮罩点击事件 - 关闭遮罩/恢复配置
$('#awei_mask, #wei_close').on('click', function () {
$('#wei_open').show();
$('#wei_close').hide();
$('#wei_cutout').hide();
$($($($('.container-fluid')[1]).children()[0]).children()[1]).css({
'position': 'initial',
'right': '0px',
'top': '0px',
'height': 'auto',
'box-shadow': 'none',
'background-color': 'rgba(0,0,0,0)',
'z-index': 'initial',
});
$('#awei_mask').remove();
$('#resListTab').css({'height': '', 'overflow': ''});
$('.condition-panel').css({'max-height': ''});
// $('.orgRes').css({'max-height': ''});
$('.orgBtnGroupNal').children().addClass('orgRes');
$('.orgStoreDiv').css({'max-height': ''});
$('.orgGroup').css({'border-bottom': ''});
$('.orgGroup:last-child').css({'margin-bottom': ''});
});
});
var CutoutTime;
var Cutout = function (dom, i) {
setTimeout(() => {
console.log(dom, i);
$(dom).click();
CutoutTime && clearInterval(CutoutTime);
CutoutTime = setInterval(() => {
if ($('.cutoutModal').css('display') !== 'none') {
$('.cutoutModalOk').click();
console.log(i + 1 + '组已抠图');
CutoutTime && clearInterval(CutoutTime);
}
}, 100)
}, i * 5000)
}
$('#wei_cutout').on('click', function () {
$('.cutoutShowBtn').each(function (i) {
Cutout(this, i);
})
});
})();