From 4f29ed43439b61ec901f3085e225fa180f8b656e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=86=E0=A4=B6=E0=A5=8D=E0=A4=B5=E0=A4=BF=E0=A4=A8=20?= =?UTF-8?q?=E0=A4=AA=E0=A5=8C=E0=A4=A1=E0=A5=87=E0=A4=B2?= <62433766+Ashwin-Paudel@users.noreply.github.com> Date: Thu, 18 Feb 2021 10:47:38 -0500 Subject: [PATCH] Update youtube-subscribe-click.user.js --- youtube-subscribe-click.user.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/youtube-subscribe-click.user.js b/youtube-subscribe-click.user.js index 6906ee8..c1f905e 100644 --- a/youtube-subscribe-click.user.js +++ b/youtube-subscribe-click.user.js @@ -10,8 +10,15 @@ (function() { 'use strict'; - // Click the subscribe button - document.getElementsByClassName("style-scope ytd-button-renderer style-destructive size-default")[0].click(); - // Then close the window + + // Your code here... + try + { + var btnelem=document.getElementsByClassName('style-scope ytd-subscribe-button-renderer')[0]; + var subscribed = (btnelem.innerText.search("UNSUB")==-1)?false:true; + }catch(Exception){window.close()} + if(!subscribed){ + document.getElementsByClassName('style-scope ytd-subscribe-button-renderer')[0].click(); + } window.close(); })();