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

מתוך ויקישיבה
קפיצה לניווט קפיצה לחיפוש
אין תקציר עריכה
אין תקציר עריכה
שורה 1: שורה 1:
/* כל סקריפט JavaScript שנכתב כאן ירוץ עבור כל המשתמשים בכל טעינת עמוד */
/* כל סקריפט JavaScript שנכתב כאן ירוץ עבור כל המשתמשים בכל טעינת עמוד */


(function closeYeshivaSidebar() {
(function closeYeshivaSidebar(){
    var ns = mw.config.get('wgNamespaceNumber');
  var ns = mw.config.get('wgNamespaceNumber');
    if (ns == 106 || ns == 107 || ns == 108 || ns == 109) {
  if(ns==106 || ns==107 || ns==108 || ns==109){
        var tit = $('#p-yeshiva\\.org\\.il-label');
      var tit = $('#p-yeshiva\\.org\\.il-label');
        tit.click(function () { $(this).siblings('div').toggle(); });
      tit.click(function(){$(this).siblings('div').toggle();});
        tit.css("cursor", "pointer");
      tit.css("cursor","pointer");
        tit.siblings('div').hide();
      tit.siblings('div').hide();
    }
  }
})();
})();


/*במקור מויקיפדיה*/
/*במקור מויקיפדיה*/
var s = document.createElement('script');
  var s = document.createElement('script');
var url = wgScript + '?action=raw&ctype=text/javascript&title=' + "MediaWiki:Edittoolbar.js";
  var url = wgScript + '?action=raw&ctype=text/javascript&title=' + "MediaWiki:Edittoolbar.js";
s.setAttribute('src', url);
  s.setAttribute('src',url);
s.setAttribute('type', 'text/javascript');
  s.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(s);
  document.getElementsByTagName('head')[0].appendChild(s);


//importScript("MediaWiki:Edittoolbar.js");
//importScript("MediaWiki:Edittoolbar.js");


var m = document.createElement('script');
  var m = document.createElement('script');
var murl = wgScript + '?action=raw&ctype=text/javascript&title=' + "MediaWiki:Makor.js";
  var murl = wgScript + '?action=raw&ctype=text/javascript&title=' + "MediaWiki:Makor.js";
m.setAttribute('src', murl);
  m.setAttribute('src',murl);
m.setAttribute('type', 'text/javascript');
  m.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(m);
  document.getElementsByTagName('head')[0].appendChild(m);




function writeUs() {
function writeUs() {
    window.open('http://www.yeshiva.org.il/problems/send.asp?refer=' + document.URL.replace('&', '\*').replace('\'', '').replace('\"', ''), '', 'scrollbars=1,resizable=1,width=345,height=410');
window.open('http://www.yeshiva.org.il/problems/send.asp?refer='+document.URL.replace('&','\*').replace('\'','').replace('\"',''),'','scrollbars=1,resizable=1,width=345,height=410');
}
}


// WikiEditor adaption
// WikiEditor adaption
var customizeToolbar = function () {
var customizeToolbar = function() {
    //window.addEventListener("load", function (){
window.addEventListener("load", function (){
    //$(document).ready( function() {
//$(document).ready( function() {
    console.log('load ready');
console.log('load ready');
    $('#wpTextbox1').wikiEditor('addToToolbar', {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
'section': 'main',
        'groups': {
'groups': {
            'yeshiva': {
'yeshiva': {
                'label': 'ישיבה' // or use labelMsg for a localized label, see above
'label': 'ישיבה' // or use labelMsg for a localized label, see above
            }
}
        }
}
    });
} );
    $('#wpTextbox1').wikiEditor('addToToolbar', {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {  
        'section': 'main',
'section': 'main',
        'group': 'yeshiva',
'group': 'yeshiva',
        'tools': {
'tools': {
            'source': {
'source': {
                label: 'מקור!', // or use labelMsg for a localized label, see above
label: 'מקור!', // or use labelMsg for a localized label, see above
                type: 'button',
type: 'button',
                icon: "/wiki/images/ToolbarIcons/Button_makor.png",
icon: "/wiki/images/ToolbarIcons/Button_makor.png",
                action: {
action: {
                    type: 'callback',
type: 'callback',
                    execute: function (context) {
execute: function(context){
                        window.makorContext = context;
                                                window.makorContext = context;
                        popupMakor();
                                                popupMakor();
                    }
}
                }
}
            },
},
            'source-title': {
'source-title': {
                label: 'מראה מקומות', // or use labelMsg for a localized label, see above
label: 'מראה מקומות', // or use labelMsg for a localized label, see above
                type: 'button',
type: 'button',
                icon: "/wiki/images/ToolbarIcons/chapter.png",
icon: "/wiki/images/ToolbarIcons/chapter.png",
                action: {
action: {
                    type: 'encapsulate',
                                        type: 'encapsulate',
                    options: {
                                        options: {
                        pre: '==',
                                                pre: '==',
                        peri: 'מראה מקומות',
                                                peri: 'מראה מקומות',
                        post: '=='
                                                post: '=='
                    }
                                        }
                }
}
            },
},
            'have-question': wgNamespaceNumber === 106 ? {
'have-question':wgNamespaceNumber===106?{
                label: 'ערך המכיל שאלה', // or use labelMsg for a localized label, see above
label: 'ערך המכיל שאלה', // or use labelMsg for a localized label, see above
                type: 'button',
type: 'button',
                icon: "/wiki/images/ToolbarIcons/talk-icon.png",
icon: "/wiki/images/ToolbarIcons/talk-icon.png",
                action: {
action: {
                    type: 'encapsulate',
                                        type: 'encapsulate',
                    options: {
                                        options: {
                        pre: '{{',
                                                pre: '{{',
                        peri: 'תבנית:ערך_המכיל_שאלות',
                                                peri: 'תבנית:ערך_המכיל_שאלות',
                        post: '}}'
                                                post: '}}'
                    }
                                        }
                }
}
            } : {}
}:{}
        }
}
    });
} );
//}
});};
);};
 
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
    mw.loader.using('user.options', function () {
mw.loader.using( 'user.options', function () {
        // This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
        if (mw.user.options.get('usebetatoolbar') == 1) {
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
            $.when(
$.when(
                mw.loader.using('ext.wikiEditor.toolbar'), $.ready
mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
            ).then(customizeToolbar);
).then( customizeToolbar );
        }
}
    });
} );
}
}
/* EDIT TEST */
/* EDIT TEST */
// Add the customizations to LiquidThreads' edit toolbar, if available
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook('ext.lqt.textareaCreated').add(customizeToolbar);
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );


mw.user.options.get('usebetatoolbar');
mw.user.options.get( 'usebetatoolbar' );


function CustomButtons(cbPath, cbTip, cbTago, cbTagc, cbStext) {
function CustomButtons(cbPath,cbTip,cbTago,cbTagc,cbStext)
    var button = {
{
        "imageFile": cbPath,
  var button = {
        "speedTip": cbTip,
"imageFile": cbPath,
        "tagOpen": cbTago,
"speedTip": cbTip,
        "tagClose": cbTagc,
"tagOpen": cbTago,
        "sampleText": cbStext
"tagClose": cbTagc,
    };
"sampleText": cbStext
  };


     if (mw.toolbar) {
     if ( mw.toolbar ) {
         mw.toolbar.addButton(button);
         mw.toolbar.addButton(button);
        //mwCustomEditButtons.push();
      //mwCustomEditButtons.push();
     }
     }
}
}
CustomButtons("images/c/c8/Button_redirect.png", "דף הפניה", "#הפניה [[", "]]", "הערך המופנה");
CustomButtons("images/c/c8/Button_redirect.png","דף הפניה","#הפניה [[","]]","הערך המופנה");
CustomButtons("images/d/db/Button_strikeout.png", "מחיקת טקסט", "<s>", "</s>", "טקסט מחוק");
CustomButtons("images/d/db/Button_strikeout.png","מחיקת טקסט","<s>","</s>","טקסט מחוק");
CustomButtons("images/c/c4/Button_ref.png", "הערת שוליים", "<ref>", "</ref>", "הערת שוליים");
CustomButtons("images/c/c4/Button_ref.png","הערת שוליים","<ref>","</ref>","הערת שוליים");

