Widget:RCSandbox: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
a.rclink {color: rgb(16, 123, 181) !important;} /* unvisited link */ | a.rclink {color: rgb(16, 123, 181) !important;} /* unvisited link */ | ||
</style> | </style> | ||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
$('#changeslist').ready(function() { | $('#changeslist').ready(function () { | ||
getRecentChanges(); | |||
scrolltextup(1000); | scrolltextup(1000); | ||
}); | }); | ||
function getRecentChanges() { | function getRecentChanges() { | ||
mw.loader.using('mediawiki.api', function () { | mw.loader.using('mediawiki.api', function () { | ||
(new mw.Api()).get({ | ( new mw.Api() ).get( { | ||
action : 'query', | action : 'query', | ||
format : 'json', | format : 'json', | ||
Line 20: | Line 21: | ||
rclimit : 50, | rclimit : 50, | ||
rcprop : 'title|user', | rcprop : 'title|user', | ||
}).done(function (data) { | } ).done( function ( data ) { | ||
$("#changeslist").html(""); | |||
$(data.query.recentchanges).each(function (key, value) { | |||
$("#changeslist").append("<a class='rclink' href='http://wikidoc.org/index.php/" + value.title + "'>" + value.title + "</a> was edited by: " + value.user + "<br />"); | |||
}); | |||
}); | }); | ||
}); | |||
}); | } | ||
var scrollheight = $("#textup").height(); | |||
function scrolltextup(dur) { | |||
$("#textup").animate({ | |||
"top" : "-=20" | |||
}, { | |||
duration : dur, | |||
easing : "linear", | |||
complete : function () { | |||
$("#textup").children(":last").after("<div style='line-height:20px;'>" + $("#textup").children(":first").html() + "</div>"); | |||
if ($("#textup").children(":first").height() <= (parseInt($("#textup").css("top")) * -1)) { | |||
$("#textup").children(":first").remove(); | |||
$("#textup").css({ | |||
"top" : 0 | |||
}); | |||
} | } | ||
setTimeout("scrolltextup(1000)", 1000); | |||
} | |||
}); | |||
} | |||