check GD (works with greasemonkey for firefox)

is newgrounds song allowed in geometry dash?

  1. // ==UserScript==
  2. // @name check GD (works with greasemonkey for firefox)
  3. // @namespace https://gdccdated.glitch.me/
  4. // @description is newgrounds song allowed in geometry dash?
  5. // @author BZZZZ
  6. // @license GPLv3
  7. // @include /^https?\:\/\/www\.newgrounds\.com\/audio\/listen\/[0-9]+\/?(?:[?#]|$)/
  8. // @version 0.1
  9. // @grant GM.xmlHttpRequest
  10. // @run-at document-end
  11. // @inject-into content
  12. // ==/UserScript==
  13.  
  14. 'use strict'
  15. try{
  16. const reqobj={
  17. 'data':`songID=${/^https?\:\/\/www\.newgrounds\.com\/audio\/listen\/([0-9]+)\/?(?:[?#]|$)/.exec(location.href)[1]}&secret=Wmfd2893gb7`,
  18. 'url':'http://www.boomlings.com/database/getGJSongInfo.php',
  19. 'headers':{
  20. 'Content-Type':'application/x-www-form-urlencoded',
  21. 'Origin':'',
  22. 'User-Agent':''
  23. },
  24. 'responseType':'text',
  25. 'method':'POST',
  26. 'onreadystatechange':r=>{
  27. if(r.readyState!==4)return
  28. btn.disabled=false
  29. btn.style.cursor='pointer'
  30. if(r.status===200){
  31. if(r.responseText.includes('|'))btn.value='\u2611 allowed in GD'
  32. else btn.value='\u2612 not allowed in GD'
  33. }else btn.value=`\u2370 HTTP error ${r.status} ${r.statusText}`
  34. }
  35. }
  36. const btn=document.createElementNS('http://www.w3.org/1999/xhtml','input')
  37. btn.type='button'
  38. btn.value='check GD'
  39. btn.style.fontSize='18px'
  40. btn.style.padding='0'
  41. btn.style.cursor='pointer'
  42. btn.addEventListener('click',()=>{
  43. try{
  44. GM.xmlHttpRequest(reqobj)
  45. }catch(error){
  46. console.error('check GD:',error)
  47. btn.value='\u2370 JS error (see console)'
  48. return
  49. }
  50. btn.style.cursor='wait'
  51. btn.disabled=true
  52. btn.value='loading'
  53. },{'passive':true})
  54. const span=document.createElementNS('http://www.w3.org/1999/xhtml','span')
  55. span.attachShadow({'mode':'closed'}).appendChild(btn)
  56. document.querySelector('.pod-head').appendChild(span)
  57. }catch(error){
  58. console.error('check GD:',error)
  59. }