Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Various code update. #154

Merged
merged 14 commits into from
Oct 4, 2023
Merged
2 changes: 1 addition & 1 deletion src/Gadgets/Compatibility/Ding/.options
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Ding[ResourceLoader|hidden|targets=desktop,mobile]|Ding.css|Ding.js
Ding[ResourceLoader|hidden]|Ding.css|Ding.js
47 changes: 35 additions & 12 deletions src/Gadgets/Compatibility/Ding/Ding.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}'
*
* @base <https://zh.wikipedia.org/wiki/Special:Permalink/59753812>
* @base <https://zh.wikipedia.org/wiki/MediaWiki:Gadget-ding.css>
* @source <https://git.qiuwen.wiki/InterfaceAdmin/Gadgets/src/branch/master/src/Gadgets/Ding>
*/
/**
Expand All @@ -12,8 +13,8 @@
* | 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. |
* | Changes to this page may affect many users. |
* | Please discuss changes at talk page before editing. |
* +--------------------------------------------------------+
*/
/* <nowiki> */
Expand All @@ -29,8 +30,7 @@
}

#ding button:active {
background: hsla(0deg 0% 100%/60%);
background: rgb(255 255 255 / 20%);
background: rgba(255, 255, 255, 0.2);
}

.ding_inner {
Expand All @@ -39,19 +39,28 @@
right: 0;
bottom: 0;
left: 0;
width: 75%;
height: auto;
padding: 0.6em 2em;
margin: 0 0 auto;
box-shadow: 0 2px 5px rgb(0 0 0 / 20%);
font-size: 86%;
font-weight: 700;
line-height: 1.4em;
min-height: 3.75%;
padding: 0.75em 1.5em;
border-radius: 1em 1em 0 0;
margin: 0 auto;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
font-size: 92.5%;
font-weight: bold;
line-height: 1.25em;
opacity: 1;
text-align: center;
transform: translateY(-130%);
-webkit-transform: translateY(125%);
-moz-transform: translateY(125%);
-ms-transform: translateY(125%);
-o-transform: translateY(125%);
transform: translateY(125%);
transition: all 0.2s;
word-break: break-word;
}

/* Font and background colors */
.ding_default {
background-color: #eaecf0;
color: #000;
Expand All @@ -72,7 +81,21 @@
}

.ding_warning {
background-color: #d33;
background-color: #b32424;
}

.ding_inner a,
.ding_inner a:visited,
.ding_inner a:hover {
color: #f4ff7f !important;
}

/* Avoid overlapping the blue bar with the limited width control */
@media all and (min-width: 1000px) {
.ding_inner {
width: 800px !important;
margin: auto !important;
}
}

