User:Djsasso/SimpleWPTab.js

var simpletabMainTab = $('#left-navigation li:not(.selected)').slice(0,1).css('opacity','0.9'); var simpletabTab = simpletabMainTab.clone(true).attr('id', simpletabMainTab.attr('id')+'-').css('opacity','0.9').removeClass('new'); var simpletabURL = 'http://' + 'simple.wikipedia.org/wiki/' + mw.config.get('wgPageName'); simpletabTab.find('a').attr('href', simpletabURL).empty.text('Simple').attr('title', "Navigate to this page on Simple Wikipedia");

$.ajax({  url:"http://simple.wikipedia.org/w/api.php?action=query&titles=" + encodeURIComponent(mw.config.get('wgPageName')) + "&format=xml",    dataType: "xml",    type: "GET",   success:parseIt });

function parseIt (xml){ var missing = $(xml).find('page').attr('missing'); if (typeof missing != "undefined") simpletabTab.addClass('new'); }

simpletabTab.insertBefore($('#right-navigation li').slice(0,1));