משתמש:Men770/HotDefaultSort.js – הבדלי גרסאות
אין תקציר עריכה |
אין תקציר עריכה |
||
| (6 גרסאות ביניים של אותו משתמש אינן מוצגות) | |||
| שורה 1: | שורה 1: | ||
/*** Hot Default Sort ***/ | /*** Hot Default Sort ***/ | ||
// סקריפט להוספת מיון רגיל בקלות, במקור מויקיפדיה אנגלית, הסבר עליו בדף השיחה כאן. | |||
// Adds an default sort key editor at the bottom of the page near the categories | // Adds an default sort key editor at the bottom of the page near the categories | ||
// Documentation at [[en:w:User:BrandonXLF/HotDefaultSort]] | // Documentation at [[en:w:User:BrandonXLF/HotDefaultSort]] | ||
| שורה 62: | שורה 63: | ||
'\\:.*)' | '\\:.*)' | ||
), | ), | ||
textParts = rev.content.replace(/\n*{{ | textParts = rev.content.replace(/\n*{{מיון רגיל:.*?}}\n*/g, '').split(catRegex), | ||
main = textParts.shift() || '', | main = textParts.shift() || '', | ||
cats = textParts.join(''); | cats = textParts.join(''); | ||
return { | return { | ||
text: main + (main.endsWith('\n') ? '' : '\n\n') + '{{ | text: main + (main.endsWith('\n') ? '' : '\n\n') + '{{מיון רגיל:' + edit.value.trim() + '}}\n' + cats, | ||
summary: ' | summary: '{{מיון רגיל}} שונה ל-' + edit.value + ' באמצעות [[User:Men770/HotDefaultSort.js|סקריפט]]', | ||
bot: true, | |||
minor: true | |||
}; | }; | ||
}).done(function() { | }).done(function() { | ||
| שורה 83: | שורה 86: | ||
return transformPage(function(rev) { | return transformPage(function(rev) { | ||
return { | return { | ||
text: rev.content.replace(/\n*{{ | text: rev.content.replace(/\n*{{מיון רגיל:.*?}}\n*/g, '\n\n'), | ||
summary: ' | summary: 'הוסר {{מיון רגיל}} באמצעות [[User:Men770/HotDefaultSort.js|סקריפט]]' | ||
}; | }; | ||
}).done(function() { | }).done(function() { | ||
dsort.innerText = mw.config.get('wgTitle'); | dsort.innerText = mw.config.get('wgTitle'); | ||
modify.innerText = '(+)'; | modify.innerText = '(+)'; | ||
modify.title = ' | modify.title = 'הוסף'; | ||
remove.style.display = 'none'; | remove.style.display = 'none'; | ||
dflt.style.display = 'inline'; | dflt.style.display = 'inline'; | ||
| שורה 117: | שורה 120: | ||
}); | }); | ||
dflt.innerText = '( | dflt.innerText = '(לא מוגדר)'; | ||
dflt.style. | dflt.style.marginRight = '0.25em'; | ||
dflt.style.display = unset ? 'inline' : 'none'; | dflt.style.display = unset ? 'inline' : 'none'; | ||
dflt.style.fontStyle = 'italic'; | dflt.style.fontStyle = 'italic'; | ||
| שורה 124: | שורה 127: | ||
status.style.marginLeft = '0.25em'; | status.style.marginLeft = '0.25em'; | ||
status.style.display = 'none'; | status.style.display = 'none'; | ||
status.innerText = ' | status.innerText = 'שומר...'; | ||
save.innerText = '(✓)'; | save.innerText = '(✓)'; | ||
save.style. | save.style.marginRight = '0.25em'; | ||
save.title = ' | save.title = 'שמור שינויים'; | ||
save.addEventListener('click', function() { | save.addEventListener('click', function() { | ||
saveEditor(); | saveEditor(); | ||
| שורה 134: | שורה 137: | ||
cancel.innerText = '(x)'; | cancel.innerText = '(x)'; | ||
cancel.style. | cancel.style.marginRight = '0.25em'; | ||
cancel.title = ' | cancel.title = 'ביטול'; | ||
cancel.addEventListener('click', function() { | cancel.addEventListener('click', function() { | ||
closeEditor(); | closeEditor(); | ||
| שורה 141: | שורה 144: | ||
remove.innerText = '(−)'; | remove.innerText = '(−)'; | ||
remove.title = ' | remove.title = 'הסר (החלף עם ברירת המחדל)'; | ||
remove.style. | remove.style.marginRight = '0.25em'; | ||
remove.style.display = unset ? 'none' : 'inline'; | remove.style.display = unset ? 'none' : 'inline'; | ||
remove.addEventListener('click', function() { | remove.addEventListener('click', function() { | ||
| שורה 149: | שורה 152: | ||
modify.innerText = unset ? '(+)' : '(±)'; | modify.innerText = unset ? '(+)' : '(±)'; | ||
modify.title = unset ? ' | modify.title = unset ? 'הוסף' : 'שנה'; | ||
modify.style. | modify.style.marginRight = '0.25em'; | ||
modify.addEventListener('click', function() { | modify.addEventListener('click', function() { | ||
sort.replaceChild(edit, dsort); | sort.replaceChild(edit, dsort); | ||