我写了一篇Grease Monkey的文章,在博客中添加一个纽子。 我已提醒大家,我知道一切都在进行。
The strange thing is that it fires twice, slightly differently each time. When I navigate to a blogger.com post edit, the script fires first on a black page and goes through all of the alerts in the right order including the "inside" one.
排在页数之后的第二段,除“侧面”外,每一次警报都发生,没有产生错误。
// ==UserScript==
// @name Blogger: Remove HTML Space
// @include http://www.blogger.com/blogger.g?blogID*editor/target*
// ==/UserScript=
function contentEval(source) {
// Check for function input.
alert("asdas");
if ( function == typeof source) {
// Execute this function with no arguments, by adding parentheses.
// One set around the function, required for valid syntax, and a
// second empty set calls the surrounded function.
source = ( + source + )();
}
alert("asdas2");
// Create a script node holding this source code.
var script = document.createElement( script );
alert("asdas3");
script.setAttribute("type", "application/javascript");
alert("asdas4");
script.textContent = source;
alert("asdas5");
// Insert the script node into the page, so it will run, and immediately
// remove it to clean up.
alert("asdas6");
document.body.appendChild(script);
alert("asdas7");
}
alert("test")
contentEval(function(){ alert("inside"); document.getElementById("postingHtmlToolbar").firstChild.innerHTML += <div id="SP" class="goog-inline-block goog-toolbar-button" title="SP" role="button" style="-moz-user-select: none;"><div class="goog-inline-block goog-toolbar-button-outer-box"><div class="goog-inline-block goog-toolbar-button-inner-box"><button type="button" onclick="document.getElementById( postingHtmlBox ).value = document.getElementById( postingHtmlBox ).value.replace(/&nbsp;/g, );"><b>SP</b></button></div></div></div> });
alert("testw");
blogger.com有抗药注射吗?