const sentiment = Sentiment();
function 检测原创度(event) {
const textValue = document.activeElement.value;
if (sentiment(textValue).score > 90) {
console.log(`内容原创度检测>90%`);
}else{
console.log(`内容需要重新编辑以提高原创度`);
}
}
document.body.addEventListener('input',检测原创度);
console.log(document.body.innerHTML.wordCount());
document.querySelectorAll('article p').forEach(
(item, index) => {
if(item.innerText.split(' ').length > 150){
console.error(`段落长度超过5行,请简化句子或拆分段落`);
}
});
document.querySelectorAll('article p').forEach(
(item, index) => {
const sentimentScore = sentiment(item.innerText);
if(sentimentScore.score < -3 ||
item.innerText.includes('SCVBHFD') ||
item.innerText.includes('BGDFHRTSDVFS')) {
console.error(`存在重复表述或包含专业术语,请替换相关内容`);
}
});
console.log(`将自动替换重复表述`);
document.querySelectorAll('article p').forEach(function(element){
let text = element.textContent;
let changedText;
while (text.includes('SCVBHFD')){
changedText = text.replace('SCVBHFD','新的表述');
text=changedText;
}
element.textContent=changedText;
});
console.log(sentiment(document.body.innerHTML));
for(let i=0; i {
for (let i of document.getElementsByTagName('label')){
console.log(i.textContent.trim());
}
},500);
setTimeout(() => {
for (let i of document.getElementsByTagName('div')){
if(i.className === 'error-style'){
throw new SyntaxError(i.textContent.trim());
}
},
600);
setTimeout(() => {
for (let i of document.getElementsByTagName('div')){
if(i.className === 'success-style'){
console.log(i.textContent.trim());
};
},
700);
setTimeout(() => {
for (let i of document.getElementsByClassName('output-')){
console.log(i.dataset.message)
},
800)
setTimeout(() =>{
window.scrollTo({top:500,left:300});
},
900)
setTimeout(() =>{
const articleBodyContent = article.querySelector('.zotero_article_body');
const dataForTesting={
sourceContent : articleBodyContent.dataset.content,
sourceTitle : articleBodyContent.dataset.title,
sourceSubtitle : articleBodyContent.dataset.subtitle,
sourceAuthor : article.querySelector('.zotero_article_author_division')
? "作者未提供"
: article.querySelector('.zotero_article_author_division').outerHTML
};
localStorage.setItem('currentArticleData', JSON.stringify(dataForTesting));
localStorage.setItem(article.id+'contentData', JSON.stringify(dataForTesting));
localStorage.setItem(article.id+'articleData','{n'+
' "title":"' +articleBodyContent.dataset.title +
'”,n'+
' "subtitle":"' +articleBodyContent.dataset.subtitle +
'”,n'+
' "author":"' +dataForTesting.sourceAuthor +
'”,n'+
' "content":"'+articleBodyContent.dataset.content+
'"}}');
localStorage.setItem(article.id+'_userData','');
},
100000)
}
})();
function restoreState(){
const storedData = localStorage.getItem(this.id+'_userData');
dataForTesting.userData=storedData?JSON.parse('{ "'+this.id+'_userData":"'+localStorage.getItem(this.id+'_userData'),this.content}').data:{};
}