Fix: wordmute/emp

This commit is contained in:
Cutls 2019-06-16 21:52:41 +09:00
parent cd65bd4c2a
commit c15625c063
6 changed files with 11 additions and 9 deletions

View File

@ -191,7 +191,7 @@ function emojiInsert(code, del) {
$("#textarea").val(newt); $("#textarea").val(newt);
//emoji(); //emoji();
} else { } else {
var regExp = new RegExp(del, "g"); var regExp = new RegExp(del.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
var now = now.replace(regExp, ""); var now = now.replace(regExp, "");
$("#textarea").val(now + brank + code); $("#textarea").val(now + brank + code);
} }

View File

@ -131,7 +131,7 @@ function tagInsert(code, del) {
var selin = $("#textarea").prop('selectionStart'); var selin = $("#textarea").prop('selectionStart');
if (!del) { if (!del) {
} else { } else {
var regExp = new RegExp(del, "g"); var regExp = new RegExp(del.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
var now = now.replace(regExp, ""); var now = now.replace(regExp, "");
selin = selin - del.length; selin = selin - del.length;
} }

View File

@ -370,7 +370,7 @@ function filterUpdateInternal(json, type) {
var text = $(elem).find('.toot').html(); var text = $(elem).find('.toot').html();
Object.keys(home).forEach(function (key8) { Object.keys(home).forEach(function (key8) {
var word = home[key8]; var word = home[key8];
var regExp = new RegExp(word, "g"); var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
if ($.strip_tags(text).match(regExp)) { if ($.strip_tags(text).match(regExp)) {
$("[toot-id=" + id + "]").addClass("hide"); $("[toot-id=" + id + "]").addClass("hide");
} }
@ -386,6 +386,7 @@ function filterUpdateInternal(json, type) {
*/ */
//通知フィルター //通知フィルター
function exclude(key) { function exclude(key) {
localStorage.setItem("exclude-" + key, "")
var excludetxt = localStorage.getItem("exclude-" + key); var excludetxt = localStorage.getItem("exclude-" + key);
if ($('#exc-reply-' + key + ':checked').val()) { if ($('#exc-reply-' + key + ':checked').val()) {
excludetxt = "?exclude_types[]=mention" excludetxt = "?exclude_types[]=mention"

View File

@ -590,7 +590,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} else { } else {
var word = worde var word = worde
} }
var regExp = new RegExp(word, "g"); var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
if ($.strip_tagstemp(content).match(regExp)) { if ($.strip_tagstemp(content).match(regExp)) {
boostback = "hide by_filter"; boostback = "hide by_filter";
} }
@ -603,7 +603,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var word = wordemp[key9]; var word = wordemp[key9];
if (word) { if (word) {
var word = word.tag; var word = word.tag;
var regExp = new RegExp(word, "g"); var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
content = content.replace(regExp, '<span class="emp">' + word + "</span>"); content = content.replace(regExp, '<span class="emp">' + word + "</span>");
} }
}); });

View File

@ -733,7 +733,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
} else { } else {
var word = worde var word = worde
} }
var regExp = new RegExp(word, "g"); var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
console.log(regExp)
if ($.strip_tags(content).match(regExp)) { if ($.strip_tags(content).match(regExp)) {
boostback = "hide by_filter"; boostback = "hide by_filter";
} }
@ -746,7 +747,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
var word = wordemp[key9]; var word = wordemp[key9];
if (word) { if (word) {
var word = word.tag; var word = word.tag;
var regExp = new RegExp(word, "g"); var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
content = content.replace(regExp, '<span class="emp">' + word + "</span>"); content = content.replace(regExp, '<span class="emp">' + word + "</span>");
} }
}); });

View File

@ -171,7 +171,7 @@ function wordmute() {
}); });
} }
function wordmuteSave() { function wordmuteSave() {
var word = $('#wordmute').material_chip('data'); var word = M.Chips.getInstance($("#wordmute")).chipsData;
var json = JSON.stringify(word); var json = JSON.stringify(word);
localStorage.setItem("word_mute", json); localStorage.setItem("word_mute", json);
} }
@ -185,7 +185,7 @@ function wordemp() {
}); });
} }
function wordempSave() { function wordempSave() {
var word = $('#wordemp').material_chip('data'); var word = M.Chips.getInstance($("#wordemp")).chipsData;
var json = JSON.stringify(word); var json = JSON.stringify(word);
localStorage.setItem("word_emp", json); localStorage.setItem("word_emp", json);
} }