请注意:更新本页面后,您可能需要清除浏览器缓存才能看到所作变更的影响。
Google Chrome、Microsoft Edge、Mozilla Firefox、Safari:按住⇧ Shift,同时单击“刷新”。
Google Chrome、Microsoft Edge、Mozilla Firefox、Safari:按住⇧ Shift,同时单击“刷新”。
本文件采用知识共享署名-相同方式共享 4.0 国际(CC BY-SA 4.0)许可协议授权。
- 您可以自由地:
- 分享 – 在任何媒介以任何形式复制、发行本作品
- 演绎 – 修改、转换或以本作品为基础进行创作
- 惟须遵守下列条件:
- 署名 – 您必须给出适当的署名(标明原作者),提供指向本许可协议的链接,同时标明是否(对原始作品)作了修改。您可以用任何合理的方式来署名,但是不得以任何方式暗示许可人为您或您的使用背书(即诱导原作者在不了解协议情况下给你授权)。
- 相同方式共享 – 如果您再混合、转换或者基于本作品进行创作,您必须基于与原先许可协议相同或相兼容的许可协议分发您贡献的作品。
/**
* SPDX-License-Identifier: CC-BY-SA-4.0
* _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}'
*
* @base <https://zh.wikipedia.org/wiki/Special:Permalink/59753812>
* @source <https://git.qiuwen.wiki/InterfaceAdmin/Gadgets/src/branch/master/src/Gadgets/Ding>
*/
/**
* +--------------------------------------------------------+
* | === WARNING: GLOBAL GADGET FILE === |
* +--------------------------------------------------------+
* | All changes should be made in the repository, |
* | otherwise they will be lost. |
* +--------------------------------------------------------+
* | Changes to this page affect many users. |
* | Please discuss changes at Talk page before editing. |
* +--------------------------------------------------------+
*/
/* <nowiki> */
'use strict';
window.DingExposedInterface = function ding() {
var dingMain = function dingMain(message) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'info';
var ttl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3600;
var persist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (!document.querySelector('#ding')) {
document.body.insertAdjacentHTML('afterbegin', '<div id="ding"></div>');
}
var dingElement = document.querySelector('#ding');
var previousMessage = dingElement.lastChild;
if (previousMessage) {
var previousMessageStyle = previousMessage.style;
previousMessageStyle.transform = 'translateY(-130%)';
setTimeout(function () {
previousMessage.remove();
}, 500);
}
dingElement.insertAdjacentHTML('beforeend', "<div class=\"ding_inner ding_".concat(type, "\">").concat(message, "</div>"));
var noticeElement = dingElement.lastChild;
var noticeElementStyle = noticeElement.style;
if (persist) {
noticeElement === null || noticeElement === void 0 ? void 0 : noticeElement.addEventListener('click', function () {
noticeElementStyle.transform = 'translateY(-130%)';
setTimeout(function () {
noticeElement.remove();
}, 500);
});
}
setTimeout(function () {
noticeElementStyle.transform = 'translateY(0%)';
}, 10);
if (ttl !== 'long') {
setTimeout(function () {
noticeElementStyle.transform = 'translateY(-130%)';
}, ttl + 10);
setTimeout(function () {
noticeElement === null || noticeElement === void 0 ? void 0 : noticeElement.remove();
}, ttl + 510);
}
};
return dingMain;
}();
/* </nowiki> */