Skip to content

Instantly share code, notes, and snippets.

@scr2em
Last active January 12, 2021 21:24
Show Gist options
  • Select an option

  • Save scr2em/d82e663f152b275b2b44a6c48d04aed7 to your computer and use it in GitHub Desktop.

Select an option

Save scr2em/d82e663f152b275b2b44a6c48d04aed7 to your computer and use it in GitHub Desktop.

Revisions

  1. scr2em revised this gist Jan 12, 2021. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions commentPicker.js
    Original file line number Diff line number Diff line change
    @@ -11,13 +11,14 @@ link = link.split("&")[0]
    }else{
    link = link.split("?")[0]
    }
    comments.push({name: x.firstElementChild.firstElementChild.innerHTML,comment:'comment:,profile:link})

    comments.push({name: x.firstElementChild.firstElementChild.innerHTML,profile:link})
    }catch{
    }
    })

    var rand = Math.floor(Math.random()*comments.length)
    return comments[rand]
    var {name,profile} = comments[Math.floor(Math.random()*comments.length)]
    console.log(`YAY ${name} has won!!! check his profile at ${profile} `)


    }
  2. scr2em created this gist Jan 12, 2021.
    23 changes: 23 additions & 0 deletions commentPicker.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    // open the post in a new tap
    var commentPicker= function(){

    var comments =[];
    document.querySelectorAll("li div div div div div div div div div div a").forEach(x=>{

    try{
    var link = x.href
    if(link.match('profile.php')){
    link = link.split("&")[0]
    }else{
    link = link.split("?")[0]
    }
    comments.push({name: x.firstElementChild.firstElementChild.innerHTML,comment:'comment:,profile:link})
    }catch{
    }
    })

    var rand = Math.floor(Math.random()*comments.length)
    return comments[rand]


    }