גרסה מ־14:29, 10 במאי 2022

/* כל סקריפט JavaScript שנכתב כאן ירוץ עבור כל המשתמשים בכל טעינת עמוד */

(function closeYeshivaSidebar(){
   var ns = mw.config.get('wgNamespaceNumber');
   if(ns==106 || ns==107 || ns==108 || ns==109){
      var tit = $('#p-yeshiva\\.org\\.il-label');
      tit.click(function(){$(this).siblings('div').toggle();});
      tit.css("cursor","pointer");
      tit.siblings('div').hide();
   }
})();

/*במקור מויקיפדיה*/
   var s = document.createElement('script');
   var url = wgScript + '?action=raw&ctype=text/javascript&title=' + "MediaWiki:Edittoolbar.js";
   s.setAttribute('src',url);
   s.setAttribute('type','text/javascript');
   document.getElementsByTagName('head')[0].appendChild(s);

//importScript("MediaWiki:Edittoolbar.js");

   var m = document.createElement('script');
   var murl = wgScript + '?action=raw&ctype=text/javascript&title=' + "MediaWiki:Makor.js";
   m.setAttribute('src',murl);
   m.setAttribute('type','text/javascript');
   document.getElementsByTagName('head')[0].appendChild(m);


function writeUs() {
window.open('http://www.yeshiva.org.il/problems/send.asp?refer='+document.URL.replace('&','\*').replace('\'','').replace('\"',''),'','scrollbars=1,resizable=1,width=345,height=410');
}

// WikiEditor adaption
var customizeToolbar = function() {
window.addEventListener("load", function (){
//$(document).ready( function() {
console.log('load ready');
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'main',
	'groups': {
		'yeshiva': {
			'label': 'ישיבה' // or use labelMsg for a localized label, see above
		}
	}
} );
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 
		'section': 'main',
		'group': 'yeshiva',
		'tools': {
			'source': {
				label: 'מקור!', // or use labelMsg for a localized label, see above
				type: 'button',
				icon: "/wiki/images/ToolbarIcons/Button_makor.png",
				action: {
					type: 'callback',
					execute: function(context){
                                                window.makorContext = context;
                                                popupMakor();
					}
				}
			},
			'source-title': {
				label: 'מראה מקומות', // or use labelMsg for a localized label, see above
				type: 'button',
				icon: "/wiki/images/ToolbarIcons/chapter.png",
				action: {
                                        type: 'encapsulate',
                                        options: {
                                                 pre: '==',
                                                 peri: 'מראה מקומות',
                                                 post: '=='
                                        }
				}
			},
			'have-question':wgNamespaceNumber===106?{
				label: 'ערך המכיל שאלה', // or use labelMsg for a localized label, see above
				type: 'button',
				icon: "/wiki/images/ToolbarIcons/talk-icon.png",
				action: {
                                        type: 'encapsulate',
                                        options: {
                                                 pre: '{{',
                                                 peri: 'תבנית:ערך_המכיל_שאלות',
                                                 post: '}}'
                                        }
				}
			}:{}
		}
	} );
});};
 
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	mw.loader.using( 'user.options', function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
			).then( customizeToolbar );
		}
	} );
}
/* EDIT TEST */
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );

mw.user.options.get( 'usebetatoolbar' );

function CustomButtons(cbPath,cbTip,cbTago,cbTagc,cbStext)
{
   var button = {
	"imageFile": cbPath,
	"speedTip": cbTip,
	"tagOpen": cbTago,
	"tagClose": cbTagc,
	"sampleText": cbStext
   };

    if ( mw.toolbar ) {
        mw.toolbar.addButton(button);
       //mwCustomEditButtons.push();
    }
}
CustomButtons("images/c/c8/Button_redirect.png","דף הפניה","#הפניה [[","]]","הערך המופנה");
CustomButtons("images/d/db/Button_strikeout.png","מחיקת טקסט","<s>","</s>","טקסט מחוק");
CustomButtons("images/c/c4/Button_ref.png","הערת שוליים","<ref>","</ref>","הערת שוליים");