Come here to get the Block functionality for Wrongplanet

Page 1 of 4 [ 61 posts ]  Go to page 1, 2, 3, 4  Next

The_Face_of_Boo
Veteran
Veteran

User avatar

Joined: 16 Jun 2010
Age: 41
Gender: Non-binary
Posts: 32,869
Location: Beirut, Lebanon.

17 Sep 2020, 11:23 am

....for Chrome.

It doesn't only hide the blocked user's posts forever, but also hide any posts that contain quotes from the blocked user.

Demonstration: https://www.youtube.com/watch?v=B-zITW9 ... el=cupcake


And at the button you can find an unblock list; to unblock those that you may have accidentally blocked.

Code:
  // ==UserScript==
  // @name         Block people.
  // @namespace    https://wrongplanet.net
  // @version      0.1
  // @description  try to take over the world! Muhahaha
  // @author       The_Face_of_Boo
  // @match        https://wrongplanet.net/*
  // @grant    GM.getValue
  // @grant    GM.setValue
  // ==/UserScript==
  (async () => {

      'use strict';

      let stringBlockList = await GM.getValue('stringBlockList');
      let blockList = stringBlockList ? stringBlockList.split(',') : [];
      let blockDiv = document.createElement("div");
      let unblockButton = document.createElement("button");
      document.body.appendChild(blockDiv);
      document.body.appendChild(unblockButton);
      //Create and append select list
      var selectList = document.createElement("select");
      selectList.size = "5";
      selectList.id = "mySelect";
      unblockButton.innerText = 'Unblock';
      blockDiv.appendChild(selectList);
      unblockButton.addEventListener("click", unblockMe, false);

      //Create and append the options
      blockList.forEach(blockedUser => {
          var option = document.createElement("option");
          option.value = blockedUser;
          option.text = blockedUser;
          selectList.appendChild(option);
      })

      console.log(blockList);
      let elements = document.querySelectorAll('div.row');
      let blockButtonHtml = `<button class="myButton"  style='background:darkred'>Block</button>`;

      function blockMe(evt) {
          blockList.push(evt.currentTarget.user);
          GM.setValue('stringBlockList', blockList.toString());
          window.alert(evt.currentTarget.user + " is blocked");
          location.reload();
      }

      function unblockMe() {
          let select = document.getElementById("mySelect");
          let user = select.options[select.selectedIndex].value;

          let index = blockList.findIndex(e => e == user);
          let newlist = removeItemWithSlice(index, blockList);
          GM.setValue('stringBlockList', newlist.toString());
          window.alert(user + " is unblocked");
          location.reload();
      }


      function removeItemWithSlice(index, arr) {
          return [...arr.slice(0, index), ...arr.slice(index + 1)]
      }


      elements.forEach((element, index) => {
          let user = element.querySelector('.user-col').querySelector('p').querySelector('a').innerText;

          ///adding the block button for each post in page
          let buttonsRow = element.querySelector('.action-bar');
          buttonsRow.insertAdjacentHTML('beforeend', blockButtonHtml);
          let blockButton = buttonsRow.querySelector('.myButton');
          if (blockButton) {
              blockButton.addEventListener("click", blockMe, false);
              blockButton.user = user;
          }

          if (blockList.includes(user)) {
              elements[index].remove();
          }

          ///Removing posts with blocked people's quotes.
          let quoteElements = element.querySelectorAll('.quotetitle') || [];
          quoteElements.forEach(el => {
              let trimmed = el.textContent.trim();
              let replaced = trimmed.replace('wrote:', '').trim();
              if (blockList.includes(replaced)) {
                  elements[index].remove();
              }
          });
      });
  })();



That someone else's video shows how to add the script: https://www.youtube.com/watch?v=RpjvLpy ... nel=JayJay



The_Face_of_Boo
Veteran
Veteran

User avatar

Joined: 16 Jun 2010
Age: 41
Gender: Non-binary
Posts: 32,869
Location: Beirut, Lebanon.

20 Sep 2020, 5:42 am

Note: you can remove

Quote:
style='background:darkred'>Block</button>`
from code if the red color annoys you.



League_Girl
Veteran
Veteran

User avatar

Joined: 4 Feb 2010
Gender: Female
Posts: 27,205
Location: Pacific Northwest

22 Sep 2020, 12:28 am

Well this was easier than I thought. All I did was I copied and pasted the code when adding a new script and went to file and selected save and done. That simple.

Thank you, I have been wanting this feature.


_________________
Son: Diagnosed w/anxiety and ADHD. Also academic delayed.

Daughter: NT, no diagnoses.


League_Girl
Veteran
Veteran

User avatar

Joined: 4 Feb 2010
Gender: Female
Posts: 27,205
Location: Pacific Northwest

22 Sep 2020, 1:19 am

Just a warning when you use this block button, when you block people, threads may not always make sense because you would have no way of seeing the ignored content and there would be no hint they had posted in it and you won't see their quotes either and you would only see the user's post but not the ignored content they quoted. There will be no option given to viewed the ignored content like other forums do.

Just pros and cons to blocking people. Threads may not make sense and it will look like some users are talking to themselves or having an argument with themselves.


_________________
Son: Diagnosed w/anxiety and ADHD. Also academic delayed.

Daughter: NT, no diagnoses.


Pepe
Veteran
Veteran

Joined: 11 Jun 2013
Gender: Non-binary
Posts: 26,635
Location: Australia

22 Sep 2020, 2:16 am

League_Girl wrote:
Just a warning when you use this block button, when you block people, threads may not always make sense because you would have no way of seeing the ignored content and there would be no hint they had posted in it and you won't see their quotes either and you would only see the user's post but not the ignored content they quoted. There will be no option given to viewed the ignored content like other forums do.

Just pros and cons to blocking people. Threads may not make sense and it will look like some users are talking to themselves or having an argument with themselves.


I'd want the option to read the entire post.

I just scroll down posts from people I am not interested in.
Can someone explain why that isn't good enough? Seriously? :scratch:



League_Girl
Veteran
Veteran

User avatar

Joined: 4 Feb 2010
Gender: Female
Posts: 27,205
Location: Pacific Northwest

22 Sep 2020, 2:38 am

Pepe wrote:
League_Girl wrote:
Just a warning when you use this block button, when you block people, threads may not always make sense because you would have no way of seeing the ignored content and there would be no hint they had posted in it and you won't see their quotes either and you would only see the user's post but not the ignored content they quoted. There will be no option given to viewed the ignored content like other forums do.

Just pros and cons to blocking people. Threads may not make sense and it will look like some users are talking to themselves or having an argument with themselves.


I'd want the option to read the entire post.

I just scroll down posts from people I am not interested in.
Can someone explain why that isn't good enough? Seriously? :scratch:



Some members here have OCD and they cannot skip over posts from a user because they cannot fight that compulsion to read it.

But this is just a heads up for anyone if they want to use this block feature.


_________________
Son: Diagnosed w/anxiety and ADHD. Also academic delayed.

Daughter: NT, no diagnoses.


Joe90
Veteran
Veteran

User avatar

Joined: 23 Feb 2010
Gender: Female
Posts: 26,492
Location: UK

22 Sep 2020, 2:19 pm

I bet most people have blocked me and that is why my posts often don't get read.... 8O


_________________
Female


Lunella
Veteran
Veteran

User avatar

Joined: 2 Mar 2016
Age: 33
Gender: Female
Posts: 1,067
Location: Yorkshire, UK

22 Sep 2020, 2:22 pm

I think you can get like addon packs for these type of forums, might be worth the admins getting some so we have more functionality.


_________________
The term Aspergers is no longer officially used in the UK - it is now regarded as High Functioning Autism.


kraftiekortie
Veteran
Veteran

Joined: 4 Feb 2014
Gender: Male
Posts: 87,510
Location: Queens, NYC

22 Sep 2020, 6:41 pm

I doubt that anybody has blocked Joe (Is she kidding?)



VegetableMan
Veteran
Veteran

Joined: 11 Jun 2014
Gender: Male
Posts: 5,208
Location: Illinois

22 Sep 2020, 6:47 pm

I would never want to block anyone. I'm up for all feedback on my content -- even death threats if worded nicely.


_________________
What do you call a hot dog in a gangster suit?

Oscar Meyer Lansky


Joe90
Veteran
Veteran

User avatar

Joined: 23 Feb 2010
Gender: Female
Posts: 26,492
Location: UK

22 Sep 2020, 7:14 pm

kraftiekortie wrote:
I doubt that anybody has blocked Joe (Is she kidding?)


Well people have often blocked me for no reason on Facebook. I only block someone if they are a threat to my privacy or keep harassing and bullying me, but otherwise I don't go around blocking people.
But the mods on WP deals with bullying and harassment rather efficiently so I don't really see a reason or any point in blocking people here. Some people just use block features to be petty, spiteful or childish.


_________________
Female


Pepe
Veteran
Veteran

Joined: 11 Jun 2013
Gender: Non-binary
Posts: 26,635
Location: Australia

22 Sep 2020, 9:54 pm

League_Girl wrote:
Pepe wrote:
League_Girl wrote:
Just a warning when you use this block button, when you block people, threads may not always make sense because you would have no way of seeing the ignored content and there would be no hint they had posted in it and you won't see their quotes either and you would only see the user's post but not the ignored content they quoted. There will be no option given to viewed the ignored content like other forums do.

Just pros and cons to blocking people. Threads may not make sense and it will look like some users are talking to themselves or having an argument with themselves.


I'd want the option to read the entire post.

I just scroll down posts from people I am not interested in.
Can someone explain why that isn't good enough? Seriously? :scratch:



Some members here have OCD and they cannot skip over posts from a user because they cannot fight that compulsion to read it.

But this is just a heads up for anyone if they want to use this block feature.


How many is "some"? :scratch:



Pepe
Veteran
Veteran

Joined: 11 Jun 2013
Gender: Non-binary
Posts: 26,635
Location: Australia

22 Sep 2020, 9:55 pm

Joe90 wrote:
I bet most people have blocked me and that is why my posts often don't get read.... 8O

I've blocked you, hence my not replying to this post. :mrgreen:


Lunella wrote:
I think you can get like addon packs for these type of forums, might be worth the admins getting some so we have more functionality.


Until then, you're stuck with me. :mrgreen:



Lunella
Veteran
Veteran

User avatar

Joined: 2 Mar 2016
Age: 33
Gender: Female
Posts: 1,067
Location: Yorkshire, UK

22 Sep 2020, 10:18 pm

Pepe wrote:
Lunella wrote:
I think you can get like addon packs for these type of forums, might be worth the admins getting some so we have more functionality.


Until then, you're stuck with me. :mrgreen:


You're like the little adorable forum pet, who would block you *pat pat* ♡ ♡


_________________
The term Aspergers is no longer officially used in the UK - it is now regarded as High Functioning Autism.


bcousins
Veteran
Veteran

User avatar

Joined: 1 May 2011
Age: 28
Gender: Male
Posts: 809
Location: On a failed Tangara set at Blacktown

23 Sep 2020, 9:29 pm

Lunella wrote:
I think you can get like addon packs for these type of forums, might be worth the admins getting some so we have more functionality.


You can - but some websites are more customised behind the scenes than others, and sometimes addons don't play as nice.


_________________
Want another alternative to WrongPlanet?
https://aspergers.network/forums/ <- New Version Coming (hopefully) soon.


The_Face_of_Boo
Veteran
Veteran

User avatar

Joined: 16 Jun 2010
Age: 41
Gender: Non-binary
Posts: 32,869
Location: Beirut, Lebanon.

26 Sep 2020, 4:46 pm

I am not pro-block, but programming is fun.

It's what I do for living (even tho I am more of an Angular/Nodejs developer getting more into functional programming, not used to DOM manipulation).


So what other features you would like to have? :mrgreen: :jester: