Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to handle tags that contain "|"

About: EXHentai标签完全汉化
ぬ
edited October 11 in Script Discussions [?]

I recommend that you modify the function to accommodate tags like "yuri | lesbians" as follows.

function changeTags(id, tags) { //翻译标签
var divTagList = document.getElementById(id);
var aTags = divTagList.querySelectorAll("a");
for (var i in aTags) {
var fixedTag = aTags[i].innerHTML;
if (fixedTag.indexOf(' |') != -1) {
fixedTag = aTags[i].innerHTML.substring(0,aTags[i].innerHTML.indexOf(" |"));
}
if (tags[fixedTag] != null) {
aTags[i].innerHTML = tags[fixedTag];
}
}
}

Comments

Sign In or Register to comment.