// ==UserScript== // @name 蓝湖脚本 // @namespace https://lanhuapp.com/ // @version 0.1 // @description 修改px为rpx // @require https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js // @require https://cdn.bootcdn.net/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js // @author xinkun86 // @match https://lanhuapp.com/web* // @grant none // @collaborator xinkun86 // @updateURL https://openuserjs.org/meta/xinkun86/My_Script.meta.js // @license MIT // ==/UserScript== (function() { 'use strict'; // Your code here... window.onload = function(){ // $("code")[0].append("1234566") /* setTimeout(()=>{ $(".annotation_item").bind("DOMSubtreeModified",function(){ console.log("内容改变") $('code.language-css').ready(()=>{ var codeHtml =$('code.language-css') codeHtml.html(codeHtml.html().replace(/[0-9]px<span/g,"rpx<span")) //codeHtml.innerHTML = codeHtml.innerHTML.replace(/[0-9]px<span/g,"rpx<span") //var test= (document.getElementsByClassName('language-css'))[1].innerHTML.replace(/[0-9]px<span/g,"rpx<span") //document.getElementsByClassName('language-css')[1].innerHTML = test }) }); },2000) */ $(".annotation_item").ready(()=>{ $(".annotation_item").bind("DOMSubtreeModified",function(){ console.log("内容改变") $('code.language-css').ready(()=>{ console.log('内容..') var codeHtml =$('code.language-css') codeHtml.html(codeHtml.html().replace(/[0-9]px<span/g,"rpx<span")) //codeHtml.innerHTML = codeHtml.innerHTML.replace(/[0-9]px<span/g,"rpx<span") //var test= (document.getElementsByClassName('language-css'))[1].innerHTML.replace(/[0-9]px<span/g,"rpx<span") //document.getElementsByClassName('language-css')[1].innerHTML = test }) }); }) //setInterval(()=>{ //console.log('test:::::',(document.getElementsByClassName('language-css'))[1].innerHTML) // var test= (document.getElementsByClassName('language-css'))[1].replace(/'px'/,"/'rpx/'") //console.log('test:::::',test) // document.getElementsByClassName('language-css')[1].innerHTML = test //}, 500) } })();