Prevent your tweet from searching
当前为
// ==UserScript==
// @name Insert 0-witdh into Tweet
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Prevent your tweet from searching
// @author eggplants
// @homepage https://github.com/eggplants
// @match https://twitter.com/compose/tweet
// @match https://twitter.com/home
// @grant none
// ==/UserScript==
/*jshint esversion: 6 */
(function () {
"use strict";
let btn = document.createElement("button");
btn.innerHTML = "Insert 0-width space";
btn.onclick = function () {
let elms = Array.from(
document.querySelectorAll('span[data-text="true"]')
);
if (elms.length === 0) {
// do nothing
} else if (elms.length === 1) {
alert(
"Put a new line and atleast one space at the end of your tweet!"
);
} else {
elms.forEach((e) => {
e.innerText = e.innerText
.replaceAll("", "")
.replaceAll(/(.)/g, "$1");
});
console.log("inserted!");
}
};
document
.querySelector(
"div.css-1dbjc4n.r-1iusvr4.r-16y2uox.r-1777fci" +
".r-1h8ys4a.r-1bylmt5.r-13tjlyg.r-7qyjyx.r-1ftll1t" +
"> div:nth-child(3) > div > div > div:nth-child(1)"
)
.appendChild(btn);
console.log("loaded!");
})();