/* </nowiki> */
32 changes: 21 additions & 11 deletions src/Gadgets/Compatibility/Ding/Ding.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}'
*
* @base <https://zh.wikipedia.org/wiki/Special:Permalink/59753812>
* @base <https://zh.wikipedia.org/wiki/MediaWiki:Gadget-ding.css>
* @source <https://git.qiuwen.wiki/InterfaceAdmin/Gadgets/src/branch/master/src/Gadgets/Ding>
*/
/**
Expand All @@ -12,36 +13,45 @@
* | 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. |
* | Changes to this page may 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 dingDiv = document.createElement('div');
dingDiv.id = 'ding';
dingDiv.className = 'noprint';
document.body.insertAdjacentElement('afterbegin', dingDiv);
}
var dingElement = document.querySelector('#ding');
var previousMessage = dingElement.lastChild;
if (previousMessage) {
var previousMessageStyle = previousMessage.style;
previousMessageStyle.transform = 'translateY(-130%)';
previousMessageStyle.transform = 'translateY(125%)';
setTimeout(function () {
previousMessage.remove();
}, 500);
}
dingElement.insertAdjacentHTML('beforeend', "<div class=\"ding_inner ding_".concat(type, "\">").concat(message, "</div>"));
var dingInnerElement = document.createElement('div');
// The following classes are used here:
// * ding_inner
// * ding_info
// * ding_success
// * ding_warning
dingInnerElement.className = "ding_inner ding_".concat(type);
dingInnerElement.innerHTML = message;
dingElement.insertAdjacentElement('beforeend', dingInnerElement);
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%)';
noticeElement === null || noticeElement === void 0 || noticeElement.addEventListener('click', function () {
noticeElementStyle.transform = 'translateY(125%)';
setTimeout(function () {
noticeElement.remove();
}, 500);
Expand All @@ -52,10 +62,10 @@ window.DingExposedInterface = function ding() {
}, 10);
if (ttl !== 'long') {
setTimeout(function () {
noticeElementStyle.transform = 'translateY(-130%)';
noticeElementStyle.transform = 'translateY(125%)';
}, ttl + 10);
setTimeout(function () {
noticeElement === null || noticeElement === void 0 ? void 0 : noticeElement.remove();
noticeElement === null || noticeElement === void 0 || noticeElement.remove();
}, ttl + 510);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/Gadgets/Compatibility/GeoLocation/.options
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GeoLocation[ResourceLoader|default|dependencies=ext.gadget.Geo,ext.gadget.i18n,mediawiki.Title,mediawiki.api|targets=desktop,mobile]|GeoLocation.css|GeoLocation.js
GeoLocation[ResourceLoader|dependencies=ext.gadget.Geo,ext.gadget.i18n,mediawiki.Title,mediawiki.api]|GeoLocation.css|GeoLocation.js
39 changes: 27 additions & 12 deletions src/Gadgets/Compatibility/GeoLocation/GeoLocation.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
/**
* SPDX-License-Identifier: CC BY-SA-4.0
* SPDX-License-Identifier: CC-BY-SA-4.0
* _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}'
*
* @base <https://www.mediawiki.org/wiki/MediaWiki:Gadget-whoisactive.css>
* @source <https://git.qiuwen.wiki/InterfaceAdmin/Gadgets/src/branch/master/src/Gadgets/GeoLocation>
*/
/**
* Including icons from OOUI Project <https://github.com/wikimedia/oojs-ui/blob/master/src/themes/wikimediaui/images/icons>
* Licensed under MIT License <https://github.com/wikimedia/oojs-ui/blob/master/LICENSE-MIT>
* See <https://github.com/wikimedia/oojs-ui/blob/master/AUTHORS.txt> for contributors.
*/
/**
* +--------------------------------------------------------+
* | === 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. |
* | Changes to this page may affect many users. |
* | Please discuss changes at talk page before editing. |
* +--------------------------------------------------------+
*/
/* <nowiki> */
Expand All @@ -37,8 +32,8 @@
}

.mw-geolocation-green {
border-color: #14866d;
color: #14866d;
border-color: #00af89;
color: #00af89;
}

.mw-geolocation-orange {
Expand All @@ -62,24 +57,44 @@
}

.mw-geolocation-icon-globe::before {
/**
* @description globe Icon from OOjs UI
* @base <https://github.com/wikimedia/oojs-ui/blob/e17952e413cfc00c15cfd861d47463c29062afe7/src/themes/wikimediaui/images/icons/globe.svg>
* @license MIT <https://github.com/wikimedia/oojs-ui/blob/master/LICENSE-MIT>
*/
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath fill='%2314866d' d='M12.2 17.94c1.26-2 2-4.45 2.14-7.06h3.86a8.26 8.26 0 01-6 7.06M1.8 10.88h3.86c.14 2.6.88 5.06 2.14 7.06a8.26 8.26 0 01-6-7.06m6-8.82c-1.26 2-2 4.45-2.14 7.07H1.8a8.26 8.26 0 016-7.07m4.79 8.82A12.5 12.5 0 0110 18a12.51 12.51 0 01-2.59-7.13zM7.4 9.13A12.51 12.51 0 0110 1.99a12.5 12.5 0 012.59 7.14zm10.8 0h-3.87a14.79 14.79 0 00-2.14-7.07 8.26 8.26 0 016 7.07M10 0a10 10 0 100 20 10 10 0 000-20'/%3E%3C/svg%3E");
}

.mw-geolocation-icon-helpNotice::before {
/**
* @description helpNotice Icon (ltr) from OOjs UI
* @base <https://github.com/wikimedia/oojs-ui/blob/e17952e413cfc00c15cfd861d47463c29062afe7/src/themes/wikimediaui/images/icons/helpNotice-ltr.svg>
* @license MIT <https://github.com/wikimedia/oojs-ui/blob/master/LICENSE-MIT>
*/
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath fill='%23a60' d='M10 0a10 10 0 1010 10A10 10 0 0010 0zm1 16H9v-2h2zm2.71-7.6a2.64 2.64 0 01-.33.74 3.16 3.16 0 01-.48.55l-.54.48c-.21.18-.41.35-.58.52a2.54 2.54 0 00-.47.56A2.3 2.3 0 0011 12a3.79 3.79 0 00-.11 1H9.08a8.9 8.9 0 01.07-1.25 3.28 3.28 0 01.25-.9 2.79 2.79 0 01.41-.67 4 4 0 01.58-.58c.17-.16.34-.3.51-.44a3 3 0 00.43-.44 1.83 1.83 0 00.3-.55 2 2 0 00.11-.72 2.06 2.06 0 00-.17-.86 1.71 1.71 0 00-1-.9 1.7 1.7 0 00-.5-.1 1.77 1.77 0 00-1.53.68 3 3 0 00-.5 1.82H6.16a4.74 4.74 0 01.28-1.68 3.56 3.56 0 01.8-1.29 3.88 3.88 0 011.28-.83A4.59 4.59 0 0110.18 4a4.44 4.44 0 011.44.23 3.51 3.51 0 011.15.65 3.08 3.08 0 01.78 1.06 3.54 3.54 0 01.29 1.45 3.39 3.39 0 01-.13 1.01z'/%3E%3C/svg%3E");
}

.mw-geolocation-icon-settings::before {
/**
* @description settings Icon (ltr) from OOjs UI
* @base <https://github.com/wikimedia/oojs-ui/blob/e17952e413cfc00c15cfd861d47463c29062afe7/src/themes/wikimediaui/images/icons/settings.svg>
* @license MIT <https://github.com/wikimedia/oojs-ui/blob/master/LICENSE-MIT>
*/
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='20' height='20' fill='%2336c'%3E%3Cg transform='translate(10 10)'%3E%3Cpath id='a' d='M1.5-10h-3l-1 6.5h5m0 7h-5l1 6.5h3'/%3E%3Cuse xlink:href='%23a' transform='rotate(45)'/%3E%3Cuse xlink:href='%23a' transform='rotate(90)'/%3E%3Cuse xlink:href='%23a' transform='rotate(135)'/%3E%3C/g%3E%3Cpath d='M10 2.5a7.5 7.5 0 000 15 7.5 7.5 0 000-15v4a3.5 3.5 0 010 7 3.5 3.5 0 010-7'/%3E%3C/svg%3E");
}

.mw-geolocation-icon-userAvatar::before {
/**
* @description userAvatar Icon (ltr) from OOjs UI
* @base <https://github.com/wikimedia/oojs-ui/blob/e17952e413cfc00c15cfd861d47463c29062afe7/src/themes/wikimediaui/images/icons/userAvatar.svg>
* @license MIT <https://github.com/wikimedia/oojs-ui/blob/master/LICENSE-MIT>
*/
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%2336c'%3E%3Cpath d='M10 11c-5.92 0-8 3-8 5v3h16v-3c0-2-2.08-5-8-5z'/%3E%3Ccircle cx='10' cy='5.5' r='4.5'/%3E%3C/svg%3E");
}

.mw-geolocation-text {
font-size: 13px;
font-size: 0.8125em;
vertical-align: middle;
}

/* </nowiki> */
/* </nowiki> */
Loading