Javascript Functions - xXRedkydudashXx/windowsredkydudash.github.io Wiki

Here is all of the exclusif JS functions from Windows Redkydudash.

Windows

Used to create red virtual windows.

Functions

CreateWindow(Width, Id, Title, HasCloseButton, HasMinimizeButton, HasMaximizeButton, HasHelpButton, BodyText, MessageIcon, MarginLeft, MarginTop, Button1, Button1Function, Button2, Button2Function, PlaySound)

This functions is used to create window that will show in the screen.

Warning: this function is now obsolete in the main functions, it will no longer be used, use $MakeWindow instead.

  • Width: the width of the window
  • Id: a id that can be used for purpose
  • Title: the title that is showed in the window
  • HasCloseButton: determine by true/false if the window has a close button (that work)
  • HasMinimizeButton: same but with a minimize button (that don't work)
  • HasMaximizeeButton: same but with a maximize button (that don't work)
  • HasHelpButton: same but with a help button (that don't work)
  • BodyText: the text inside the window
  • MessageIcon: if the window is a message box, then here is the icon from the left of the box. the icons are: "error": critial error icon "warning": warning icon "information": info bubble icon "question": question bubble icon
  • MarginLeft/MarginTop: the position of the window. if set false
  • Button1: the text inside the center button, put null to have no center button
  • Button1Function: the function of the button. for now, only 1 and 10 work but in the futur, js functions will work.
  • Button2: the text inside the right button, put null to have no left button
  • Button2Function: the function of the button. for now, only 1 and 10 work but in the futur, js functions will work.
  • PlaySound: if there's a message icon then a sound will be played if set to true. the sounds are: "error": critical error sound "warning": error sound "information" and "question": exclamation sound.

$MakeWindow(Width, Height, Id, Title, HasCloseButton, HasMinimizeButton, HasMaximizeButton, HasHelpButton, Draggable, MarginLeft, MarginTop)

This function create a window, and return it as a DOM element. Since it's return the element, it can be edited in different ways.

  • Width: the width of the window
  • Height: the height of the window (can be removed after return)
  • Id: the id of the window
  • Title: the title of the window
  • HasCloseButton: determine by true/false if the window has a close button (work automatically)
  • HasMinimizeButton: determine by true/false if the window has a minimize button (doesn't work manually)
  • HasMaximizeButton: determine by true/false if the window has a maximize button (doesn't work manually)
  • HasHelpButton: determine by true/false if the window has a help button (doesn't work manually)
  • Draggable: true/false determine if yes or no the window can be draggable (currently in W.I.P.)
  • MarginLeft: the position of the window (optional, can be edited after return)
  • MarginTop: the position of the window (optional, can be edited after return)

The function has a return, meaning you can get the window with const and use it to edit it in different ways. Note: if you want to add things inside the window, be shure to get the window-body, otherise, it can cause troubles with the inside of the window.

$MessageBox(Id, Text)

A command that shows an message box in the middle of the screen. It also make sounds and shows a message in the console

  • Id: the number that determine the type of message box. The current working numbers are:
  1. Message (Icon: Information, Sound: Exclamation)
  2. Information (Icon: Question, Sound: Exclamation)
  3. Error (Icon: Error, Sound: Critical)
  4. Warning (Icon: Warning, Sound: Error)
  • Text: the text that will be show both in the window and in the console Trivia: if the message box is a error, it will show an error in the console, if the message box is a warning, it will show an error in the warning

$Taskkill(Program)

Remove "every" elements with the same class, leads the idea of task kill a program.

Warning: the function is currently in a experimental version!

  • Program: the program name that will begone. It can be a className depending of the program name.

Note: Some of the "className" are not possible to remove, resulting an warning message box instead.

Others

Others functions used by the main script.

AddText(text, tclass, tid) & AddWhiteText(text, tclass, tid)

A simple function used to create <p> faster and easier.

  • text: the showen text
  • tclass: a class gived to the element (optinal)
  • tid: a id gived to the element (optinal)

color4(R, G, B, A)

A custom function that convert RGBA into HEX code. The function can be used for "coloring" a css style faster and easier.

  • R: the color red (max: 255)
  • G: the color green (max: 255)
  • B: the color blue (max: 255)
  • A: the alpha of the color (max: 255)

$Notify(Title, Text)

A function that creates a 'white-red' notification balloon in the top-left of the screen.

Warning: the function is currently in a experimental version!

  • Title: the title of the balloon
  • Text: the inner text of the balloon

Examples

An example of how to use $MakeWindow:

const MyWindow = $MakeWindow("150px", "100px", "MyWindow", "Title", true, true, false, false)
const Para = AddText("Hello world!")
Para.style.fontSize = "20px"
MyWindow.querySelector(".window-body").appendChild(Para)
document.body.appendChild(MyWindow)
// This example create a window that has "Hello world!" in it.

An example of how to use $Notify:

$Notify("Information", "The current time of day is "+document.getElementById("date-time").innerHTML)
// This example shows the time of day (taken from the time in the taskbar)

An other & advanced use of $MakeWindow:

const MyWindow = $MakeWindow("200px", "200px", "MyIFrameWindow", "Title", true, false, false, true)
const IFrame = document.createElement("iframe")
IFrame.style.width = "100%"
IFrame.style.height = "110%"
IFrame.src = "https://example.com/"
MyWindow.querySelector(".window-body").appendChild(IFrame)
var WindowHelp = MyWindow.querySelector('[aria-label="Help"]')
WindowHelp.onclick = function(){
    $MessageBox(1, "It worked!")
}
document.body.appendChild(MyWindow)
// This example create a window with a iframe in it, and create a message box when the help button is clicked.

An other & advanced use of $Notify:

$Notify('<img src="C/Assets/System33/Icons/WinRedkyExclusif/info.png" width="10"> Important Message','You learned how to put images in balloon.')
// This example create a balloon tip with an small image in the title.