לדלג לתוכן

מדיה ויקי:Gadget-UserMessages.js: הבדלים בין גרסאות בדף

מתוך צפונות ויקי
מ שיפור של קיפודנחש. תודה!
מ שדרוג נוסף של קיפודנחש
שורה 3: שורה 3:
// itemized list of templates. "title" is section title,  
// itemized list of templates. "title" is section title,  
// the first item is the template and the second is the tooltip.
// the first item is the template and the second is the tooltip.
var uTemplate = [
var uTemplate_registered = [
   {title: 'אזהרות', templates: [
   {title: 'אזהרות', templates: [
['אזהרה', 'אזהרה'],
['אזהרה לרשום', 'אזהרה'],
['הבל', 'הבל'],
['הבל', 'הבל'],
['העתקה', 'העתקה'],
['העתקה', 'העתקה'],
שורה 11: שורה 11:
['נחסמת', 'נחסמת'],
['נחסמת', 'נחסמת'],
['אזהרת תמונות2', 'אזהרת תמונות2'],
['אזהרת תמונות2', 'אזהרת תמונות2'],
['לא כאן', 'לא כאן'],
['תלונה', 'תלונה'],
['לך', 'לך'],
['לך', 'לך'],
['חזרה על עריכה', 'חזרה על עריכה'],
['שגיאה', 'שגיאה']
   ]},
   ]},
   {title: 'הודעות', templates: [
   {title: 'הודעות', templates: [
שורה 21: שורה 21:
['בוטל', 'בוטל'],
['בוטל', 'בוטל'],
['פרסומת', 'פרסומת'],
['פרסומת', 'פרסומת'],
['חזרה על עריכה', 'חזרה על עריכה'],
['קישור מבוטל', 'קישור מבוטל'],
['קישור מבוטל', 'קישור מבוטל'],
['לא כאן', 'לא כאן']
   ]},
   ]},
   {title: 'הסברים', templates: [
   {title: 'הסברים', templates: [
['אוטוביוגרפיה', 'אוטוביוגרפיה'],
['אוטוביוגרפיה', 'אוטוביוגרפיה'],
['שגיאה', 'שגיאה'],
['טעות', 'טעות'],
['טעות', 'טעות'],
['הסבר', 'הסבר'],
['הסבר', 'הסבר'],
שורה 40: שורה 39:
['ויקיזציה', 'ויקיזציה'],
['ויקיזציה', 'ויקיזציה'],
['זכות הצבעה', 'זכות הצבעה'],
['זכות הצבעה', 'זכות הצבעה'],
['מילון', 'מילון'],
['מילון', 'מילון']
['כניסה לחשבונך', 'כניסה לחשבונך'],
  ]},
  {title: 'תודות', templates: [
['תודה לרשום', 'תודה לרשום']
  ]}
]
var uTemplate_anon = [
  {title: 'אזהרות', templates: [
['אזהרה', 'אזהרה'],
['הבל', 'הבל'],
['העתקה', 'העתקה'],
['נחסמת', 'נחסמת'],
['אזהרת תמונות2', 'אזהרת תמונות2'],
['לא כאן', 'לא כאן'],
['תלונה', 'תלונה'],
['לך', 'לך'],
['שגיאה', 'שגיאה']
  ]},
  {title: 'הודעות', templates: [
['ניסויים', 'ניסויים'],
['נמחק ניסויים', 'נמחק ניסויים'],
['נמחק', 'נמחק'],
['בוטל', 'בוטל'],
['פרסומת', 'פרסומת'],
['חזרה על עריכה', 'חזרה על עריכה'],
['קישור מבוטל', 'קישור מבוטל']
  ]},
  {title: 'הסברים', templates: [
['טעות', 'טעות'],
['הסבר', 'הסבר'],
['נייטרליות', 'נייטרליות'],
['סגנון', 'סגנון'],
['שימוש בדף השיחה', 'שימוש בדף השיחה'],
['כבר קיים', 'כבר קיים'],
['התנחלות', 'התנחלות'],
['ויקיזציה', 'ויקיזציה'],
['מילון', 'מילון']
   ]},
   ]},
   {title: 'תודות', templates: [
   {title: 'תודות', templates: [
['תודה', 'תודה'],
['תודה', 'תודה'],
['הזמנה', 'הזמנה'],
['הזמנה', 'הזמנה']
   ]}
   ]}
]
]
 
