mirror-web/static/js/thuhidden.es6
Miao Wang 1e262352d9
make string.endsWith compatible with IE
Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
2019-05-22 14:47:46 +08:00

18 lines
534 B
JavaScript

---
---
{% if site.suffix %}
if(!String.prototype.endsWith) {
String.prototype.endsWith = function (ending) {
if(typeof ending !== 'string') return false;
if(!ending) return true;
return this.slice(-ending.length) === ending;
};
}
if(!document.location.hostname.endsWith('{{ site.suffix }}') &&
!document.location.hostname.endsWith('{{ site.suffix }}.')){
document.title = document.title.replace(/(清华)|(tsinghua)|(tuna)/gi, '');
$().ready(() => {
$(document.body).addClass('nonthu');
})
}
{% endif %}