User:SoledadKabocha/6tabs-vector.js

//modified from User:Js/6tabs-vector.js to support VisualEditor tab function sixTabs{

if (!window.sixTabsNames) sixTabsNames = { 've-edit':'commons/d/d9/Btn_edit.png', 'edit':'commons/5/58/Cog_edit.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') var queryChar = ( url.indexOf( '?' ) == -1 ? '?' : '&' ); dup('history'); dup('edit') } function dup(type){ var newTitle = type; if ( type === 'edit' ) newTitle += '\nWarning: 6tabs script does not check protection status';

var tab = main.clone(true).attr('id', main.attr('id')+'-'+type) .insertAfter(main).css('opacity','0.6') tab.find('a').attr('href', url+queryChar+'action='+type).attr('title', newTitle) 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('ve-edit'); 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 (mw.config.get('skin')=='vector' && mw.config.get('wgNamespaceNumber')>=0) { $(sixTabs); }