imported>=海豚= |
imported>=海豚= |
第1行: |
第1行: |
| (function($, mw) {
| | 对特殊汉字的额外支持字体,由[[萌百: 用户:Honoka55/HonokaGothicMoe| 用户:Honoka55]] 所作 |
| if (!mw.config.get('wgPermittedGroups')) mw.config.set('wgPermittedGroups', ['autoconfirmed']); //默认只允许自动确认 用户 绕过强制预览。
| |
| //检测两个数组是否有重复元素
| |
| function intersects(arr1, arr2) {
| |
| if (!Array.isArray(arr1) || !Array.isArray(arr2)) return false;
| |
| for (var i1 = 0, l1 = arr1.length; i1 < l1; i1++) {
| |
| if (arr1.indexOf(arr1[i1]) === -1) continue; // 检测是否为空位
| |
| for (var i2 = 0, l2 = arr2.length; i2 < l2; i2++) {
| |
| if (arr2.indexOf(arr2[i2]) === -1) continue;
| |
| if (arr1[i1] === arr2[i2]) return true;
| |
| }
| |
| }
| |
| return false;
| |
| }
| |
| $(function() {
| |
| if (mw.config.get('wgAction') !== 'edit' || intersects(mw.config.get("wgUserGroups"), mw.config.get("wgPermittedGroups"))) return;
| |
| var saveButton = $('#wpSave') || $(window.wpSave);
| |
| if (!saveButton[0]) return;
| |
| saveButton.attr('disabled', 'disabled').val('预览一次后才可保存内容').css('font-weight', 'normal').closest('.oo-ui-widget-enabled').removeClass('oo-ui-widget-enabled oo-ui-flaggedElement-primary');
| |
| Object.defineProperty(window, "wpSave", {
| |
| get: function() {
| |
| return undefined;
| |
| },
| |
| set: function() {
| |
| return true;
| |
| },
| |
| configurable: false,
| |
| enumerable: true,
| |
| });
| |
| Object.defineProperty(saveButton[0], "disabled", {
| |
| get: function() {
| |
| return true;
| |
| },
| |
| set: function() {
| |
| return true;
| |
| },
| |
| configurable: false,
| |
| enumerable: true,
| |
| });
| |
| $('#wpPreview').closest('.oo-ui-buttonElement-framed').addClass('oo-ui-flaggedElement-primary oo-ui-flaggedElement-progressive');
| |
| });
| |
| })(jQuery, mediaWiki);
| |
2020年3月19日 (四) 17:39的版本