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 |
||
(40 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<style type="text/css"> | <style type="text/css"> | ||
# | #textup{ | ||
background-color: | background-color:rgb(208,208,208); | ||
} | } | ||
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 () { | |||
( new mw.Api() ).get( { | |||
action : 'query', | |||
format : 'json', | |||
rcshow : '!bot', | |||
list : 'recentchanges', | |||
rclimit : 50, | |||
} | rcprop : 'title|user', | ||
} ).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(); | 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); | |||
} | |||
}); | |||
} | |||
</script> | </script> | ||
<div id="scrolltextup" style=" | <div id="scrolltextup" style="overflow:hidden; position:relative; width:100%; height:245px;"> | ||
<div id="textup" style="text-align:center; position:absolute; top:0; left:0; width:100%;"> | |||
<div id="textup" style="text-align:center; position:absolute; top:0; | <div id="changeslist" style="line-height:25px;"> | ||
<div id="changeslist" style="line-height: | |||
</div> | </div> | ||
</div> | </div> |