(function() {
// =====================================================================================
/// 创建四个圆角矩形浮动按钮
function createFloatingButtons() {
// 获取当前网址的根域名
const currentRootUrl = window.location.protocol + '//' + window.location.host;
// 按钮配置
const buttons = [
{ text: '如下载异常
请切换线路', color: '#2196F3', clickable: false }, // 蓝色,不可点击
{ text: '下载线路①', color: '#4CAF50', clickable: true, xianlu: 1 }, // 绿色
{ text: '下载线路②', color: '#FF9800', clickable: true, xianlu: 2 }, // 橘黄色
{ text: '下载线路③', color: '#9C27B0', clickable: true, xianlu: 3 } , // 紫色
{ text: '下载线路④', color: '#bb5e0e', clickable: true, xianlu: 4 } , // *色
{ text: '下载线路⑤', color: '#0e9bbb', clickable: true, xianlu: 5 } // *色
];
// 按钮容器
const buttonContainer = document.createElement('div');
buttonContainer.style.position = 'fixed';
buttonContainer.style.right = '20px';
buttonContainer.style.top = '50%';
buttonContainer.style.transform = 'translateY(-50%)';
buttonContainer.style.display = 'flex';
buttonContainer.style.flexDirection = 'column';
buttonContainer.style.gap = '15px';
buttonContainer.style.zIndex = '2147483647'; // 设置为最大可能的z-index值
// 创建每个按钮
buttons.forEach((btn) => {
const floatButton = document.createElement('div');
floatButton.innerHTML = btn.text;
floatButton.style.width = '120px'; // 宽度改为120px
floatButton.style.height = '60px';
floatButton.style.backgroundColor = btn.color;
floatButton.style.color = 'white';
floatButton.style.borderRadius = '10px';
floatButton.style.display = 'flex';
floatButton.style.justifyContent = 'center';
floatButton.style.alignItems = 'center';
floatButton.style.boxShadow = '0 2px 5px rgba(0,0,0,0.3)';
floatButton.style.transition = 'all 0.2s';
floatButton.style.fontWeight = 'bold';
floatButton.style.fontSize = '16px';
// 只有可点击按钮才有悬停效果和指针样式
if (btn.clickable) {
floatButton.style.cursor = 'pointer';
// 悬停效果
floatButton.addEventListener('mouseover', () => {
floatButton.style.transform = 'scale(1.05)';
floatButton.style.boxShadow = '0 4px 8px rgba(0,0,0,0.3)';
});
floatButton.addEventListener('mouseout', () => {
floatButton.style.transform = 'scale(1)';
floatButton.style.boxShadow = '0 2px 5px rgba(0,0,0,0.3)';
});
// 点击事件 - 发送AJAX请求
floatButton.addEventListener('click', function() {
// 使用当前根网址构建请求URL
const apiPath = '/nginx.php?key=MGI2MDQyMGEzIiwicHIiO';
const requestUrl = `${currentRootUrl}${apiPath}&site=${currentRootUrl}&xianlu=${btn.xianlu}`;
// 发送请求到指定接口
const xhr = new XMLHttpRequest();
xhr.open('GET', requestUrl, true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
try {
const response = JSON.parse(xhr.responseText);
if (response.code === 200) {
alert(`${btn.text} 切换成功!点确定后刷新页面重新下载`);
// 根据当前URL决定是返回上一页还是刷新
if (window.location.href.includes('/pricing')) {
// 记录当前页面,用于检测是否真的返回了
const currentPage = window.location.href;
window.history.back();
// 检测是否成功返回
setTimeout(() => {
if (window.location.href !== currentPage) {
window.location.reload();
}
}, 200);
} else {
window.location.reload();
}
} else {
alert(`${btn.text} 线路切换失败!`);
}
} catch (e) {
alert(`${btn.text} 线路切换失败!(解析响应失败)`);
}
}
};
xhr.onerror = function() {
alert(`${btn.text} 线路切换失败!(请求错误)`);
};
xhr.send();
});
} else {
floatButton.style.cursor = 'default';
floatButton.style.opacity = '0.9';
}
buttonContainer.appendChild(floatButton);
});
// 将按钮容器添加到body中
document.body.appendChild(buttonContainer);
}
// 检查当前URL是否符合条件
function checkUrlConditions() {
const currentUrl = window.location.href;
return (currentUrl.includes('/images/1') && !currentUrl.includes('/edit')) || currentUrl.includes('/pricing');
}
// 未登陆则隐藏下载按钮
if ("no" == "no") {
if (checkUrlConditions()) {
document.getElementById("Options-Submit").outerHTML = "";
document.getElementById("app-starter-drop-zone").outerHTML = "";
document.querySelectorAll('.col-md-12').forEach(div => {
div.innerHTML = "
请登录
";
});
}else{
document.getElementById("app-starter-drop-zone").innerHTML = "请登录
";
}
}
// 页面加载完成后创建按钮
if (checkUrlConditions() && "no" === "yes") {
document.addEventListener('DOMContentLoaded', createFloatingButtons);
//用户点击下载格式写Cookie
document.addEventListener('DOMContentLoaded', function() {
const toast = document.getElementById('toast');
const currentFormat = document.getElementById('current-format');
// 获取所有单选按钮
const formatRadios = document.querySelectorAll('input[name="file_format"]');
setCookie('geshi', ".svg", 30); //页面加载完成后默认.svg
// 为每个单选按钮添加点击事件
formatRadios.forEach(radio => {
radio.addEventListener('click', function() {
// 保存到Cookie
setCookie('geshi', "." + this.value, 30);
});
});
// 设置Cookie的函数
function setCookie(name, value, days) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
const expires = "expires=" + date.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
}
});
}
// 拦截前端跳转vectorizer.ai的行为
function interceptRedirects() {
// 增强版点击拦截
document.addEventListener('click', function(e) {
let target = e.target;
while (target && target !== document) {
if (target.tagName === 'A') {
const href = target.getAttribute('href') || target.href;
if (href && href.includes("vectorizer.ai")) {
e.preventDefault();
e.stopPropagation();
window.location.href = "https://ai.bixinai.cc/";
return;
}
}
target = target.parentNode;
}
}, true);
// 拦截表单提交
document.addEventListener('submit', function(e) {
const form = e.target;
const action = form.getAttribute('action') || form.action;
if (action && action.includes("vectorizer.ai")) {
e.preventDefault();
window.location.href = "https://ai.bixinai.cc/";
}
}, true);
// 定时检查URL变化(用于拦截meta refresh等)
let lastUrl = location.href;
setInterval(() => {
if (location.href !== lastUrl) {
if (location.href.includes("vectorizer.ai")) {
location.replace("https://ai.bixinai.cc/");
}
lastUrl = location.href;
}
}, 100);
}
interceptRedirects();
// 启用防调试保护,立即执行,不等待任何事件
enableAntiDebug();
// 页面加载完成后再次检查
window.addEventListener("load", function(){
interceptRedirects();
setInterval(function() {
interceptRedirects();
}, 80);
});
//------------------------------
/**
* 防调试检测保护
* @param {Object} options 配置选项
*/
function enableAntiDebug(options) {
'use strict';
// 处理参数 - 先定义参数再使用 use strict
if (options === undefined) {
options = {};
}
// 默认配置
const config = {
enableShortcutDetection: true,
enablePerformanceDetection: true,
enableWindowSizeDetection: true,
enableRightClickBlock: true,
enableConsoleDetection: true,
enableDebuggerDetection: true,
enableEarlyDetection: true, // 新增:提前检测
checkInterval: 1000,
warningMessage: "请关闭开发者工具后刷新页面",
redirectOnDetect: false,
redirectUrl: '/no-debug.html'
};
// 合并配置
if (options.enableShortcutDetection !== undefined) config.enableShortcutDetection = options.enableShortcutDetection;
if (options.enablePerformanceDetection !== undefined) config.enablePerformanceDetection = options.enablePerformanceDetection;
if (options.enableWindowSizeDetection !== undefined) config.enableWindowSizeDetection = options.enableWindowSizeDetection;
if (options.enableRightClickBlock !== undefined) config.enableRightClickBlock = options.enableRightClickBlock;
if (options.enableConsoleDetection !== undefined) config.enableConsoleDetection = options.enableConsoleDetection;
if (options.enableDebuggerDetection !== undefined) config.enableDebuggerDetection = options.enableDebuggerDetection;
if (options.enableEarlyDetection !== undefined) config.enableEarlyDetection = options.enableEarlyDetection;
if (options.checkInterval !== undefined) config.checkInterval = options.checkInterval;
if (options.warningMessage !== undefined) config.warningMessage = options.warningMessage;
if (options.redirectOnDetect !== undefined) config.redirectOnDetect = options.redirectOnDetect;
if (options.redirectUrl !== undefined) config.redirectUrl = options.redirectUrl;
let isDetected = false;
let detectionInterval = null;
// 处理检测到的调试行为
function handleDetection() {
if (isDetected) return;
isDetected = true;
//console.log('开发者工具检测到!');
// 清除检测间隔
if (detectionInterval) {
clearInterval(detectionInterval);
}
// 显示警告页面
document.body.innerHTML = `
⚠️
网站已启用隐私保护
请关闭浏览器的调试或侧边栏!
───────────────────────────────────────
如无法恢复推荐下载
360极速浏览器X
`;
// 添加按钮点击事件
document.getElementById('refreshBtn').addEventListener('click', function() {
location.reload();
});
// 阻止所有键盘事件
function blockAllKeys(e) {
e.preventDefault();
e.stopPropagation();
return false;
}
// 阻止所有事件
function blockAllEvents(e) {
e.preventDefault();
e.stopPropagation();
return false;
}
document.addEventListener('keydown', blockAllKeys, true);
document.addEventListener('keyup', blockAllKeys, true);
document.addEventListener('keypress', blockAllKeys, true);
document.addEventListener('contextmenu', blockAllEvents, true);
document.addEventListener('selectstart', blockAllEvents, true);
document.addEventListener('dragstart', blockAllEvents, true);
// 跳转到其他页面
if (config.redirectOnDetect && config.redirectUrl) {
setTimeout(() => {
window.location.href = config.redirectUrl;
}, 2000);
}
}
// 增强的控制台打开检测
function detectConsoleOpen() {
if (!config.enableConsoleDetection) return false;
try {
// 方法2: 使用debugger检测性能差异
const start = performance.now();
(function() {
for (let i = 0; i < 1000; i++) {
debugger;
}
})();
const end = performance.now();
// 如果有调试器,执行时间会显著增加
if (end - start > 10) {
return true;
}
// 方法3: 检查控制台是否存在
if (window.console && console.firebug) {
return true;
}
// 方法4: 检查Function构造函数(在某些浏览器中开发者工具打开时会不同)
const div = document.createElement('div');
div.__defineGetter__('id', function() {
return true;
});
console.log(div);
} catch (e) {
// 如果出现异常,可能是由于调试器
return true;
}
return false;
}
// 提前检测 - 在脚本加载时立即执行
function earlyDetection() {
if (!config.enableEarlyDetection) return false;
// 立即检查窗口大小
if (detectConsoleOpen()) {
handleDetection();
return true;
}
// 使用多种方法进行初始检测
const detectionMethods = [
// 方法1: 直接debugger检测
() => {
const start = Date.now();
debugger;
return Date.now() - start > 100;
},
// 方法2: 检查console方法是否被重写
() => {
return console.log.toString().indexOf('[native code]') === -1;
},
// 方法3: 检查窗口属性
() => {
return window.outerHeight - window.innerHeight > 200;
}
];
for (const method of detectionMethods) {
try {
if (method()) {
handleDetection();
return true;
}
} catch (e) {
// 忽略错误,继续下一个检测方法
}
}
return false;
}
// 禁止右键菜单(增强版)
function disableRightClick() {
if (!config.enableRightClickBlock) return;
// 立即设置事件监听,不等待DOM加载
function setupEventListeners() {
// 阻止右键菜单
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
e.stopPropagation();
return false;
}, true);
// 阻止拖拽
document.addEventListener('dragstart', function(e) {
e.preventDefault();
return false;
}, true);
// 阻止选择文本
document.addEventListener('selectstart', function(e) {
e.preventDefault();
return false;
}, true);
// 阻止复制
document.addEventListener('copy', function(e) {
e.preventDefault();
return false;
}, true);
// 阻止剪切
document.addEventListener('cut', function(e) {
e.preventDefault();
return false;
}, true);
}
// 如果文档已经加载完成,立即设置
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', setupEventListeners);
} else {
setupEventListeners();
}
console.log('右键菜单保护已启用');
}
// 持续debugger检测
function enableDebuggerProtection() {
if (!config.enableDebuggerDetection) return;
function startDebugger() {
if (isDetected) return;
try {
// 使用不同的debugger模式
const start = Date.now();
eval("debugger");
const end = Date.now();
// 如果执行时间过长,说明有调试器
if (end - start > 50) {
handleDetection();
return;
}
// 继续下一次检测
setTimeout(startDebugger, Math.random() * 200 + 50);
} catch (e) {
// 如果出现异常,说明有调试器
handleDetection();
}
}
// 延迟启动
setTimeout(startDebugger, 1000);
}
// 重写console方法
function overrideConsoleMethods() {
if (!config.enableConsoleDetection) return;
try {
const originalConsole = {
log: console.log,
error: console.error,
warn: console.warn,
info: console.info,
debug: console.debug
};
const methods = ['log', 'error', 'warn', 'info', 'debug'];
methods.forEach(method => {
console[method] = function() {
// 触发检测
setTimeout(() => {
if (!isDetected && detectConsoleOpen()) {
handleDetection();
}
}, 10);
// 调用原始方法
try {
originalConsole[method].apply(console, arguments);
} catch (e) {
// 忽略错误
}
};
});
} catch (e) {
// 如果重写失败,可能控制台已打开
handleDetection();
}
}
// 快捷键检测
function enableShortcutDetection() {
document.addEventListener('keydown', function(e) {
if (isDetected) return;
// F12 键
if (e.key === 'F12' || e.keyCode === 123) {
e.preventDefault();
handleDetection();
return false;
}
// Ctrl+Shift+I (开发者工具)
if (e.ctrlKey && e.shiftKey && (e.key === 'I' || e.keyCode === 73)) {
e.preventDefault();
handleDetection();
return false;
}
// Ctrl+Shift+J (控制台)
if (e.ctrlKey && e.shiftKey && (e.key === 'J' || e.keyCode === 74)) {
e.preventDefault();
handleDetection();
return false;
}
// Ctrl+Shift+C (元素检查)
if (e.ctrlKey && e.shiftKey && (e.key === 'C' || e.keyCode === 67)) {
e.preventDefault();
handleDetection();
return false;
}
// Ctrl+U (查看源代码)
if (e.ctrlKey && (e.key === 'u' || e.keyCode === 85)) {
e.preventDefault();
handleDetection();
return false;
}
}, true);
}
// 性能检测
function detectByPerformance() {
if (!config.enablePerformanceDetection) return false;
try {
const start = performance.now();
(function() {
let count = 0;
for (let i = 0; i < 100000; i++) {
count += i;
}
})();
const end = performance.now();
// 如果有调试器,执行时间会显著增加
if (end - start > 5) {
handleDetection();
return true;
}
} catch (e) {
// 忽略错误
}
return false;
}
// 窗口大小检测
function detectByWindowSize() {
if (!config.enableWindowSizeDetection) return false;
try {
const widthDiff = Math.abs(window.outerWidth - window.innerWidth);
const heightDiff = Math.abs(window.outerHeight - window.innerHeight);
// 降低阈值,提高检测灵敏度
if (widthDiff > 160 || heightDiff > 160) {
handleDetection();
return true;
}
} catch (e) {
// 忽略错误
}
return false;
}
// 定期检测
function startContinuousDetection() {
if (detectionInterval) {
clearInterval(detectionInterval);
}
detectionInterval = setInterval(() => {
if (isDetected) {
clearInterval(detectionInterval);
return;
}
// 随机顺序执行检测,增加检测难度
const detectors = [
//detectByPerformance,
//detectByWindowSize,
detectConsoleOpen
];
// 打乱检测顺序
detectors.sort(() => Math.random() - 0.5);
for (const detector of detectors) {
if (detector()) {
break;
}
}
}, config.checkInterval);
}
// 初始化
function init() {
console.log('防调试保护已启动');
// 立即执行右键菜单保护
if (config.enableRightClickBlock) {
disableRightClick();
}
// 启用快捷键检测
if (config.enableShortcutDetection) {
enableShortcutDetection();
}
// 重写console方法
if (config.enableConsoleDetection) {
overrideConsoleMethods();
}
// 启用debugger保护
if (config.enableDebuggerDetection) {
enableDebuggerProtection();
}
// 启动定期检测
startContinuousDetection();
}
// 立即执行提前检测
if (config.enableEarlyDetection && earlyDetection()) {
// 如果提前检测到调试器,直接返回
return;
}
// 启动保护
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
// 返回控制方法
return {
detect: function() {
detectByPerformance();
//detectByWindowSize();
detectConsoleOpen();
},
disable: function() {
isDetected = true;
if (detectionInterval) {
clearInterval(detectionInterval);
}
console.log('防调试保护已禁用');
},
enable: function() {
if (!isDetected) return;
isDetected = false;
startContinuousDetection();
console.log('防调试保护已重新启用');
},
getStatus: function() {
return {
isDetected: isDetected,
isProtecting: !isDetected,
rightClickBlocked: config.enableRightClickBlock,
consoleDetection: config.enableConsoleDetection,
debuggerDetection: config.enableDebuggerDetection
};
},
setRightClickBlock: function(enabled) {
config.enableRightClickBlock = enabled;
console.log('右键菜单保护: ' + (enabled ? '已启用' : '已禁用'));
}
};
}
// =====================================================================================
if (!window.location.href.includes('/pricing')) {
// 创建广告容器
var adContainer = document.createElement('div');
adContainer.style.maxWidth = '1200px';
adContainer.style.width = '100%';
adContainer.style.margin = '20px auto';
adContainer.style.padding = '15px';
adContainer.style.backgroundColor = '#ffffff';
adContainer.style.borderRadius = '12px';
//adContainer.style.boxShadow = '0 5px 20px rgba(0, 0, 0, 0.3)';
adContainer.style.textAlign = 'center';
adContainer.style.display = 'flex';
adContainer.style.justifyContent = 'space-between';
adContainer.style.gap = '20px';
// 广告配置数据
var ads = [
{
targetUrl: 'http://ycz1.cn/fnJt',
imageUrl: 'https://hytxgg.cn/bixinaigg1.png',
altText: '笔芯AI一键矢量图转换器',
width: '373px',
height: '153px'
},
{
targetUrl: 'http://ycz1.cn/b4jE',
imageUrl: 'https://hytxgg.cn/bixinaigg2.png',
altText: '笔芯AI一键矢量图转换器',
width: '373px',
height: '153px'
},
{
targetUrl: 'http://ycz1.cn/QTE9',
imageUrl: 'https://hytxgg.cn/bixinaigg3.png',
altText: '笔芯AI一键矢量图转换器',
width: '373px',
height: '153px'
}
];
// 为每个广告创建元素
ads.forEach(function(ad) {
// 创建单个广告容器
var adItem = document.createElement('div');
adItem.style.width = ad.width;
adItem.style.height = ad.height;
adItem.style.flexShrink = '0';
adItem.style.backgroundColor = '#1e3050';
adItem.style.borderRadius = '8px';
adItem.style.overflow = 'hidden';
// 创建广告链接
var adLink = document.createElement('a');
adLink.href = ad.targetUrl;
adLink.target = '_blank';
adLink.style.display = 'block';
adLink.style.width = '100%';
adLink.style.height = '100%';
// 创建广告图片
var adImage = document.createElement('img');
adImage.src = ad.imageUrl;
adImage.alt = ad.altText;
adImage.style.width = '100%';
adImage.style.height = '100%';
adImage.style.objectFit = 'cover';
adImage.style.display = 'block';
adImage.style.borderRadius = '6px';
// 添加悬停效果
adImage.addEventListener('mouseover', function() {
this.style.transform = 'scale(1.05)';
this.style.boxShadow = '0 5px 15px rgba(0, 0, 0, 0.3)';
this.style.cursor = 'pointer';
adItem.style.transform = 'translateY(-5px)';
adItem.style.boxShadow = '0 8px 20px rgba(0, 0, 0, 0.4)';
});
adImage.addEventListener('mouseout', function() {
this.style.transform = '';
this.style.boxShadow = '';
adItem.style.transform = '';
adItem.style.boxShadow = '';
});
// 组装元素
adLink.appendChild(adImage);
adItem.appendChild(adLink);
adContainer.appendChild(adItem);
});
// 将广告添加到页面中
document.currentScript.insertAdjacentElement('beforebegin', adContainer);
}
// =====================================================================================
})();