以前,有一个名为UserloginTemplate的类扩展了BaseTemplate,您可以自由地将其复制到自己的文件中,而是在类加载器中使用。
现在,我甚至找不到这个HTML来自哪个文件。我找到了includes/specialpage/LoginSignupSpecialPage.php
......但它是抽象的。
abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
我不知道从哪里开始,我能找到的任何信息都适用于旧版本的MediaWiki。
答案 0 :(得分:1)
这个过程与以前略有不同,但并不太难。
创建一个类,用于扩展扩展程序目录中的类XenForoAuthSpecialUserLogin.php
。我将我命名为SpecialUserLogin
。
在新的类文件中,像往常一样扩展class XenForoAuthSpecialUserLogin extends SpecialUserLogin
。
protected function getPageHtml($formHtml)
然后,重载方法extension.js
并返回所需的修改后的HTML。
在您的扩展程序AutoloadClasses
中,为新班级添加LocalSettings.php
条目。
在$wgSpecialPages['Userlogin'] = [XenForoAuthSpecialUserLogin::class];
中,添加此行以用新班级替换特殊页面。
UserLogin
小心!虽然所有引用都使用Userlogin
,但此密钥(和网页网址)为var theCanvas = document.getElementById("theCanvas");
var c = theCanvas.getContext("2d");
/**
* Construct(x, y) Coordinate object representing a point on a 2D plane
*/
function Coord2D(x_ordinate, y_ordinate) {
return {
x : x_ordinate,
y : y_ordinate
};
}
theCanvas.center = new Coord2D(theCanvas.width/2, theCanvas.height/2);
var SEGMENT_LENGTH = 150;
var SEGMENT_BREADTH = 20;
var LEFT_X = theCanvas.center.x - SEGMENT_LENGTH/2;
var TOP_Y = theCanvas.center.y - SEGMENT_LENGTH/2 - SEGMENT_BREADTH;
var RIGHT_X = theCanvas.center.x + SEGMENT_LENGTH/2 - SEGMENT_BREADTH;
var BOTTOM_Y = theCanvas.center.y + SEGMENT_LENGTH/2 + SEGMENT_BREADTH;
var MIDBOT_Y = theCanvas.center.y - SEGMENT_BREADTH - SEGMENT_BREADTH;
var MID_Y = theCanvas.center.y ;
// A 2D Segment object: a rectangle representing one display segment
function Segment(x, y, isVertical) {
var segment = {
coord : new Coord2D(x, y),
width : SEGMENT_LENGTH,
height: SEGMENT_BREADTH,
isOn : false
};
if (isVertical) {
segment.width = SEGMENT_BREADTH;
segment.height = SEGMENT_LENGTH;
};
return segment;
};
function drawSegment(segment) {
c.fillStyle = 'lightgrey';
if (segment.isOn) {
c.fillStyle = 'red';
}
c.fillRect(segment.coord.x, segment.coord.y,
segment.width, segment.height);
};
var SevenSegDisplay = [
new Segment(LEFT_X, TOP_Y, false), //top segment A
new Segment(RIGHT_X, TOP_Y, true), //right top vert segment B
new Segment(LEFT_X, MIDBOT_Y, true), //left bot vert segment C
new Segment(LEFT_X, BOTTOM_Y, false),//bottom segment D
new Segment(RIGHT_X, MIDBOT_Y, true), //right bot vert segment E
new Segment(LEFT_X, TOP_Y, true),//left top vert segment F
new Segment(LEFT_X, MID_Y, false),//middle segment G
];
function drawSevenSegDisplay (key) {
for(i=0;i<SevenSegDisplay.length;i++){
drawSegment(SevenSegDisplay[i]);
}if(SWITCH_ENCODING.hasOwnProperty(key)){
var switches = SWITCH_ENCODING[key];
};
};
var ON = true;
var OFF = false;
// Map event.key onto an encoding of the switch state for each segment
var SWITCH_ENCODING = {
'Off' : [OFF,OFF,OFF,OFF,OFF,OFF,OFF],
'0' : [ ON, ON, ON, ON, ON, ON,OFF],
'1' : [ OFF, ON, ON, OFF, OFF, OFF,OFF],
'2' : [ ON, ON, OFF, ON, ON, OFF,ON],
'3' : [ ON, ON, ON, ON, OFF, OFF,ON],
'4' : [ OFF, ON, OFF, OFF, ON, ON,OFF],
'5' : [ ON, OFF, ON, ON, OFF, ON,ON],
'6' : [ ON, OFF, ON, ON, ON, ON,ON],
'7' : [ ON, ON, ON, OFF, OFF, OFF,OFF],
'8' : [ ON, ON, ON, ON, ON, ON,ON],
'9' : [ ON, ON, ON, OFF, OFF, ON,ON],}
document.onkeydown = drawSevenSegDisplay(Event.key);
且小写为L.
您现在应该看到您的更改。
答案 1 :(得分:1)
使用AuthChangeFormFields
挂钩。请参阅HTMLForm
的文档,了解您可以执行哪些更改。请注意,对于可以提交哪种数据的任何更改(例如新表单字段),您需要编写provider,但如果您只想添加额外的文本等,则可以添加{{3通过钩子的字段。