LLWiki正在建设中,欢迎加入我们

“User:Bhsd/widget/abbr.js”的版本间差异

来自LLWiki
跳转到导航 跳转到搜索
 
第7行: 第7行:
*/
*/
"use strict";
"use strict";
/* global mw, $ */
/* global mw */
(() => {
(() => {
const main = () => {
const main = () => {
第13行: 第13行:
if (mw.widget.abbr) { return; }
if (mw.widget.abbr) { return; }
mw.loader.using(['oojs-ui-core', 'ext.gadget.site-lib']).then(() => {
mw.loader.using(['oojs-ui-core', 'ext.gadget.site-lib']).then(() => {
mw.tipsy($('#bodyContent'), '.abbr', {anchor: false});
mw.tipsy('#bodyContent', '.abbr', {anchor: false});
});
});
mw.widget.abbr = true;
mw.widget.abbr = true;

2021年3月3日 (三) 03:56的最新版本

//<nowiki>
// 用于[[Widget:Abbr]],可以使用ES6语法
/**
 * @Function: 用于在必要场合代替HTML的title属性,手机版也可生效
 * @Dependencies: oojs-ui-core, ext.gadget.site-lib
 * @Author: [[User:Bhsd]]
 */
"use strict";
/* global mw */
(() => {
    const main = () => {
        mw.widget = mw.widget || {};
        if (mw.widget.abbr) { return; }
        mw.loader.using(['oojs-ui-core', 'ext.gadget.site-lib']).then(() => {
            mw.tipsy('#bodyContent', '.abbr', {anchor: false});
        });
        mw.widget.abbr = true;
    };
    if (window.jQuery) { main(); }
    else { window.addEventListener('jquery', main); }
}) ();
//</nowiki>
// [[category:jQuery小部件]] {{DEFAULTSORT:Abbr}}