var template_requires_params = ['כבר קיים', 'בוטל', 'לא כאן', 'הסבר'];
 
// Add template to user talk page
// Add template to user talk page
function template_addTemplate(template) {
function template_addTemplate(template) {
שורה 57: שורה 94:
document.editform.wpTextbox1.value += "\n{{subst:" + template + "}} ~~" + "~~";
document.editform.wpTextbox1.value += "\n{{subst:" + template + "}} ~~" + "~~";
document.editform.wpSummary.value = 'מוסיף תבנית "' + template + '" ליידוע המשתמש.';
document.editform.wpSummary.value = 'מוסיף תבנית "' + template + '" ליידוע המשתמש.';
if ((typeof template_autosave == "undefined") || template_autosave)  
if ($.inArray(template, template_requires_params) + 1) {// not found returns -1.
document.editform.wpTextbox1.scrollTop = document.editform.wpTextbox1.scrollHeight;
return;
}
if ((typeof template_autosave == "undefined") || template_autosave)
document.editform.wpSave.click();
document.editform.wpSave.click();
}
}
 
function template_is_anon() {
return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(wgTitle);
}
 
function template_onload() {
function template_onload() {
addPortletLink('p-tb', '', ''); // create a little space.
addPortletLink('p-tb', '', ''); // create a little space.
var uTemplate = template_is_anon() ? uTemplate_anon : uTemplate_registered;
for (var i in uTemplate) {
for (var i in uTemplate) {
var part = uTemplate[i];
var part = uTemplate[i];
addPortletLink('p-tb', '', '== ' + part.title + ' ==');
var title = addPortletLink('p-tb', 'javascript:return false;', part.title);
refs = title.getElementsByTagName('a');
if (refs.length > 0)
$.extend(refs[0].style, {color:'black', cursor:'default', fontSize:'1.2em',textDecoration:'underline', fontWeight:'bold'});
var templates = part.templates;
var templates = part.templates;
templates.sort(function (a,b){return a==b?0:(a[0]>b[0] ? 1 : -1);});
templates.sort(function (a,b){return a==b?0:(a[0]>b[0] ? 1 : -1);});

גרסה מ־18:57, 13 באפריל 2011

/* adds to the toolbox a list of templates to add in talkpages. */
 
// itemized list of templates. "title" is section title, 
// the first item is the template and the second is the tooltip.
var uTemplate_registered = [
   {title: 'אזהרות', templates: [
		['אזהרה לרשום', 'אזהרה'],
		['הבל', 'הבל'],
		['העתקה', 'העתקה'],
		['שם פוגעני', 'שם פוגעני'],
		['נחסמת', 'נחסמת'],
		['אזהרת תמונות2', 'אזהרת תמונות2'],
		['לך', 'לך'],
		['חזרה על עריכה', 'חזרה על עריכה'],
		['שגיאה', 'שגיאה']
   ]},
   {title: 'הודעות', templates: [
		['ניסויים', 'ניסויים'],
		['נמחק ניסויים', 'נמחק ניסויים'],
		['נמחק', 'נמחק'],
		['בוטל', 'בוטל'],
		['פרסומת', 'פרסומת'],
		['קישור מבוטל', 'קישור מבוטל'],
		['לא כאן', 'לא כאן']
   ]},
   {title: 'הסברים', templates: [
		['אוטוביוגרפיה', 'אוטוביוגרפיה'],
		['טעות', 'טעות'],
		['הסבר', 'הסבר'],
		['נייטרליות', 'נייטרליות'],
		['סגנון', 'סגנון'],
		['שימוש בדף השיחה', 'שימוש בדף השיחה'],
		['תמונה מוגנת', 'תמונה מוגנת'],
		['מחיקת תמונה', 'מחיקת תמונה'],
		['מקור תמונה', 'מקור תמונה'],
		['הנחיות תמונה', 'הנחיות תמונה'],
		['כבר קיים', 'כבר קיים'],
		['התנחלות', 'התנחלות'],
		['ויקיזציה', 'ויקיזציה'],
		['זכות הצבעה', 'זכות הצבעה'],
		['מילון', 'מילון']
   ]},
   {title: 'תודות', templates: [
		['תודה לרשום', 'תודה לרשום']
   ]}
]
 
var uTemplate_anon = [
   {title: 'אזהרות', templates: [
		['אזהרה', 'אזהרה'],
		['הבל', 'הבל'],
		['העתקה', 'העתקה'],
		['נחסמת', 'נחסמת'],
		['אזהרת תמונות2', 'אזהרת תמונות2'],
		['לא כאן', 'לא כאן'],
		['תלונה', 'תלונה'],
		['לך', 'לך'],
		['שגיאה', 'שגיאה']
   ]},
   {title: 'הודעות', templates: [
		['ניסויים', 'ניסויים'],
		['נמחק ניסויים', 'נמחק ניסויים'],
		['נמחק', 'נמחק'],
		['בוטל', 'בוטל'],
		['פרסומת', 'פרסומת'],
		['חזרה על עריכה', 'חזרה על עריכה'],
		['קישור מבוטל', 'קישור מבוטל']
   ]},
   {title: 'הסברים', templates: [
		['טעות', 'טעות'],
		['הסבר', 'הסבר'],
		['נייטרליות', 'נייטרליות'],
		['סגנון', 'סגנון'],
		['שימוש בדף השיחה', 'שימוש בדף השיחה'],
		['כבר קיים', 'כבר קיים'],
		['התנחלות', 'התנחלות'],
		['ויקיזציה', 'ויקיזציה'],
		['מילון', 'מילון']
   ]},
   {title: 'תודות', templates: [
		['תודה', 'תודה'],
		['הזמנה', 'הזמנה']
   ]}
]

var template_requires_params = ['כבר קיים', 'בוטל', 'לא כאן', 'הסבר'];

// Add template to user talk page
function template_addTemplate(template) {
	if (!document.editform && !getParamValue('autoinsert_template')) {
		var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
		document.location = editlk + '&autoinsert_template=' + template;	
	}
	document.editform.wpTextbox1.value += "\n{{subst:" + template + "}} ~~" + "~~";
	document.editform.wpSummary.value = 'מוסיף תבנית "' + template + '" ליידוע המשתמש.';
	if ($.inArray(template, template_requires_params) + 1) {// not found returns -1.
		document.editform.wpTextbox1.scrollTop = document.editform.wpTextbox1.scrollHeight;
		return;
	}
	if ((typeof template_autosave == "undefined") || template_autosave)
		document.editform.wpSave.click();
}

function template_is_anon() {
	return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(wgTitle);
}

function template_onload() {
	addPortletLink('p-tb', '', ''); // create a little space.
	var uTemplate = template_is_anon() ? uTemplate_anon : uTemplate_registered;
	for (var i in uTemplate) {
		var part = uTemplate[i];
		var title = addPortletLink('p-tb', 'javascript:return false;', part.title);
		refs = title.getElementsByTagName('a');
		if (refs.length > 0)
			$.extend(refs[0].style, {color:'black', cursor:'default', fontSize:'1.2em',textDecoration:'underline', fontWeight:'bold'});
		var templates = part.templates;
		templates.sort(function (a,b){return a==b?0:(a[0]>b[0] ? 1 : -1);});
		for (var i in templates) {
			var t = templates[i][0], c = templates[i][1];
			addPortletLink('p-tb', 'javascript:template_addTemplate("' + t + '")', t, null, c);
		}
	}
	if (getParamValue('autoinsert_template'))
		template_addTemplate(getParamValue('autoinsert_template'));
}
 
if (wgNamespaceNumber == 3)  //NS_USERTALK
	addOnloadHook(template_onload);