RobloxDev to Roblox Wiki API Reference

Adds a button to view the API reference on the Roblox Wiki instead of RobloxDev

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name     RobloxDev to Roblox Wiki API Reference
// @description Adds a button to view the API reference on the Roblox Wiki instead of RobloxDev
// @version  1.3
// @grant    none
// @match  *://www.robloxdev.com/api-reference/*
// @namespace Blupo
// ==/UserScript==

(function () {
	"use strict";
	
	var buttonAlreadyExists = document.getElementById("robloxwiki-btn");
	if (buttonAlreadyExists) { return true };
	
	var text = "View on the Roblox Wiki";
	
	var button = document.createElement("a");
	button.setAttribute("class", "btn secondary-btn");
	button.setAttribute("id", "robloxwiki-btn");
	button.setAttribute("style", "border-radius: 2px; color: #00a2ff;");
	button.setAttribute("href", "https://wiki.roblox.com/index.php?title=API:Class/" + window.location.href.match('api\-reference\/(property|class|event|function|callback)\/(.+)')[2] + "&studiomode=true");
	
	var buttonText = document.createTextNode(text);
	button.appendChild(buttonText);
	
	var apiContent = document.getElementsByClassName("api-content")[0];
	if (!apiContent) { return true };
	
	apiContent.insertAdjacentElement("beforebegin", button);
}());