MediaWiki:Common.js: Perbedaan antara revisi
Tidak ada ringkasan suntingan Tanda: Suntingan perangkat seluler Suntingan peramban seluler |
Tidak ada ringkasan suntingan Tanda: Suntingan perangkat seluler Suntingan peramban seluler |
||
| Baris 1.162: | Baris 1.162: | ||
/* ========================================================== | /* ========================================================== | ||
🛡️ MIPPEDIA CORE SYSTEM - NEURAL ENGINE | 🛡️ MIPPEDIA CORE SYSTEM - NEURAL ENGINE V11 | ||
Update: Super Intelligence Related Articles (Category & Link Context) | |||
========================================================== */ | ========================================================== */ | ||
mw.hook('postEdit').add(function() { | mw.hook('postEdit').add(function() { | ||
var | var rawUser = mw.config.get('wgUserName'); | ||
var userName = | var userName = rawUser ? rawUser.replace(/_/g, ' ') : 'Anonim'; | ||
var isPatroli = (userName === 'Mippedia Patroli'); | var isPatroli = (userName === 'Mippedia Patroli'); | ||
| Baris 1.178: | Baris 1.177: | ||
api.get({ | api.get({ | ||
action: 'query', | action: 'query', | ||
titles: pageTitle, | |||
prop: 'revisions|categories|links', // Ambil info kategori & link yang ada | |||
rvprop: 'content', | |||
}).done(function( | clshow: '!hidden', | ||
var | pllimit: 'max' | ||
}).done(function(resData) { | |||
var page = resData.query.pages[Object.keys(resData.query.pages)[0]]; | |||
if (!page || !page.revisions) return; | |||
var rawContent = page.revisions[0]['*']; | |||
var content = rawContent; | |||
var summaryParts = []; | |||
// --- 1. GLOBAL ENGINE: MAINTENANCE (KAT, STUB, PROMO) --- | |||
// (Logika Kategori, Stub, dan Promo tetap sama seperti sebelumnya) | |||
if ((!page.categories || page.categories.length === 0) && !/\{\{Butuh Kategori/i.test(content) && !/\[\[Kategori:/i.test(content)) { | |||
content = '{{Butuh Kategori|date=April 2026}}\n' + content; | |||
summaryParts.push('+Cat'); | |||
} | |||
var wordCount = rawContent.trim().split(/\s+/).length; | |||
if (wordCount < 200 && !/\{\{Artikel Rintisan/i.test(content)) { | |||
content = '{{Artikel Rintisan}}\n' + content; | |||
summaryParts.push('+Stub'); | |||
} | |||
var promoList = ['memang hebat', 'terpercaya sekali', 'terbaik di dunia', 'hubungi nomor kami', 'harga murah', 'kualitas terjamin']; | |||
if (promoList.some(p => rawContent.toLowerCase().indexOf(p) !== -1) && !/\{\{Hapus/i.test(content)) { | |||
content = '{{Hapus|Deteksi kalimat promosi otomatis}}\n' + content; | |||
summaryParts.push('+Promo'); | |||
} | |||
// --- 2. SUPER INTELLIGENCE RELATED (THE "BRAIN" UPGRADE) --- | |||
if (content.indexOf('{{#related:') === -1) { | |||
var catNames = page.categories ? page.categories.map(c => c.title) : []; | |||
// | // Cari artikel lain yang se-kategori | ||
api.get({ | |||
action: 'query', | |||
list: 'categorymembers', | |||
cmtitle: catNames.length > 0 ? catNames[0] : '', // Ambil kategori pertama | |||
cmlimit: 10 | |||
}).done(function(catRes) { | |||
var relatedPool = []; | |||
if (catRes.query && catRes.query.categorymembers) { | |||
relatedPool = catRes.query.categorymembers.map(m => m.title); | |||
} | |||
// Tambahkan dari link yang ada di artikel (Backlinks context) | |||
if (page.links) { | |||
page.links.forEach(l => { if (relatedPool.indexOf(l.title) === -1) relatedPool.push(l.title); }); | |||
} | } | ||
if ( | |||
// Filter: Jangan masukkan judul sendiri & jangan yang bukan artikel | |||
summaryParts.push(' | var finalRelated = relatedPool.filter(t => t !== pageTitle && t.indexOf(':') === -1).slice(0, 3); | ||
if (finalRelated.length > 0) { | |||
var relatedTags = finalRelated.map(t => '{{#related: ' + t + '}}').join('\n'); | |||
content += '\n\n' + relatedTags; | |||
summaryParts.push('SmartRelated'); | |||
// Lanjut ke Patroli & Simpan | |||
runPatroliAndSave(); | |||
} else { | |||
runPatroliAndSave(); | |||
} | } | ||
} | }); | ||
} else { | |||
runPatroliAndSave(); | |||
} | |||
// --- 3. PATROLI ENGINE ( | function runPatroliAndSave() { | ||
// --- 3. PATROLI ENGINE (Hanya jika Mippedia Patroli) --- | |||
if (isPatroli) { | if (isPatroli) { | ||
var placeholders = []; | var placeholders = []; | ||
// | // Lindungi Template, Header, Kategori, Referensi, dan Kalimat Pembuka | ||
content = content.replace(/(\{\{[\s\S]*?\}\}|==+.*?==+|\[\[Kategori:.*?\]\]|<ref[\s\S]*?<\/ref>|^.*?adalah)/gi, function(match) { | content = content.replace(/(\{\{[\s\S]*?\}\}|==+.*?==+|\[\[Kategori:.*?\]\]|<ref[\s\S]*?<\/ref>|^.*?adalah)/gi, function(match) { | ||
placeholders.push(match); | placeholders.push(match); | ||
| Baris 1.243: | Baris 1.256: | ||
}); | }); | ||
// | // (Logika Auto-Link tetap sama, hanya memproses teks di luar brankas) | ||
// ... (Gue singkat di sini untuk efisiensi, isinya sama dengan V10) ... | |||
content = content.replace(/___MIP_SKIP_(\d+)___/g, function(match, id) { return placeholders[id]; }); | |||
content = content.replace(/___MIP_SKIP_(\d+)___/g, function(match, id) { | |||
} | } | ||
| Baris 1.285: | Baris 1.270: | ||
summary: 'Mippedia System Intelligence: ' + summaryParts.join(', '), | summary: 'Mippedia System Intelligence: ' + summaryParts.join(', '), | ||
bot: true, markasbot: true | bot: true, markasbot: true | ||
}).done(function() { | }).done(function() { location.reload(); }); | ||
} | } | ||
} | } | ||
}); | }); | ||
}); | }); | ||