.manuscript-analyzer {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background: white;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.manuscript-analyzer h2 {
text-align: center;
color: #333;
margin-bottom: 20px;
}
.manuscript-analyzer textarea {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 4px;
height: 150px;
resize: vertical;
box-sizing: border-box;
}
.manuscript-analyzer button {
width: 100%;
padding: 10px;
background: #0066cc;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
margin: 10px 0;
}
.manuscript-analyzer button:hover {
background: #005bb5;
}
.manuscript-analyzer #result {
display: none;
}
.manuscript-analyzer .result-section {
margin-top: 20px;
}
.manuscript-analyzer .result-section h3 {
color: #0066cc;
margin-bottom: 15px;
}
.manuscript-analyzer #loadingMessage {
display: none;
color: gray;
text-align: center;
margin: 10px 0;
}
.manuscript-analyzer .analysis-block {
background: #f8f9fa;
padding: 15px;
border-radius: 4px;
margin-bottom: 15px;
}
function analyzeManuscript() {
const manuscript = document.getElementById('manuscript').value.trim();
const loadingMessage = document.getElementById('loadingMessage');
const analyzeButton = document.getElementById('analyzeButton');
const result = document.getElementById('result');
if (!manuscript) {
alert("Please enter your manuscript text.");
return;
}
// Reset and show loading state
result.style.display = 'none';
loadingMessage.style.display = 'block';
analyzeButton.disabled = true;
// Simulate analysis delay
setTimeout(() => {
const analysis = performDetailedAnalysis(manuscript);
displayDetailedResults(analysis);
loadingMessage.style.display = 'none';
analyzeButton.disabled = false;
}, 1500);
}
function performDetailedAnalysis(text) {
return {
content: analyzeContent(text),
style: analyzeWritingStyle(text),
market: analyzeMarketPotential(text),
recommendations: generateDynamicRecommendations(text)
};
}
function analyzeContent(text) {
const words = text.split(/\s+/).filter(w => w.trim());
const sentences = text.split(/[.!?]+/).filter(s => s.trim());
const paragraphs = text.split(/\n\n/).filter(p => p.trim());
return {
wordCount: words.length,
sentenceCount: sentences.length,
paragraphCount: paragraphs.length,
averageWordsPerSentence: (words.length / sentences.length || 0).toFixed(2),
detectedThemes: identifyThemes(text),
};
}
function analyzeWritingStyle(text) {
const words = text.split(/\s+/).filter(w => w.trim());
const uniqueWords = new Set(words.map(w => w.toLowerCase()));
return {
complexity: words.length / uniqueWords.size < 2 ? "Simple" : "Rich",
dominantTone: detectTone(text),
};
}
function analyzeMarketPotential(text) {
const genre = determineGenre(text);
return {
mainGenre: genre.mainGenre,
subgenre: genre.subgenre,
potentialAudience: genre.audienceSize || "Unknown",
};
}
function generateDynamicRecommendations(text) {
const themes = identifyThemes(text);
const genre = determineGenre(text);
const suggestionTemplates = [
`Focus on enhancing the ${themes[0] || 'main'} theme to create a more engaging storyline.`,
`Explore the characters' emotions and motivations to add depth to the ${themes[0] || 'core'} theme.`,
`Consider adding a subplot related to ${themes[1] || 'a secondary'} theme for richer storytelling.`,
];
const marketingTemplates = [
`This manuscript shows potential for a ${genre.mainGenre} market. Consider targeting readers who enjoy ${genre.subgenre} stories.`,
`Based on the ${themes[0] || 'main'} theme, the book could appeal to audiences looking for ${genre.mainGenre} novels.`,
`Develop marketing strategies around the ${genre.subgenre} elements to attract a niche audience.`,
];
const evaluationTemplates = [
`With ${genre.audienceSize} market potential, the book could perform well in the ${genre.mainGenre} category.`,
`The manuscript demonstrates a ${detectTone(text)} tone, which resonates well with the ${genre.subgenre} genre.`,
`The richness of the language and focus on ${themes[0] || 'the primary'} theme enhance its marketability.`,
];
const suggestions = getRandomElements(suggestionTemplates, 2);
const marketingInsights = getRandomElements(marketingTemplates, 2);
const performanceEvaluations = getRandomElements(evaluationTemplates, 2);
return [
`Expert Suggestions: ${suggestions.join('
')}`, `Marketing Insights: ${marketingInsights.join('
')}`, `Performance Evaluation: ${performanceEvaluations.join('
')}`, ].join('
'); } function identifyThemes(text) { const themeKeywords = { adventure: ["journey", "explore", "quest"], romance: ["love", "relationship", "heart"], mystery: ["mystery", "secret", "detective"], }; const themeScores = {}; const lowerText = text.toLowerCase(); for (const [theme, keywords] of Object.entries(themeKeywords)) { const count = keywords.reduce((acc, word) => acc + (lowerText.split(word).length - 1), 0); if (count > 0) themeScores[theme] = count; } return Object.keys(themeScores).sort((a, b) => themeScores[b] - themeScores[a]); } function determineGenre(text) { const genreKeywords = { fantasy: ["magic", "kingdom", "dragon"], sciFi: ["space", "robot", "future"], romance: ["love", "relationship", "passion"], }; const detectedGenre = Object.keys(genreKeywords).find(genre => { return genreKeywords[genre].some(keyword => text.toLowerCase().includes(keyword)); }) || "General"; const audienceSize = ["Small", "Medium", "Large"][Math.floor(Math.random() * 3)]; return { mainGenre: detectedGenre, subgenre: "Standard", audienceSize }; } function detectTone(text) { if (text.includes("!") || text.includes("adventure")) return "Exciting"; if (text.includes("love") || text.includes("heart")) return "Emotional"; return "Neutral"; } function getRandomElements(array, count) { return array.sort(() => 0.5 - Math.random()).slice(0, count); } function displayDetailedResults(analysis) { document.getElementById('result').style.display = "block"; document.getElementById('contentAnalysis').innerHTML = `Content: ${JSON.stringify(analysis.content, null, 2)}`; document.getElementById('styleAnalysis').innerHTML = `Style: ${JSON.stringify(analysis.style, null, 2)}`; document.getElementById('marketAnalysis').innerHTML = `Market Potential: ${JSON.stringify(analysis.market, null, 2)}`; document.getElementById('recommendations').innerHTML = analysis.recommendations; }
Book Manuscript Analyser
Analyzing your manuscript...
Detailed Analysis
')}`, `Marketing Insights: ${marketingInsights.join('
')}`, `Performance Evaluation: ${performanceEvaluations.join('
')}`, ].join('
'); } function identifyThemes(text) { const themeKeywords = { adventure: ["journey", "explore", "quest"], romance: ["love", "relationship", "heart"], mystery: ["mystery", "secret", "detective"], }; const themeScores = {}; const lowerText = text.toLowerCase(); for (const [theme, keywords] of Object.entries(themeKeywords)) { const count = keywords.reduce((acc, word) => acc + (lowerText.split(word).length - 1), 0); if (count > 0) themeScores[theme] = count; } return Object.keys(themeScores).sort((a, b) => themeScores[b] - themeScores[a]); } function determineGenre(text) { const genreKeywords = { fantasy: ["magic", "kingdom", "dragon"], sciFi: ["space", "robot", "future"], romance: ["love", "relationship", "passion"], }; const detectedGenre = Object.keys(genreKeywords).find(genre => { return genreKeywords[genre].some(keyword => text.toLowerCase().includes(keyword)); }) || "General"; const audienceSize = ["Small", "Medium", "Large"][Math.floor(Math.random() * 3)]; return { mainGenre: detectedGenre, subgenre: "Standard", audienceSize }; } function detectTone(text) { if (text.includes("!") || text.includes("adventure")) return "Exciting"; if (text.includes("love") || text.includes("heart")) return "Emotional"; return "Neutral"; } function getRandomElements(array, count) { return array.sort(() => 0.5 - Math.random()).slice(0, count); } function displayDetailedResults(analysis) { document.getElementById('result').style.display = "block"; document.getElementById('contentAnalysis').innerHTML = `Content: ${JSON.stringify(analysis.content, null, 2)}`; document.getElementById('styleAnalysis').innerHTML = `Style: ${JSON.stringify(analysis.style, null, 2)}`; document.getElementById('marketAnalysis').innerHTML = `Market Potential: ${JSON.stringify(analysis.market, null, 2)}`; document.getElementById('recommendations').innerHTML = analysis.recommendations; }
AI Hanaz Writers version 1.0 is currently available. Version 2.0, a more advanced and purchasable upgrade, is currently being designed and prepared.

