Script at the end of the page


#1

When working on my site, I found this code at the end of every page:

function getCookie(cname) {
  var name = cname + '=';
  var decodedCookie = decodeURIComponent(document.cookie);
  var ca = decodedCookie.split(';');
  for (var i = 0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0) == ' ') {
      c = c.substring(1);
    }
    if (c.indexOf(name) == 0) {
      return c.substring(name.length, c.length);
    }
  }
  return '';
}
if (getCookie('hostinger')) {
  document.cookie = 'hostinger=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
  location.reload();
}
var notification = document.getElementsByClassName('notice notice-success is-dismissible');
if (notification.length > 0) {
  notification = notification[0];
  notification.setAttribute('style', 'padding-bottom: 10px; padding-top: 5px; background-image: url(); background-size: cover; background-position: bottom right; background-repeat: no-repeat; color: #ffffff;');
  var h1Tag = notification.getElementsByTagName('H1') [0];
  h1Tag.setAttribute('style', 'color:#f15f5f;font-weight:700;');
  h1Tag.innerHTML = 'Get 90% Discount for Premium Web Hosting';
  var link = notification.getElementsByTagName('P') [0].getElementsByTagName('A') [0];
  link.setAttribute('style', 'color:#f15f5f');
  var list = notification.getElementsByTagName('UL') [0];
  var listElements = list.getElementsByTagName('LI');
  for (var i = 0; i < listElements.length; i++) {
    listElements[i].setAttribute('style', 'color:#ffffff');
  }
}

Why is that there? I don’t need your stupid banner telling me about hostinger’s discount. I wrote a code that removes it on every page load, but it’s still not something I like. I remember you said no advertisement will be put on our sites, right?
URL:https://virusdesign.000webhostapp.com


#2

Bună @Justice!

Acel banner:

  1. Nu apare când accesezi site-ul
  2. Va dispărea în 12 ore.

#3

@teodor, salut!
Acela parea ca ar fi scopul codului, inserarea unui banner. Multumesc pentru clarificare!

Edit:Se pare ca e o optiune in panel(Show 000webhost branding) pe care o dezactivai si disparu script-ul. :slight_smile:


EN: It appears that if you go to 000webhost cPanel > Settings > General > Show banner > Off, the script disappears.


#4

E un script injectat în fiecare template doar că la 000webhost nu arată nimic. Și o să dispară în curând. E cu ocazia BlackFriday-ului :wink:


Ah, perfect! Bun așa.


#7