Skip to content

Instantly share code, notes, and snippets.

@arafathusayn
Last active February 21, 2021 08:47
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save arafathusayn/ba49ff4f8d49a427aaf73acb78061978 to your computer and use it in GitHub Desktop.
Save arafathusayn/ba49ff4f8d49a427aaf73acb78061978 to your computer and use it in GitHub Desktop.
Hide Tidio Chat Branding (Old Theme). For new theme, check: https://gist.github.com/arafathusayn/663217f383b02017d20be6ba465959d4
function hideTdo() {
var timer = null;
var target = document.querySelector('#tidio-chat iframe');
if(!target) {
if(timer !== null) {
clearTimeout(timer);
}
timer = setTimeout(hideTdo, 500);
return;
} else {
var timer2 = null;
var tdo = document.querySelector('#tidio-chat iframe')
.contentDocument
.querySelector('a[href*="tidio.com/powered"]');
if(!tdo) {
if(timer2 !== null) {
clearTimeout(timer2);
}
timer2 = setTimeout(hideTdo, 1);
return;
}
document.querySelector('#tidio-chat iframe')
.contentDocument
.querySelector('a[href*="tidio.com/powered"]')
.remove();
return true;
}
}
hideTdo();
setInterval(hideTdo, 10);
@ozzy1986
Copy link

Wow! Thanks man! I was sure I couldn't change the inners of iframe but you succeeded. Great job.
Also, tidio probably canged the html code a bit so I had to change '#tidio-chat > iframe' to '#tidio-chat iframe' because there is one more div in between.

@arafathusayn
Copy link
Author

Thanks for your feedback! I updated the code.

@camielpeeters
Copy link

This is awsome! How do we inplement this in wordpress or any other?
i have the hidetdo.js file stored in wp-includes/js but this does not work beacouse it's not called.
What can I do?

@naflan121
Copy link

@camiel use wp_enqueue_script to load it

@tongdaitructuyen
Copy link

it not working, please help me

@Babimc
Copy link

Babimc commented Aug 24, 2018

I can not get it work either :/

@Toby-535
Copy link

Thank you for the Code! I have the hidetdo.js file stored in wp-includes/js and added the following Code to the function.php:
function hidetdo () { wp_enqueue_script( 'hidetdo', get_template_directory_uri() . '/js/hidetdo.js', array ('jquery'), false, false); } add_action( 'wp_enqueue_script', 'hidetdo');

Can you help me please? It doesnt work! What is wrong with the Code?
Thank you in Advance!

@DanielApodaca96
Copy link

DanielApodaca96 commented Oct 11, 2018

Hi i had to make some changes to make it work for me
Instead of:
var tdo = document.querySelectorAll('#tidio-chat iframe')[0].contentWindow.document.querySelectorAll('#root > div > div.online > div.input-wrapper > a.powered')[0];
AND
document.querySelectorAll('#tidio-chat iframe')[0].contentWindow.document.querySelectorAll('#root > div > div.online > div.input-wrapper > a.powered')[0].style.display = 'none';

I had to do:
var tdo = document.querySelectorAll('#tidio-chat iframe')[0].contentWindow.document.querySelectorAll('div.input-group a.powered')[0];
AND
document.querySelectorAll('#tidio-chat iframe')[0].contentWindow.document.querySelectorAll('div.input-group a.powered')[0].style.display = 'none';

@darwinlai
Copy link

Thank you for the code, im trying to implement the code to shopify, it hides the branding for like 30 sec-1min, and then the branding shows up again. Does anyone know why? Thank you very much.

@ghcmnt
Copy link

ghcmnt commented Jan 6, 2019

keepcalmm, did you figure out how to do this in shopify? I’m trying to add it to shopify too but not sure how/where to add it. Any suggestion would be appreciated.

Thanks.

Copy link

ghost commented Feb 23, 2019

Hello Folks 👍 I Have an Issue With the Script ! It Hides the branding 2 sec and then the Logo Branding Show up Again ! any Solution please ?

@tommyhigh
Copy link

tommyhigh commented Mar 6, 2019

TariikHr, actually it's pretty simple to solve, all you need to do is set an interval for function to get triggered every sec, here is the code setInterval(function(){ hideTdo(); }, 1000);

Copy link

ghost commented Mar 18, 2019

tommyhigh Thank you So Much

@Benso254
Copy link

Where is code supposed to be placed on html?

@manovee
Copy link

manovee commented Apr 26, 2019

Hey is it still working? I placed the code as a snippet and

setInterval(function(){ hideTdo(); }, 1000);

But it hides until we open the chat box.

http://prntscr.com/nh6llv

@bertusjwz
Copy link

Hello guys, I don't get it to work either. Are there any updates or someone that can guide me? Thanks in advance!

@yEzas
Copy link

yEzas commented Aug 2, 2019

@bertusjwz @manovee @Benso254 It still works, don't know if you still need it, but someone might.

Here is the whole code:

function hideTdo() {
  var timer = null;
  var target = document.querySelectorAll('#tidio-chat iframe')[0];
  if(!target || typeof target === 'undefined') {
    if(timer !== null) {
      clearTimeout(timer);
    }
    timer = setTimeout(hideTdo, 500);
    return;
  } else {
    var timer2 = null;
    var tdo = document.querySelectorAll('#tidio-chat iframe')[0].contentWindow.document.querySelectorAll('div.input-group a.powered')[0];
    if(!tdo || typeof tdo === 'undefined') {
      if(timer2 !== null) {
        clearTimeout(timer2);
      }
      timer2 = setTimeout(hideTdo, 1);
      return;
    }
   document.querySelectorAll('#tidio-chat iframe')[0].contentWindow.document.querySelectorAll('div.input-group a.powered')[0].style.display = 'none';
	 setInterval(function(){ hideTdo(); }, 1);
    return true;
  }
}
hideTdo();

@Ajay3147
Copy link

Hello..

After adding the function to hide tidio logo in bot im unable to see URL links in conversations, Its hiding URL links after adding this code along with logo.....What i have to do plz help..

@yieoyo
Copy link

yieoyo commented Jul 13, 2020

below one is far better
(function() {
function onTidioChatApiReady() {
document.querySelector('#tidio-chat iframe').contentDocument.querySelector('a[target=_blank]').remove();
}
if (window.tidioChatApi) {
window.tidioChatApi.on("open", onTidioChatApiReady);

} else {
document.addEventListener("tidioChat-open", onTidioChatApiReady);
//console.log("listener");
}
})();

@yieoyo
Copy link

yieoyo commented Jul 16, 2020

use below:
document.querySelector('#tidio-chat iframe').contentDocument.querySelector('form').nextSibling.remove();

instead of below:
document.querySelector('#tidio-chat iframe').contentDocument.querySelector('a[target=_blank]').remove();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment