定制 starcitizentools/tabber-neue 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

starcitizentools/tabber-neue

Composer 安装命令:

composer require starcitizentools/tabber-neue

包简介

Allows to create tabs within a page. Forked from Extension:Tabber

README 文档

README

TabberNeue

The TabberNeue extension allows wikis to create tabs within a page. It is a forked and rewritten version of Extension:Tabber. It includes multiple improvements such as page transclusion, responsive layout support, ARIA support, and conform to Wikimedia UI. TabberNeue is a complete replacement of Tabber, please disable or remove Tabber before enabling TabberNeue.

Extension:TabberNeue on MediaWiki.

Requirements

Installation

You can get the extension via Git (specifying TabberNeue as the destination directory):

git clone https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git TabberNeue

Or download it as zip archive.

In either case, the "TabberNeue" extension should end up in the "extensions" directory of your MediaWiki installation. If you got the zip archive, you will need to put it into a directory called TabberNeue.

Usage

TabberNeue uses the exact same syntax as Tabber.

Simple tabbers

Tabs are created with tabName=tabBody, and separated by |-|. You can use any wikitext within your tabs, including templates and images.

<tabber>
|-|First Tab Title=
First tab content goes here.
|-|Second Tab Title=
Second tab content goes here.
|-|Third Tab Title=
Third tab content goes here.
</tabber>

Nested tabbers

Nested tabbers need to be written as parser functions. Instead of the <tabber/> tags, they are wrapped with {{#tag:tabber|}} and separated by {{!}}-{{!}}. It is useful when creating nested tabber.

<tabber>
|-|First Tab Title=
{{#tag:tabber|
Tab Title A=
Tab content A goes here.
{{!}}-{{!}}
Tab Title B=
Tab content B goes here.
{{!}}-{{!}}
Tab Title C=
Tab content C goes here.
}}
|-|Second Tab Title=
{{#tag:tabber|
Tab Title D=
Tab content D goes here.
{{!}}-{{!}}
Tab Title E=
Tab content E goes here.
{{!}}-{{!}}
Tab Title F=
Tab content F goes here.
}}
|-|Third Tab Title=
{{#tag:tabber|
Tab Title G=
Tab content G goes here.
{{!}}-{{!}}
Tab Title H=
Tab content H goes here.
{{!}}-{{!}}
Tab Title I=
Tab content I goes here.
}}
</tabber>

Transclusion

With the transclusion mode, the syntax is different, and it's more similar to <gallery> syntax.

The contents of the page of the first tab will be transcluded. Other tabs will be transcluded on-demand with AJAX, performing a request to the MediaWiki api. Once requested, they won't be fetched again until the page is reloaded. Note that Tabbers on the transcluded page will not be rendered.

Tabs are created with pageName|tabName, and separated by a new line.

<tabbertransclude>
First Page Name|First Tab Title
Second Page Name|Second Tab Title
Third Page Name|Third Tab Title
</tabbertransclude>

HTML attributes

You can add HTML attributes such as ID and class to the tabber element.

<tabber id="very-awesome-tabber" class="awesome-tabber" data-test="awesome-data">
|-|Awesome Tab Title 1=
Awesome first tab content goes here.
|-|Awesome Tab Title 2=
Awesome second tab content goes here.
|-|Awesome Tab Title 3=
Awesome third tab content goes here.
</tabber>

Tab wrapping

By default, when the tab headers are wider than the available space they stay on a single row that scrolls horizontally, with previous/next arrows. You can instead let the tabs wrap onto multiple rows.

Enable it wiki-wide by setting $wgTabberNeueEnableTabWrap = true; (see Configurations), or control it per tabber with the wrap attribute, which always overrides the wiki-wide default:

<tabber wrap=true>
|-|First Tab Title=
First tab content goes here.
|-|Second Tab Title=
Second tab content goes here.
</tabber>

To force a single tabber back to scrolling when wrapping is enabled wiki-wide, use wrap=false:

<tabber wrap=false>
|-|First Tab Title=
First tab content goes here.
|-|Second Tab Title=
Second tab content goes here.
</tabber>

The wrap attribute also works on <tabbertransclude>. (A bare <tabber wrap> is accepted as shorthand for wrap=true.)

Lua

Tabber can be invoked in Lua with the mw.ext.tabber library. For example:

mw.ext.tabber.render( {
    {
        label = 'Tab 1',
        content = 'Content 1'
    },
    {
        label = 'Tab 2',
        content = 'Content 2'
    },
    {
        label = 'Tab 3',
        content = 'Content 3'
    },
    {
        label = 'Tab 4',
        content = 'Content 4'
    }
} )

Configurations

Name Description Values Default
$wgTabberNeueEnableAnimation Enable or disable smooth scroll animation true - enable; false - disable true
$wgTabberNeueParseTabName Parse tab name as wikitext. This can have a performance impact and cause unexpected behaviors. true - enable; false - disable false
$wgTabberNeueUpdateLocationOnTabChange If enabled, when a tab is selected, the URL displayed on the browser changes. Opening this URL makes that tab initially selected true - enable; false - disable true
$wgTabberNeueAddTabPrefix If enabled, tabpanel IDs will be prepended with "tabber-" to avoid conflicts with page headings. true - enable; false - disable true
$wgTabberNeueEnableTabWrap If enabled, tab headers wrap onto multiple rows instead of a horizontally-scrollable row. Can be overridden per tabber with the wrap attribute. true - enable; false - disable false

Tracking category

TabberNeue adds a tracking category to all pages using Tabber for maintenance purposes. There are two ways to suppress the category from viewers:

  1. Hide the categories by putting __HIDDENCAT__ in the category page
  2. Remove the categories by creating the following pages and empty the page:
MediaWiki:Tabberneue-tabber-category
MediaWiki:Tabberneue-tabbertransclude-category

starcitizentools/tabber-neue 适用场景与选型建议

starcitizentools/tabber-neue 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 5.4k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2024 年 05 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「extension」 「mediawiki」 「TabberNeue」 「Tabber」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 starcitizentools/tabber-neue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 starcitizentools/tabber-neue 我们能提供哪些服务?
定制开发 / 二次开发

基于 starcitizentools/tabber-neue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 2
  • Forks: 26
  • 开发语言: JavaScript

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-05-27