מדיה ויקי:Functions.js

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

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

/* פונקציה המוסיפה כפתור לסרגל הכלים */
function addEditButton( imageFile, tagOpen, sampleText, tagClose, speedTip ) {
   imageFile='//upload.wikimedia.org/'+imageFile;
   if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {
      $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'advanced',
			'group': 'insert',
			'tools': {
				'colouredtext': {
					label: speedTip ,
					type: 'button',
					icon: imageFile,
					action: {
						type: 'encapsulate',
						options: {
							pre: tagOpen,
							peri: sampleText,
							post: tagClose
						}
					}
				}
			}
		} );
}
   else{
 mwCustomEditButtons.push( {
        "imageFile": imageFile,
        "tagOpen": tagOpen,
        "sampleText": sampleText,
        "tagClose": tagClose,
        "speedTip": speedTip
    } );
}
}


/* פונקציה להוספת כפתור לאחד מסרגלי הכלים בממשק, מתוך [[:en:User:Omegatron/monobook.js/addlink.js]] */
function addLink(where, url, name, id, title, key, after) {
    // addLink() accepts either an id or a DOM node, mw.util.addPortletLink() only takes a node
    if (after && !after.cloneNode)
        after = document.getElementById(after);

    return mw.util.addPortletLink(where, url, name, id, title, key, after);
}