Requests for comment/Redo skin framework/SkinApiSpecification
Appearance
I (Jdlrobson) am sort of hijacking Trevor's RFC here. I think it will be useful to spec out what we imagine a Skin Api looking like after writing a patch on Gerrit. If you are a frontend developer be bold! and feel free to edit this page and help build the JavaScript interface we want to work with. Feel free to create Requests_for_comment/Redo_skin_framework/SkinApiSpecification2 if you're idea is drastically different :) The more ideas the better!
( function( $, mw ) {
var config = mw.config.get( 'wgSkinConfig' );
function Skin( config ) {
this.config = config;
}
Skin.prototype = {
/* returns the name of the current skin e.g. vector */
getName: function() { return this.config.name; },
/* returns the element which results in the watching of an element */
getWatchPageElement: function() {
if ( this.config.watchPageSelector ) {
return $( this.config.watchPageSelector );
} else {
mw.log( 'Skin needs to define watchPageSelector config property' );
return;
}
},
getVariantMenu: function() {},
getLanguagesList: function() {},
getMainNavigationMenu: function() {},
getNamespaceMenu: function() {},
getPersonalMenu: function() {}
};
if ( !config ) {
mw.log( 'Skin needs to use wgSkinConfig' );
config = {};
}
mw.skin = new Skin( config );
}( jQuery, mediaWiki ) );