harttle/no-leetcode-cn-redirect

Unable to remove the CN top banner

Closed this issue · 4 comments

We have removed that on Leetcode homepage. Not sure with problems page, I'll take a look.

We have removed that on Leetcode homepage. Not sure with problems page, I'll take a look.

Neither the homepage.

Screen Shot 2024-02-17 at 13 09 24

Under development mode, it print out an error:

Screen Shot 2024-02-17 at 13 09 34

I rewrited removeBanner with the following code and it worked:

function removeBanner() {
  log('removing banner');
  const leetCodeCnBannerCloseButton = document.getElementsByClassName(' duration-600 mt-2.5 h-6 w-6 shrink-0 cursor-pointer rounded-[50px] bg-[rgba(0,0,0,0.2)] text-center font-bold leading-5 text-white hover:bg-[rgba(0,0,0,0.7)] dark:bg-[rgba(255,255,255,0.18)]')[0];
  if (!leetCodeCnBannerCloseButton) {
    return;
  }
  leetCodeCnBannerCloseButton.click();
}

I am not a sophisticated frontend developer so I don't know if there is a more general way. Hope this snippet will help you.

Thank you for the details, it's very helpful. The challenge is the class list seems to be layout/style related, which can change overtime. I'm trying to find something identifiable and not likely subject to change.

Submited version 1.2 for review, should be available in a couple of days. Let's try the new version.