Last active
June 25, 2020 15:59
-
-
Save Harfho/5cbd17e9faa8fba086f432eff391d1bd to your computer and use it in GitHub Desktop.
chateko like
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name chateko | |
// @namespace http://tampermonkey.net/ | |
// @version 1.1 | |
// @description like all unlike posts | |
// @author Harfho | |
// @match https://chateko.com/ | |
// @grant GM_setValue | |
// @grant GM_getValue | |
// @grant GM_setClipboard | |
// @grant unsafeWindow | |
// @grant window.close | |
// @grant window.focus | |
// @require http://code.jquery.com/jquery-3.4.1.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
// 1. Create the button | |
var button = document.createElement("button"); | |
button.innerHTML = "Do Something"; | |
// 2. Append somewhere | |
var body = document.getElementsByTagName("body")[0]; | |
body.appendChild(button); | |
// 3. Add event handler | |
button.addEventListener ("click", function() { | |
console.log('Script Started') | |
button.innerHTML = "Script Started"; | |
var likes= $(document.getElementsByClassName('like-btn like-btn-post unselectable')); | |
console.log(likes.length) | |
//Loop through NodeList and call the click() function on each button | |
var interval = setInterval(function(){ | |
var Clike = $(likes.splice(0, 1)); | |
if (!Clike.children('span').attr('class').includes('active')){ | |
console.log("liking"+Clike.children('span').attr('class')); | |
Clike.click()}else{ | |
console.log("Already liked "+Clike.children('span').attr('class')); | |
}; | |
if (likes.length === 0) { | |
button.innerHTML = "Run again"; | |
clearInterval(interval); | |
} | |
}, 10); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment