Greasy Fork is available in English.
7/19/2024, 11:25:52 AM
当前为
// ==UserScript==
// @name snaptik tiktok button
// @namespace Violentmonkey Scripts
// @match https://www.tiktok.com/*
// @grant none
// @version 1.0
// @author minnie
// @description 7/19/2024, 11:25:52 AM
// ==/UserScript==
window.onload = function() {
const followBtn = document.querySelector("[data-e2e='browse-follow']");
if (followBtn) {
var snaptikBtn = document.createElement('button');
snaptikBtn.innerHTML = 'Snaptik';
snaptikBtn.style.cssText = `
box-sizing: border-box;
appearance: none;
min-width: 96px;
display: inline-flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
position: relative;
border-style: solid;
border-width: 1px;
border-radius: 2px;
font-family: var(--tux-fontFamilyParagraph);
font-weight: var(--tux-fontWeightSemibold);
text-decoration: none;
cursor: pointer;
background-clip: padding-box;
font-size: 15px;
height: 36px;
padding-inline: 15px;
color: var(--tux-colorConstTextInverse);
background-color: var(--tux-colorPrimary);
border-color: var(--tux-colorPrimary);
margin-left: 10px;
`;
// Add the SVG next to the 'Snaptik' text
const svg = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="Complete">
<g id="download">
<g>
<path d="M3,12.3v7a2,2,0,0,0,2,2H19a2,2,0,0,0,2-2v-7" fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<g>
<polyline data-name="Right" fill="none" id="Right-2" points="7.9 12.3 12 16.3 16.1 12.3" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<line fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="12" x2="12" y1="2.7" y2="14.2"/>
</g>
</g>
</g>
</g>
</svg>`;
// snaptikBtn.innerHTML += svg;
// Append the new element after the 'followBtn' element
followBtn.insertAdjacentElement('afterend', snaptikBtn);
}
snaptikBtn.addEventListener('click', () => {
let currentLink = window.location.href;
navigator.clipboard.writeText(currentLink).then(() => {
console.log('Link copied to clipboard');
window.open('https://snaptik.app/en1', '_blank');
}).catch(err => {
console.error('Could not copy text: ', err);
});
});
}