MCPcopy Create free account
hub / github.com/hoothin/UserScripts / createBlockBtn

Function createBlockBtn

HacgGodTurn/HacgGodTurn.user.js:255–278  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

253 }
254 });
255 function createBlockBtn(){
256 var pre = document.querySelector("pre");
257 var author = document.querySelector(".author-info,.entry-footer");
258 if (author && !document.querySelector("#blockBtn")) {
259 var blockBtn=document.createElement("button");
260 blockBtn.id="blockBtn";
261 blockBtn.type="button";
262 blockBtn.textContent="\u597d\u5b69\u5b50\u770b\u4e0d\u5230";
263 blockBtn.style.cssText="padding:4px 0;position: relative;width:120px;";
264 if(pre){
265 pre.parentNode.insertBefore(blockBtn,pre);
266 }else{
267 blockBtn.style.cssText="display:none;";
268 author.appendChild(blockBtn);
269 }
270 blockBtn.addEventListener("click", function(){
271 if(this.nextSibling.style.display == 'block'){
272 this.nextSibling.style.display = '';
273 }else{
274 this.nextSibling.style.display = 'block';
275 }
276 });
277 }
278 }
279 document.querySelector("#main").addEventListener('DOMNodeInserted', function(e) {
280 var author = document.querySelector(".author-info");
281 if (author && !document.querySelector("#blockBtn")) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected