amitbl / blocktube

YouTube™ content blocker
GNU General Public License v3.0
882 stars 62 forks source link

Custom function syntax error #249

Closed will09122000 closed 1 year ago

will09122000 commented 1 year ago

I get this error when trying to use the custom blocking function:

inject.js:1055 Custom function syntax error SyntaxError: Unexpected token '{'
    at storageReceived (inject.js:1049:48)
    at inject.js:1219:9

The function:

(video, objectType) => {
  // Add custom conditions below
  if (video.channelName.toLowerCase().includes("mm7games") && video.title.toLowerCase().includes("fall guys") {
    // Block the video
    return true;
  }

  // Custom conditions did not match, do not block
  return false;
}
llamatar commented 1 year ago

Your function is missing a closing parenthesis ')' for the if condition.

(video, objectType) => {
  // Add custom conditions below
  if (video.channelName.toLowerCase().includes("mm7games") && video.title.toLowerCase().includes("fall guys")) {
    // Block the video
    return true;
  }

  // Custom conditions did not match, do not block
  return false;
}