משתמש:מ. רובין/common.js – הבדלי גרסאות
אין תקציר עריכה |
אין תקציר עריכה |
||
| שורה 25: | שורה 25: | ||
if ( typeof mw === 'undefined' || !mw.config ) return; | if ( typeof mw === 'undefined' || !mw.config ) return; | ||
var checktyScriptUrl = | var checktyScriptUrl = 'https://chabadpedia.co.il/index.php?title=MediaWiki:Gadget-Checkty.js&action=raw&ctype=text/javascript'; | ||
function loadCheckty() { | function loadCheckty() { | ||
$.getScript( checktyScriptUrl ) | |||
.done(function() { mw.notify("צ'קטי נטען!", {title: "Checkty", type: "info"}); }) | |||
.fail(function() { mw.notify("טעינת צ'קטי נכשלה", {title: "Checkty", type: "error"}); }); | |||
} | } | ||
function addButton() { | function addButton() { | ||
var $editTab = $( '#ca-edit' ); | var $editTab = $( '#ca-edit' ); | ||
if ( | if ( $editTab.length ) { | ||
var $newTab = $('<li id="ca-checkty">').append( | |||
$('<a>').attr('href','#').text("צ'קטי").on('click', function(e){ | |||
e.preventDefault(); | e.preventDefault(); | ||
loadCheckty(); | loadCheckty(); | ||
} ) | }) | ||
); | |||
$editTab.after( $newTab ); | |||
} else { | |||
if ( typeof mw.util.addPortletLink === 'function' ) { | |||
mw.util.addPortletLink('p-cactions', '#', "צ'קטי", 'ca-checkty', "צ'קטי", '', function($link){ | |||
$link.on('click', function(e){ | |||
e.preventDefault(); | |||
loadCheckty(); | |||
}); | |||
}); | |||
} | |||
} | |||
} | } | ||
$( addButton ); | $( addButton ); | ||
} )(); | })(); | ||