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

User:Bhsd/widget/abbr.js

来自LLWiki
< User:Bhsd‎ | widget
Bhsd讨论 | 贡献2021年1月23日 (六) 11:21的版本
跳转到导航 跳转到搜索

注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件
//<nowiki>
// 用于[[Widget:Abbr]],可以使用ES6语法
/**
 * @Function: 用于在必要场合代替HTML的title属性,手机版也可生效
 * @Dependencies: oojs-ui-core, ext.gadget.site-lib
 * @Author: [[User:Bhsd]]
 */
"use strict";
/* global mw, $ */
(() => {
    const timer = setInterval(() => {
        if (!window.jQuery) { return; }
        clearInterval(timer);
        mw.widget = mw.widget || {};
        if (mw.widget.abbr) { return; }
        console.log('End setInterval: jQuery加载完毕,开始执行Widget:Abbr');
        mw.loader.using(['oojs-ui-core', 'ext.gadget.site-lib']).then(() => {
            mw.tipsy($('body'), '.abbr', {classes: ['abbr-popup'], anchor: false});
        });
        mw.widget.abbr = true;
    }, 500);
}) ();
//</nowiki>
// [[category:jQuery小部件]] {{DEFAULTSORT:Abbr}}