// OREN BOCHMAN'S PERSONAL TOOLBAR
// Contains links to the most important pages and some custom accelerators
// Feel free to use it if you like.
// Still in development.
//todo:
//linkify each template.
//create insert action.
//log action.
/* Oren's good tags tool */
mediaWiki.loader.using(['jquery.ui'],function(){
// Add tool for tagging stuff in popups
var link = mw.util.addPortletLink('p-tb', // portletId
'#', // href
'Hot Tags Atrribution', // text
't-HotTagAtrib', // [id]
'Insert atribution Tags', // [tooltip]
'T', // [[access key]]
'#t-print' );
//portlet's click handler
$(link).click(function(event){
event.preventDefault();
// doSomeStuff();
//alert('{{According to whom}},{{Attribution needed}},{{By whom}},{{From whom?}},{{Weasel-inline}},{{Which}},{{Who}}');
//$('<div>').text('{{According to whom}},{{Attribution needed}},{{By whom}},{{From whom?}},{{Weasel-inline}},{{Which}},{{Who}}').dialog();
var templateType = 'attribution';
var templates = [ mw.html.element(
'a', //tag
{ //atrributes
href :'javascript:void(0)',
onclick :'alert("bang!");'
},
'{{According to whom}}' // text
),
'{{Attribution needed}}',
'{{By whom}}',
'{{From whom?}}',
'{{Weasel-inline}}',
'{{Which}}',
'{{Who}}' ];
renderAttribDialog(templates,templateType);
});
function renderAttribDialog(templates,
templateType){
templateType = typeof a !== 'undefined' ? a : 'attribution'; //check templateType is defined or set it default value
templates = typeof templates !== 'undefined' ? templates : ['{{According to whom}}','{{Attribution needed}}','{{By whom}}','{{From whom?}}','{{Weasel-inline}}','{{Which}}','{{Who}}'];
var $dialog = $( '<div></div>' )
.html(
'<strong>Welcome, ' + mw.user.getName() +
'!</strong> The following inline '+templateType+' tags are available:<br/><ul><li>' +
templates.join( '<br /><li>' ) + '</ul>'
)
.dialog({
autoOpen: true,
title: 'Hello there!',
width: '70%',
modal: true
});
}
});
/* Reflinks */
// Add [[WP:Reflinks]] launcher in the toolbox on left
$(function () {
mw.util.addPortletLink(
"p-tb", // toolbox portlet
"http://toolserver.org/~dispenser/cgi-bin/webreflinks.py?page=" + wgPageName
+ "&citeweb=on&overwrite=simple&limit=20",
"Reflinks" // link label
)});
/* Pending AfC submissions */
// Add [[CAT:PEND]] in the toolbox on left
$(function () {
mw.util.addPortletLink(
"p-tb", // toolbox portlet
"http://en.wikipedia.org/wiki/CAT:PEND",
"AFC" // link label
)});
/* AfD */
// Add [[WP:AFD]] in the toolbox on the left
$(function () {
mw.util.addPortletLink(
"p-tb", // toolbox portlet
"http://en.wikipedia.org/wiki/WP:AFD",
"AFD" // link label
)});
/* User login */
// Add [[Special:Userlogin]] in the toolbox on the left
$(function () {
mw.util.addPortletLink(
"p-tb", // toolbox portlet
"http://en.wikipedia.org/wiki/Special:UserLogin",
"Switch user" // link label
)});
/* Tester Tool */
// Add [[Project:Yoga]] in the toolbox on left
$(function () {
mw.util.addPortletLink(
"p-tb", // toolbox portlet
"http://en.wikipedia.org/wiki/Project:Yoga",
"Yoga" // link label
)});