User:Shriheeran/6tabs-vector.js

function sixTabs{ if (!window.sixTabsNames) sixTabsNames = { 'edit':'commons/e/ec/Map marker icon – Nicolas Mollet – Pens – Stores – simple.png', 'viewsource':'commons/7/75/Page_white.png', 'history':'commons/thumb/2/26/Clock_simple.svg/20px-Clock_simple.svg.png', 'addsection':'+' } //unselected left tab: append edit & hist var	main = $('#left-navigation li:not(.selected)').slice(0,1).css('opacity','0.9') if (!main.hasClass('new')){ var url = main.find('a').attr('href') dup('history'); dup('edit') } function dup(type){ var tab = main.clone(true).attr('id', main.attr('id')+'-'+type) .insertAfter(main).css('opacity','0.6') tab.find('a').attr('href', url+'?action='+type).attr('title', type) nameTab(tab, type) } //selected left tab: main = $('#left-navigation li.selected').removeClass('selected') if (main.hasClass('new')){//... join with ca-edit on new page if ($('#ca-edit').hide.hasClass('selected')) main.addClass('selected') }else{ //...join with ca-view ("Read"), copying href in case of FlaggedRevs if ($('#ca-view').hide.hasClass('selected')) main.addClass('selected') main.find('a').attr('href', $('#ca-view').find('a').attr('href')) } //move existing tabs next to selected function mv(id){ nameTab($('#ca-'+id).insertAfter(main), id) } mv('addsection'); mv('history'); mv('edit'); mv('viewsource'); mv('current') function nameTab(tab, type){ var name = sixTabsNames[type] || type if (!name) return tab = tab.find('a').empty if (/\.(png|svg|gif)$/.test(name)) $(' ')  .attr('src','//upload.wikimedia.org/wikipedia/'+name) .attr('width','18').appendTo(tab) else tab.text(name) } }// if (wgNamespaceNumber>=0) $(sixTabs)