MediaWiki:Common.js/User:Bawolff/idea

From Wikinews, the free news source you can write!
Jump to navigation Jump to search

/*

 */

mw.util.addCSS(' dd {   margin: 0;  padding: 0;} dl {   border-top: solid 1px #F0F080;    border-left: solid 1px #F0F080;    padding-top: 0.5em;    padding-left: 0.5em;    margin-left: 1em; } dl { background-color: #FFFFE0; } dl dl { background-color: #FFFFEE; } dl dl dl { background-color: #FFFFE0; } dl dl dl dl { background-color: #FFFFEE; } dl dl dl dl dl { background-color: #FFFFE0; }')

function CommentHelper() {
var ps = $('#MainCommentBody h2 ~ p ').next(':not(p, ul, ol, div, pre)').prev()
var dd = $('#MainCommentBody dd')
var reply = document.createElement('a');
reply.href = 'javascript:alert("Reply does not work")';
reply.className = 'replyLink';
reply.style.fontSize= 'smaller'
reply.appendChild(document.createElement('br'));
reply.appendChild(document.createTextNode('[Reply]'));

var nr, childDL;
for (var i =0; i< dd.length;i++) {
nr = reply.cloneNode(true);
nr.href = 'javascript:alert("This is just a demonstration that reply links are possible. they do not work yet (reply to response ' + i  + ')");void 0'

childDL = dd.eq(i).children('dl')
if (childDL.length !== 0) {
dd[i].insertBefore(nr, childDL[0]);
}
else dd[i].appendChild(nr);

}
for (var i =0; i< ps.length;i++) {
nr = reply.cloneNode(true);
nr.href = 'javascript:alert("This is just a demonstration that reply links are possible. they do not work yet (reply to comment ' + i  + ')");void 0'

ps[i].appendChild(nr);

}
}
addOnloadHook(CommentHelper);
//