festify.us vote script

Unlimited votes on festify.us songs!

  1. // ==UserScript==
  2. // @name festify.us vote script
  3. // @namespace https://einbaum.org/
  4. // @version 1.0.3
  5. // @description Unlimited votes on festify.us songs!
  6. // @author https://github.com/EinBaum
  7. // @include http://festify.us/*
  8. // @include https://festify.us/*
  9.  
  10. // @supportURL https://github.com/EinBaum/festify.us-vote-script/issues
  11. // @homepageURL https://github.com/EinBaum/festify.us-vote-script
  12.  
  13. // ==/UserScript==
  14.  
  15. function FVS_AddVoteSingle(songName, songID) {
  16. 'use strict';
  17.  
  18. document.cookie = "connect.sid=";
  19. console.log("Voting: " + songName);
  20.  
  21. var listID = window.location.pathname.split("&")[0].substring(1);
  22.  
  23. var http = new XMLHttpRequest();
  24. var url = "/api/parties/" + listID + "/queue";
  25. var params = JSON.stringify({name: songName, spotifyID: songID});
  26.  
  27. http.open("POST", url, true);
  28. http.withCredentials = false;
  29. http.setRequestHeader("Content-type", "application/json;charset=UTF-8");
  30. http.onreadystatechange = function() {
  31. if(http.readyState == 4 && http.status == 200) {
  32. console.log("Voted!");
  33. }
  34. };
  35. http.send(params);
  36. }
  37.  
  38. function FVS_AddVoteMultiple(songName, songID, num) {
  39. 'use strict';
  40.  
  41. for (var i = 0; i < num; i++) {
  42. FVS_AddVoteSingle(songName, songID);
  43. }
  44. }
  45.  
  46. function FVS_CreateButton(parent, songName, songID) {
  47. 'use strict';
  48.  
  49. var inp = document.createElement("input");
  50. inp.value = "1";
  51. inp.setAttribute("style", "position: absolute; z-index: 999; width: 70px; margin-left: 410px; margin-top: -65px; padding: 0");
  52. parent.appendChild(inp);
  53.  
  54. var btn = document.createElement("div");
  55. btn.setAttribute("style", "position: absolute; z-index: 999; margin-left: 500px; margin-top: -55px; width: 30px; font-size: 30px");
  56. btn.onclick = function() {
  57. FVS_AddVoteMultiple(songName, songID, inp.value);
  58. };
  59.  
  60. var btnicon = document.createElement("i");
  61. btnicon.className = "fa fa-tree";
  62. btn.appendChild(btnicon);
  63.  
  64. parent.appendChild(btn);
  65. }
  66.  
  67. var FVS_regex = /^([^\(]*) \((.*?)\)$/;
  68.  
  69. function FVS_CheckElement(node) {
  70. 'use strict';
  71.  
  72. if (node && node.tagName && node.tagName.toLowerCase() == "div") {
  73. var label = node.getAttribute("analytics-label");
  74. if (label) {
  75. var result = FVS_regex.exec(label);
  76. FVS_CreateButton(node.parentElement, result[2], result[1]);
  77. }
  78. }
  79. }
  80.  
  81. (function() {
  82. 'use strict';
  83.  
  84. var config = { childList: true, subtree: true };
  85. var observer = new MutationObserver(function(mutations) {
  86. mutations.forEach(function(mutation) {
  87. for (var i = 0; i < mutation.addedNodes.length; i++) {
  88. FVS_CheckElement(mutation.addedNodes[i]);
  89. }
  90. });
  91. });
  92. observer.observe(document.body, config);
  93. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址