make string.endsWith compatible with IE

Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
This commit is contained in:
Miao Wang 2019-05-22 14:47:46 +08:00
parent befaa17357
commit 1e262352d9
No known key found for this signature in database
GPG Key ID: B031E3CA7BFED96E
2 changed files with 8 additions and 1 deletions

0
static/js/bootstrap-select.min.js vendored Executable file → Normal file
View File

View File

@ -1,10 +1,17 @@
---
---
{% 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(function(){
$().ready(() => {
$(document.body).addClass('nonthu');
})
}