mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-09-23 10:26:50 +00:00
ci: 👷 lint code to MediaWiki standards
Check commit and GitHub actions for more details
This commit is contained in:
parent
7f75899995
commit
a7660375fc
|
@ -45,17 +45,17 @@ module.exports = exports = defineComponent( {
|
|||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
escapeId( id ) {
|
||||
return mw.util.escapeIdForAttribute( id )
|
||||
}
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
tabsData: this.tabberData.tabsData,
|
||||
currentTab: this.tabberData.currentTab
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
escapeId( id ) {
|
||||
return mw.util.escapeIdForAttribute( id );
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.$el.parentElement.classList.add( 'tabber--live' );
|
||||
}
|
||||
|
|
|
@ -32,12 +32,9 @@ module.exports = exports = defineComponent( {
|
|||
compilerOptions: {
|
||||
whitespace: 'condense'
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabsData: [],
|
||||
|
||||
currentTab: ''
|
||||
};
|
||||
components: {
|
||||
CdxTabs: CdxTabs,
|
||||
CdxTab: CdxTab
|
||||
},
|
||||
props: {
|
||||
html: {
|
||||
|
@ -45,32 +42,35 @@ module.exports = exports = defineComponent( {
|
|||
required: true
|
||||
}
|
||||
},
|
||||
components: {
|
||||
CdxTabs: CdxTabs,
|
||||
CdxTab: CdxTab,
|
||||
data() {
|
||||
return {
|
||||
tabsData: [],
|
||||
|
||||
currentTab: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
isChildTabber() {
|
||||
return Array.isArray(this.html) || this.html.includes("{\"label\":")
|
||||
return Array.isArray( this.html ) || this.html.includes( '{"label":' );
|
||||
},
|
||||
parse() {
|
||||
if (Array.isArray(this.html)) {
|
||||
return this.html
|
||||
if ( Array.isArray( this.html ) ) {
|
||||
return this.html;
|
||||
} else {
|
||||
const tmp = document.createElement('div');
|
||||
const tmp = document.createElement( 'div' );
|
||||
tmp.innerHTML = this.html;
|
||||
|
||||
return JSON.parse( tmp.textContent.trim() );
|
||||
}
|
||||
},
|
||||
escapeId( id ) {
|
||||
return mw.util.escapeIdForAttribute( id )
|
||||
return mw.util.escapeIdForAttribute( id );
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
if (this.isChildTabber()) {
|
||||
this.tabsData = this.parse(this.html)
|
||||
this.currentTab = this.escapeId( this.tabsData[0].label )
|
||||
if ( this.isChildTabber() ) {
|
||||
this.tabsData = this.parse( this.html );
|
||||
this.currentTab = this.escapeId( this.tabsData[ 0 ].label );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -26,7 +26,7 @@ function initApp( tabber ) {
|
|||
|
||||
tabberData.currentTab = tabberData.tabsData[ 0 ].name;
|
||||
|
||||
//@ts-ignore MediaWiki-specific function
|
||||
// @ts-ignore MediaWiki-specific function
|
||||
Vue.createMwApp(
|
||||
App, Object.assign( {
|
||||
tabberData: tabberData
|
||||
|
|
Loading…
Reference in a new issue