משתמש:Men770/HotDefaultSort.js: הבדלים בין גרסאות בדף
אין תקציר עריכה |
אין תקציר עריכה |
||
(5 גרסאות ביניים של אותו משתמש אינן מוצגות) | |||
שורה 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: 'הוסר {{מיון רגיל}} באמצעות [[User:Men770/HotDefaultSort.js|סקריפט]]' | summary: 'הוסר {{מיון רגיל}} באמצעות [[User:Men770/HotDefaultSort.js|סקריפט]]' | ||
}; | }; | ||
שורה 118: | שורה 121: | ||
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'; | ||
שורה 127: | שורה 130: | ||
save.innerText = '(✓)'; | save.innerText = '(✓)'; | ||
save.style. | save.style.marginRight = '0.25em'; | ||
save.title = 'שמור שינויים'; | save.title = 'שמור שינויים'; | ||
save.addEventListener('click', function() { | save.addEventListener('click', function() { | ||
שורה 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() { | ||
שורה 142: | שורה 145: | ||
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() { | ||
שורה 150: | שורה 153: | ||
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); |