信息技术网站优化

2025/08/24 IT 优化 共 3141 字,约 9 分钟
剑宗

信息技术网站优化

使用教程

按F12,选择控制台(Console),然后把代码粘贴进去,如果没有粘贴成功请在控制台输入“允许粘贴”

改头像/名字/性别

document.getElementById("ctl00_Cstu_Btnphoto").removeAttribute("disabled");
document.getElementById("ctl00_Cstu_Btnname").removeAttribute("disabled");
document.getElementById("ctl00_Cstu_Btnsex").removeAttribute("disabled");

打字练习优化

function enablePaste() {
  document.querySelectorAll('*').forEach(element => {
    element.onpaste = null;
  });
  document.onpaste = null;
  
  const oldAddEventListener = EventTarget.prototype.addEventListener;
  EventTarget.prototype.addEventListener = function(type, listener, options) {
    if (type === 'paste') {
      console.log('[Paste Guard] 已阻止 paste 事件监听器:', listener.toString());
      return;
    }
    oldAddEventListener.call(this, type, listener, options);
  };
  console.log('粘贴功能已启用');
}

function copyToClipboard(text) {
  const textarea = document.createElement('textarea');
  textarea.value = text;
  document.body.appendChild(textarea);
  textarea.select();
  
    const success = document.execCommand('copy');
      console.log('单词:', text);
  
  document.body.removeChild(textarea);
}

function observeAndCopy() {
  const targetDiv = document.querySelector('div#TextWord.showtxt');
  const inputElement = document.getElementById('InputWord');
  
  if (!targetDiv) {
    console.warn('[Observer] 未找到 div#TextWord.showtxt');
    return null;
  }

  const initialText = (targetDiv.textContent || targetDiv.innerText).trim();
  if (initialText) {
    copyToClipboard(initialText);
  }
  if (inputElement) {
    inputElement.focus();
  }

  const observer = new MutationObserver((mutations) => {
    const newText = (targetDiv.textContent || targetDiv.innerText).trim();
    if (newText && newText !== initialText) {
      copyToClipboard(newText);
      
      if (inputElement) {
        inputElement.focus();
        document.getElementById('Meanword').textContent = '';
      }
    }
  });

  observer.observe(targetDiv, {
    childList: true,
    subtree: true,
    characterData: true,
  });

  console.log('[Observer] 已开始监听 div#TextWord.showtxt 的内容变化');
  return observer;
}

function initAutoCopy() {
	document.getElementById('Meanword').textContent = '';
	document.getElementById('msg').textContent = '';
  enablePaste();
  const observer = observeAndCopy();
  
  return observer;
}

initAutoCopy();

显示打字练习里被隐藏的游戏

const commentNodes = document.querySelectorAll('*');
let targetComment = null;

for (let node of commentNodes) {
    for (let child of node.childNodes) {
        if (child.nodeType === Node.COMMENT_NODE && 
            child.textContent.includes('键盘钢琴') && 
            child.textContent.includes('推箱子游戏')) {
            targetComment = child;
            break;
        }
    }
    if (targetComment) break;
}

if (targetComment) {
    const htmlContent = targetComment.textContent
        .replace(/^<!--/, '')
        .replace(/-->$/, '');
    
    const tempDiv = document.createElement('div');
    tempDiv.innerHTML = htmlContent;
    
    targetComment.replaceWith(tempDiv);
    
    console.log('游戏链接已显示!');
} else {
    console.log('未找到包含游戏链接的注释');
}

主页显示头像

const commentNodes = document.querySelectorAll('*');
let targetComment = null;

for (let node of commentNodes) {
    for (let child of node.childNodes) {
        if (child.nodeType === Node.COMMENT_NODE && 
            child.textContent.includes('ctl00_Cphs_Imageface')) {
            targetComment = child;
            break;
        }
    }
    if (targetComment) break;
}

if (targetComment) {
    const htmlContent = targetComment.textContent.trim()
        .replace(/^<!--/, '')
        .replace(/-->$/, '');
    
    const fragment = document.createRange().createContextualFragment(htmlContent);
    
    targetComment.replaceWith(fragment);
    console.log('内容已显示,无多余div');
} else {
    console.log('未找到目标注释');
}

文档信息

Search

    Table of Contents