Java как изменить

priglasiigroka

Участник
Автор темы
65
16
Короче есть прекрасный форум прекрасного проекта
(https://forum.arizona-rp.com/forums)
А есть скрипт на фулл реакции(фуллХфулл в простонародии)
Мне надо било бы изменить его на дизы
код:
 

priglasiigroka

Участник
Автор темы
65
16
так кто мне помогти?

а я ещё не в тот раздел кинул

code

JavaScript:
[CODE title="12390" highlight="1"]const isUserMessages = location.href.startsWith("https://forum.arizona-rp.com/search/") && document.querySelector("#top > div.p-body-header > div > div > div > h1") && document.querySelector("#top > div.p-body-header > div > div > div > h1").innerText === "Результаты поиска"



const csrf = document.querySelector("html").getAttribute('data-csrf')



function LikePage(gonext, errored, IDREACT) {

  function getPosts() {

    const posts = document.querySelectorAll("#top > div.p-body > div > div.uix_contentWrapper > div > div > div > div > div.block-container > ol > li > div > div > h3 > a")

    if (!posts) return []

    return Array.from(posts).map(e => {

      const urlPost = /\/threads\/(\d+)\/post-(\d+)/

      const urlProfilePost = /\/(profile-posts\/comments|profile-posts)\/(\d+)/

      if (

        urlPost.test(e.href)

      ) {

        const [, thread, postId] = urlPost.exec(e.href)

        return { type: "posts", id: postId }

      }

      if (

        urlProfilePost.test(e.href)

      ) {

        const [, type, postId] = urlProfilePost.exec(e.href)

        return { type, id: postId }

      }

      return {}

    })

  }



  function sendReact(typepost, postid, id = 1) {

    const form = new FormData()

    form.append("_xfToken", csrf)

    form.append("reaction_id", id)

    return fetch(`/${typepost}/${postid}/react`, {

      method: "POST",

      body: form

    })

  }



  Promise.all(getPosts().map(

    post => {

      if (!post.id) return new Promise(res => res("negr"));

      return sendReact(post.type, post.id, IDREACT).then(res => res !== "negr" ? res.text() : res).then(res => console.log(`[post] [react] [liked]`)).catch(err => console.error(`[post] [react error] ${err}`))

    }

  )).then(gonext).catch(errored)

}
 
Последнее редактирование:

jcjzxvjxcvmrmdjfvmj

Участник
37
10
так кто мне помогти?

а я ещё не в тот раздел кинул

code

JavaScript:
[CODE title="12390" highlight="1"]const isUserMessages = location.href.startsWith("https://forum.arizona-rp.com/search/") && document.querySelector("#top > div.p-body-header > div > div > div > h1") && document.querySelector("#top > div.p-body-header > div > div > div > h1").innerText === "Результаты поиска"



const csrf = document.querySelector("html").getAttribute('data-csrf')



function LikePage(gonext, errored, IDREACT) {

  function getPosts() {

    const posts = document.querySelectorAll("#top > div.p-body > div > div.uix_contentWrapper > div > div > div > div > div.block-container > ol > li > div > div > h3 > a")

    if (!posts) return []

    return Array.from(posts).map(e => {

      const urlPost = /\/threads\/(\d+)\/post-(\d+)/

      const urlProfilePost = /\/(profile-posts\/comments|profile-posts)\/(\d+)/

      if (

        urlPost.test(e.href)

      ) {

        const [, thread, postId] = urlPost.exec(e.href)

        return { type: "posts", id: postId }

      }

      if (

        urlProfilePost.test(e.href)

      ) {

        const [, type, postId] = urlProfilePost.exec(e.href)

        return { type, id: postId }

      }

      return {}

    })

  }



  function sendReact(typepost, postid, id = 1) {

    const form = new FormData()

    form.append("_xfToken", csrf)

    form.append("reaction_id", id)

    return fetch(`/${typepost}/${postid}/react`, {

      method: "POST",

      body: form

    })

  }



  Promise.all(getPosts().map(

    post => {

      if (!post.id) return new Promise(res => res("negr"));

      return sendReact(post.type, post.id, IDREACT).then(res => res !== "negr" ? res.text() : res).then(res => console.log(`[post] [react] [liked]`)).catch(err => console.error(`[post] [react error] ${err}`))

    }

  )).then(gonext).catch(errored)

}
вк дай скину подобие