Module

DYK

From Dogcraft Wiki

(Difference between pages)
No edit summary
 
No edit summary
 
Line 1: Line 1:
local p = {} --p stands for package
/* Any JavaScript here will be loaded for all users on every page load. */


function p.random( frame )
/* Navigation Popups */
    math.randomseed(os.date("%d")*os.date("%m")*os.date("%y")*tonumber(frame.args['seed']))
/* Currently Disabled
length = tonumber(frame.args['length']) or 30
mw.loader.load('/load.php?modules=ext.gadget.Navigation_popups');
randnum = math.random(1,length)
window.popupAdminLinks = false;
    return randnum
window.popupActionsMenu = false;
end
window.popupStructure = 'lite';
window.popupSubpopups = false;
window.popupSummaryData = false;
*/


function randomdaily( maxrandom, seed )
$(document).ready(function() {
    math.randomseed(os.date("%d")*os.date("%m")*os.date("%y")*seed)
/*var goToDogcraft = document.querySelectorAll("#p-Go_to_Dogcraft > a");
length = maxrandom or 30
goToDogcraft[0].setAttribute("href", "//dogcraft.net");*/
randnum = math.random(1,length)
$("#p-Go_to_Dogcraft > a").attr("href", "http://dogcraft.net");
    return randnum
$("#p-Go_to_Dogcraft").removeClass("not-click has-dropdown");
end
 
var indicator = document.querySelectorAll(".mw-indicators");
function p.facts( frame )
var indicator1 = indicator[0];
text = frame.args['text'] or ""
    facts = {}
if (indicator1.childNodes.length !== 1) {document.getElementById("tagline").innerHTML = indicator1.innerHTML;}
i = 1
result = ""
//$(".mw-dismissable-notice-close a").text('X');
resulttable = {}
for fact in string.gmatch(text, '%.%.%. .-?') do
var dismissableNoticeClose = $(".mw-dismissable-notice-close");
facts[i] = fact
if (dismissableNoticeClose !== null) {
i = i + 1
$(".dismissable-notice-close-message-container").append(dismissableNoticeClose);
end
}
count = tonumber(frame.args['count'])
/*before pilgrims*/
if (count > 5) then
//$("img.top-bar-logo").attr("src","https://dogcraft.net/wiki/images/3/36/April_Logo.jpg");
count = 5
elseif (count < 1) then
count = 1
end
for i=1,count do
key = randomdaily(facts.getn, i)
resulttable[i] = facts[key]
end
result = table.concat(resulttable, "\n")
return result
/* Adding visual editor edit button on Guide namespace
end
(temporary until visual editor can properly be enabled for the namespace through LocalSettings.php)*/
 
var guide_va_edit_button = '<li id="ca-ve-edit"><a href="/wiki/index.php?title=' + mw.config.get( 'wgPageName' ) + '&amp;veaction=edit" title="Edit this page [Alt+Shift+v]" accesskey="v">Edit</a></li>';
return p
$(".ns-3002 #ca-edit").before(guide_va_edit_button);
/* Points actions menu talk page buttons to a discord invite */
$("#ca-talk > a[rel='discussion']").attr("href", "https://discord.com/invite/r5xDRcy/login")
.attr("title", "Discussion about the page on Discord [Alt+Shift+t]")
.attr("target", "_blank");
});

Revision as of 00:18, 1 April 2021

/* Any JavaScript here will be loaded for all users on every page load. */

/* Navigation Popups */
/* Currently Disabled
mw.loader.load('/load.php?modules=ext.gadget.Navigation_popups');
window.popupAdminLinks = false;
window.popupActionsMenu = false;
window.popupStructure = 'lite';
window.popupSubpopups = false;
window.popupSummaryData = false;
*/

$(document).ready(function() {
	/*var goToDogcraft = document.querySelectorAll("#p-Go_to_Dogcraft > a");
	goToDogcraft[0].setAttribute("href", "//dogcraft.net");*/
	$("#p-Go_to_Dogcraft > a").attr("href", "http://dogcraft.net");
	$("#p-Go_to_Dogcraft").removeClass("not-click has-dropdown");
	
	var indicator = document.querySelectorAll(".mw-indicators");
	var indicator1 = indicator[0];
	
	if (indicator1.childNodes.length !== 1) {document.getElementById("tagline").innerHTML = indicator1.innerHTML;}
	
	//$(".mw-dismissable-notice-close a").text('X');
	
	var dismissableNoticeClose = $(".mw-dismissable-notice-close");
	if (dismissableNoticeClose !== null) {
		$(".dismissable-notice-close-message-container").append(dismissableNoticeClose);
	}
	
	/*before pilgrims*/
	//$("img.top-bar-logo").attr("src","https://dogcraft.net/wiki/images/3/36/April_Logo.jpg");
	
	/* Adding visual editor edit button on Guide namespace 
	(temporary until visual editor can properly be enabled for the namespace through LocalSettings.php)*/
	 var guide_va_edit_button = '<li id="ca-ve-edit"><a href="/wiki/index.php?title=' + mw.config.get( 'wgPageName' ) + '&amp;veaction=edit" title="Edit this page [Alt+Shift+v]" accesskey="v">Edit</a></li>';
	 $(".ns-3002 #ca-edit").before(guide_va_edit_button);
	 
	 /* Points actions menu talk page buttons to a discord invite */
	 $("#ca-talk > a[rel='discussion']").attr("href", "https://discord.com/invite/r5xDRcy/login")
										.attr("title", "Discussion about the page on Discord [Alt+Shift+t]")
										.attr("target", "_blank");
	 
});
This page was last modified on 1 April 2021, at 00:18. (19 months ago)