User:Cyrob/common.js
Jump to navigation
Jump to search
In other languages: Español • Français
CSS and Javascript changes must comply with the wiki design rules.
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
//***********************
//* Paint Job Viewer JS *
//***********************
window.onload = function(){
//Area Damage Link
var areaDamageDivs = document.getElementsByClassName("AreaDamage");
for(var n = 0; n < areaDamageDivs.length; n++) {
//areaDamageDivs[n].onclick="window.location='https://deeprockgalactic.gamepedia.com/Area_Damage'";
areaDamageDivs[n].setAttribute("onclick","window.open('https://deeprockgalactic.gamepedia.com/Area_Damage', '_blank');");
}
//Skin Viewer
var hoverPaintJobJS = document.getElementsByClassName("PaintJob");
var hoverFrameWorkJS = document.getElementsByClassName("FrameWork");
var PaintJob = "Stock";
var FrameWork = "";
var Weapon = document.getElementById("Weapon").className;
var WeaponName = document.getElementById("WeaponName").className;
var dict = {
"stock":"Default",
"first":"First Stripe",
"deepcore":"Deepcore",
"special":"The Company Special",
"beyond":"Beyond The Circuit",
"dark":"Dark Descent",
"desert":"Desert Ranger",
"digital":"Digital Danger",
"ghostly":"Ghostly Pale",
"jungle":"Jungle Raid",
"darkfuture":"Dark Future",
"megacorp":"Mega Corp",
"metallic":"Metallic Vintage",
"mint":"Mint Assault",
"primal":"Primal Blood",
"supporter":"The Supporter",
"tool":"Tool Of Destruction",
"trusty":"Trusty Rusty",
"warmonger":"Warmonger"
};
var i;
for (i = 0; i < hoverPaintJobJS.length; i++) {
hoverPaintJobJS[i].addEventListener("mousedown", function( event ) {
PaintJob = this.id;
updateSkinViewer(FrameWork, PaintJob, Weapon);
}, false);
hoverPaintJobJS[i].addEventListener("mouseover", function( event ) {
this.className += " Selected"
}, false);
hoverPaintJobJS[i].addEventListener("mouseout", function( event ) {
this.className = "PaintJob"
}, false);
}
for (i = 0; i < hoverFrameWorkJS.length; i++) {
hoverFrameWorkJS[i].addEventListener("mousedown", function( event ) {
FrameWork = this.id;
updateSkinViewer(FrameWork, PaintJob, Weapon);
}, false);
hoverFrameWorkJS[i].addEventListener("mouseover", function( event ) {
this.className += " Selected"
}, false);
hoverFrameWorkJS[i].addEventListener("mouseout", function( event ) {
this.className = "FrameWork"
}, false);
}
}
function updateSkinViewer() {//Framework, PaintJob, Weapon
console.log("updateSkinViewer Started");
if(arguments[0] == null){//Check if stock framework
document.getElementById("Name").innerHTML = arguments[2] + ": " + Default + " - "+ arguments[1];
var url = "https://deeprockgalactic.wiki.gg/wiki/Special:FilePath/Skin "+ arguments[2] + " " + arguments[1] +".png?width=439";
} else {
document.getElementById("Name").innerHTML = arguments[2] + ": " + arguments[0] + " - "+ arguments[1];
var url = "https://deeprockgalactic.wiki.gg/wiki/Special:FilePath/Skin "+ arguments[2] + " " + arguments[0] + " " + arguments[1] +".png?width=439";
}
document.getElementById("Image").innerHTML = "<div class=\"floatnone\"><a href=\"/wiki/File:Skin_crspr_stock.png\" class=\"image\"><img alt=\"NAME HERE\" src=\"" + url + "\" decoding=\"async\" loading=\"lazy\" width=\"439\" height=\"200\"></a></div>";
}
//Wikitext-Extension-Gadget
mw.loader.load("https://github.com/Frederisk/Wikitext-Extension-Gadget/releases/latest/download/index-vscode.js");