Javascript Functions - xXRedkydudashXx/windowsredkydudash.github.io GitHub Wiki

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

When a function has a $ in it, this means it's a "System Function", a function used by the system33.

Applications

Used to make applications

$Shortcut()

Used to create a shortcut that will execute an function

Warning: the function is currently in a experimental version!

$Shortcut(Name, Image, Left, Top, Function)

  • Name: the name of the shortcut
  • Image: the image of the shortcut.
  • Left/Top: the position left/top of the shortcut
  • Function: set a function and it will be executed when the shortcut is double-clicked (Optional).

Windows

Used to create red virtual windows.

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()

This function create a window.

// Default Function:
$MakeWindow({Width = 'auto', Height = 'auto', Id = null, Class = null, Title = "Window", HasCloseButton = true, HasMinimizeButton = true, HasMaximizeButton = true, HasHelpButton = false, Draggable = true, Resizable = true, Left = 'calc(50% - 10px)', Top = '50%', Onclose = null})
  • Width: the width of the window
  • Height: the height of the window (can be removed after return)
  • Id: the id of the window
  • Class: the class 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 (work automatically)
  • 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)
  • Onclose: Event when window close

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()

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

// Default function:
$MessageBox({Type = 1, Msg = null, title = null, Icon = null, Sound = "auto", helpbutton = false, left = "50%", top = "50%", ShowsMsg = true, OnOk = null, OnOkClose = null, OnClose = null})
  • 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)
  • Msg: the text that will be show both in the window and in the console
  • Title: the title of the msgbox
  • Icon: What icon can appear instead of the 5 regular ones
  • Sound: What sound is played. If it's set to "auto", it will play the sound corresponding to the icon, else no sound will be played.
  • helpbutton: Should a help button appear?
  • ShowsMsg: Toggle when it will trigger a message in the console or not.
  • OnOk / OnClose / OnOkClose: Event when window close by ok button or using the close button or both. 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()

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

// Default Function:
$Notify({Msg = null, Title = null, Length = 5000})
  • Msg: the inner text of the balloon
  • Title: the title of the balloon (Optional)
  • Length: the duration of the balloon tip. When no length set, the timeout is biased of the length of the texts (title and message)

Examples

An example of how to use $MakeWindow:

const MyWindow = $MakeWindow({Width:"150px", Height:"100px", Class:"MyWindow", Title:"Title", HasCloseButton:true, HasMinimizeButton:true, HasMaximizeButton:false, HasHelpButton: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({Title:"Information", Msg:"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({Width:"200px", Height:"200px", Class:"MyIFrameWindow", Title:"Title", HasCloseButton:true, HasMinimizeButton:false, HasMaximizeButton:false, HasHelpButton: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({Type:1, Msg:"This is a message box"})
}
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({Msg:'You learned how to put images in balloon.', Title:'<img src="C/System33/Icons/WinRedkyExclusif/info.png" width="10"> Important Message'})
// This example create a balloon tip with an small image in the title.

A way to use $Shortcut:

$Shortcut("Test", "C/System33/Icons/WinRedkyExclusif/text-file.png", 0, function(){$Notify({Title:"Information", Msg:"This is a test"})})