4chan gpt2 checker

2023-01-12, 4:05:24 a.m.

  1. // ==UserScript==
  2. // @name 4chan gpt2 checker
  3. // @namespace Violentmonkey Scripts
  4. // @match https://boards.4channel.org/*
  5. // @grant none
  6. // @version 0.2
  7. // @author w w w w
  8. // @license MIT
  9. // @description 2023-01-12, 4:05:24 a.m.
  10. // ==/UserScript==
  11.  
  12.  
  13. (function () {
  14. const url = "https://openai-openai-detector.hf.space/?";
  15.  
  16. [...document.getElementsByClassName("postMessage")].forEach(e => {
  17. const text = e.innerText.replaceAll(/^>>[0-9]+(?:[ \s]\(OP\)){0,1}$/gm, "").trim()
  18. if (text.length == 0) return
  19.  
  20. const row = document.createElement("span")
  21. row.style.marginLeft = "0.25em"
  22.  
  23. const postinfo = [...e.parentElement.children].filter(e2 => e2.classList.contains("postInfo"))
  24.  
  25. if (!postinfo) return
  26.  
  27. postinfo[0].insertBefore(row, [...postinfo[0].children].filter(e2 => e2.tagName == "A").at(-1))
  28.  
  29. const btn = document.createElement("a")
  30. btn.style.cursor = "pointer"
  31. btn.textContent = "Check"
  32. row.appendChild(btn)
  33.  
  34. const result = document.createElement("span")
  35. row.appendChild(result)
  36.  
  37. btn.addEventListener("click", e2 => {
  38. btn.style.cursor = ""
  39. fetch(url + encodeURI(text)).then(res => res.json()).then(res => {
  40. console.log(res)
  41. result.textContent = `${Math.round(res.fake_probability * 100)}% fake`
  42. btn.parentElement.removeChild(btn)
  43. })
  44. e2.preventDefault()
  45. })
  46. })
  47. })()

QingJ © 2025

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