原来的样子:如果按ctrl+V会跳出错误
安装上插件的样子:在下面添加了一个文本框和一个按钮,可以在这个文本框里面随便粘贴,然后按这个按钮就可以更新到评价文本框里面
代码:
1 // ==UserScript== 2 // @name tmall_vote 3 // @namespace jshe 4 // @include http://ratewrite.tmall.com/* 5 // @version 1 6 // @grant none 7 // ==/UserScript== 8 alert(‘hello2‘); 9 function embed() { 10 var getElementByXpath = function (path) { 11 return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; 12 }; 13 var jshe_setTextarea = function () { 14 jshe_cell.value = jshe_textarea.value; 15 }; 16 jshe_cell = document.getElementsByClassName(‘rate-quanlity-content‘) [0]; 17 jshe_textarea = document.createElement(‘textarea‘); 18 jshe_textarea.value = ‘Hello‘; 19 jshe_textarea.name = ‘jshe_textarea‘; 20 jshe_cell.parentNode.parentNode.appendChild(jshe_textarea); 21 var button = document.createElement(‘button‘); 22 button.innerHTML = ‘ClickMe‘; 23 button.onclick = jshe_setTextarea; 24 jshe_cell.parentNode.parentNode.appendChild(button); 25 } 26 var script = document.createElement(‘script‘); 27 script.type = ‘text/javascript‘; 28 script.innerHTML = embed + ‘\nsetTimeout(embed, 3000);‘; 29 document.getElementsByTagName(‘body‘) [0].appendChild(script); 30 //alert("hello3");
greasemonkey
时间: 2024-10-16 20:52:03