לדלג לתוכן

מדיה ויקי:Gadget-UserMessages.js

מתוך צפונות ויקי
גרסה מ־18:57, 13 באפריל 2011 מאת wikipedia:he>Matanya (שדרוג נוסף של קיפודנחש)

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
/* 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);