// ==UserScript==
// @name 拼多多跨境(Temu)弹窗屏蔽
// @version 1.0
// @description 用于屏蔽拼多多跨境卖家平台的弹窗-jquery重构.
// @author linying
// @match *://kuajing.pinduoduo.com/*
// @match *://seller.kuajingmaihuo.com/*
// @match *://kuajingboss.com/*
// @match *://agentseller.temu.com/*
// @exclude */login*
// @exclude */settle/site-main*
// @exclude */questionnaire?surveyId=*
// @exclude */settle/seller-login?redirectUrl=*
// @exclude */agentseller*.temu.com/main/authentication?redirectUrl=*
// @exclude */agentseller*.temu.com/mmsos/online-shipping-result.html*
// @icon https://gitlab.com/linying23333/green-service-center-temu-or-pinduoduokuajing-2024/raw/main/icon.svg
// @supportURL https://gitlab.com/linying23333/green-service-center-temu-or-pinduoduokuajing-2024
// @homepage https://github.com/linying2333
// @require https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js
// @run-at document-idle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM.setValue
// @grant GM.getValue
// @grant GM.deleteValue
// @grant GM_registerMenuCommand
// ==/UserScript==
// @icon 来自 https://www.iconfont.cn/ 如果侵犯您的权利请与我沟通
// @note 更新日志&常见问题解决:https://gitlab.com/linying23333/green-service-center-temu-or-pinduoduokuajing-2024/raw/main/Readme.md
// @note 本js用户脚本版权归linying所有,仅供研究学习,禁止以任何形式倒卖
//于北京时间 2024/06/10 03:33:11 使用通义千问2.5+ChatGPT3.5以jQuery 2.2.4重构
'use strict';
this.$ = this.jQuery = jQuery.noConflict(true);
// 防止网页与使用的jquery.2.2.4.min.js发生冲突
/*
防止代码因其他原因被执行多次
这段代码出自 Via轻插件,作者谷花泰
*/
var key = encodeURIComponent('拼多多跨境(Temu)弹窗屏蔽');
if (window[key]) return;
window[key] = true;
// 初始化默认数据库
var value = [
// 参数需要根据您的电脑加载速度而定,切勿无脑调低或者调高
// 基础设置
// 设置配置文件版本(为未来预留)
{name: 'setting_Config_Version', value: '1'},
// 启动后进行删除的等待时间:
// 值设置为 0 不启用,默认推荐值为3800
// 单位毫秒,1秒 = 1000毫秒
{name: 'setting_Start_Wait_Time', value: '4200'},
// 是否展示调价菜单
// 默认true(开启),使用false(关闭)
{name: 'setting_Show_Price_Menu', value: 'true'},
// 快速模式设置
// 快速删除模式的删除间隔时间:
// 默认推荐值为100
// 单位毫秒,1秒 = 1000毫秒
{name: 'setting_Fast_Remove_Interval_Time', value: '1'},
// 快速删除持续删除时间
// 默认推荐值为8000
// 单位毫秒,1秒 = 1000毫秒
{name: 'setting_Fast_Remove_Duration', value: '1'}, // 'setting_Fast_Remove_Interval_Time'与'setting_Fast_Remove_Duration'同时设置为 1 不启用
// 是否弹出快速删除结束提示框
// 默认false(关闭),使用true(开启)
{name: 'setting_Show_Fast_Remove_Stopped_Alert', value: 'false'},
// 手动清除按钮设置
// 设置是否添加手动清除按钮
// 默认true(开启),使用false(关闭)
{name: 'setting_Add_Manual_Clear_Button', value: 'true'},
// 设置按钮加载位置默认值
// 位置从浏览器屏幕左上角开始计算,X轴+1则向右移动,Y轴+1则向下移动
// 参数需要带单位(受支持的单位 百分比"%",像素点"px")
// 按钮的X轴(纵向)值
{name: 'setting_Add_Manual_Clear_Button_X', value: '30%'},
// 按钮的Y轴(纵向)值
{name: 'setting_Add_Manual_Clear_Button_Y', value: '92%'},
// 在多长时间内快速点击3次移动按钮打开设置
// 默认推荐值为400
// 单位毫秒,1秒 = 1000毫秒
{name: 'setting_Quickly_Click_3Times_To_Open_Settings_Check_Time', value: '500'},
// 调试模式日志输出
// 默认false(关闭),使用true(开启)
{name: 'setting_Print_DebugMode_Log', value: 'false'}
];
$.each(value, function(index, Event) {
var setValue = Event.value; // 先获取原始值
// 特别处理布尔类型的值
if (Event.value === 'true' || Event.value === 'false') {
setValue = Event.value === 'true';
}
// 如果没有对应的配置项,则为油猴存储添加配置项,确保值为期望的类型
if (!GM_getValue(Event.name)) {GM_setValue(Event.name, setValue)};
});
// 初始化变量
var Button_X = GM_getValue('setting_Add_Manual_Clear_Button_X'), Button_Y = GM_getValue('setting_Add_Manual_Clear_Button_Y');
// 创建 GreaseMonkey 菜单
(function CreateMenu() {
GM_registerMenuCommand('⚙️ 设置', LoadSettingsPanel);
var Status = GM_getValue('setting_Print_DebugMode_Log');
GM_registerMenuCommand('🛠️ 打印控制台调试日志状态切换 | 首次加载状态:' + Status, () => {
// 先进行状态切换
Status = !Status
// 将字符串'true','false'转换为布尔值'true','false'
let boolValue = (Status === 'true') ? true : (Status === 'false') ? false : Status;
GM_setValue('setting_Print_DebugMode_Log', boolValue);
// 提示刷新网页使其生效
alert('打印调试日志状态已经更新为' + boolValue + '\n请手动刷新网页使其油猴菜单文字刷新');
});
})();
// 全局定义是否打印日志调用函数
function log(message) {
if (GM_getValue('setting_Print_DebugMode_Log')) {
console.log('来自 拼多多跨境(Temu)弹窗屏蔽 js用户脚本提示:\n' + message);
}
}
// 启动时检查并提示调试模式状态
(function checkDebugModeStatus() {
var debugMode = GM_getValue('setting_Print_DebugMode_Log');
console.log(`当前 Debug 模式已设置为: ${debugMode}, 调试日志${debugMode ? '已' : '未'}启用.`);
})();
// 按钮处理部分
// 检查是否启用该部分
if (GM_getValue('setting_Add_Manual_Clear_Button')) {
(function() {
// 创建新的div并设置属性
var $div = $('
', {
id: 'js_button_div',
css: {
cssText: 'z-index: 2147483648 !important;', // 在css对象中添加cssText
position: 'fixed',
top: GM_getValue('setting_Add_Manual_Clear_Button_Y'),
left: GM_getValue('setting_Add_Manual_Clear_Button_X'),
'-webkit-user-select': 'none', /* 对于Webkit和Mozilla浏览器,IE浏览器应使用'unselectable' */
'-moz-user-select': 'none', /* 对于早期的Firefox */
'-ms-user-select': 'none', /* 对于早期的Chrome和Safari */
'user-select': 'none' /* IE 10+ */
}
});
// 添加div到body之后
$('body').after($div);
// 创建移动按钮
var $eventMoveButton = $('