The Official Blog of Patcoola

Im just a dude watching over my parents,
and trying to make cartoons and video games from home.

Script: Mouse [JS API]

, By Patcoola

Script Title: mouse
Programming Language: Java Script
Date Completed: 2013/06/05

Purpose: Provides an easy to use API for working with mouse events and functions in a Web page.

Advertisement

Donate Now!

After a hard day, I like to relax with a cold jar of pickle juice and a hardy fart. If you like my blog, please consider donating.


Description: Mouse API for working with mouse events and functions. Includes cross browser compatibility with unified features.

Compatibility: Works with all modern Web browsers, some legacy support.

Special Compatibility Notes:

Opera 9 and over is supported.
Opera may have detect right click and context menu disabled by default.
Webkits 412 and under only supports left click detection.

Methods:

Properties

mouse.position.x
Returns a number value measured in pixels, returns the mouse’s X position.

mouse.position.y
Returns a number value measured in pixels, returns the mouse’s Y position.

mouse.position.inner.x
Returns a number value measured in pixels, returns the mouse’s X position, within an element.

mouse.position.inner.y
Returns a number value measured in pixels, returns the mouse’s Y position, within an element.

mouse.disable.contextMenu
Set or returns true or false, set to disable the mouse’s context menu, default value false.

mouse.disable.ctrlClick
Set or returns true of false, set to disable the ctrl+click command, default value false.

mouse.disable.shiftClick
Set or returns true or false, set to disable the shift+click command, default value false.

mouse.disable.altClick
Set or returns true or false, set to disable the alt+click command, default value false.

mouse.disable.cmdClick
Set or returns true or false, set to disable the cmd+click command, default value false.
Apple computer exclusive.

mouse.disable.scroll
Set or returns true or false, set to disable the mouse’s scroll wheel, prevents the scrolling action, default value false.

mouse.wheel
Returns a number value, returns the mouse wheel rotation value.

mouse.target.over
Returns an element, returns the HTML element the mouse is currently Hovered over.

mouse.target.down
Returns an element, returns the HTML element the mouse is currently hold down on.

mouse.isActive
Returns true or false, returns true if the mouse API is active.

mouse.isContextMenu
Returns true or false, returns true if the context menu event has fired, value resets to false after 1 second after the event.

Functions

mouse.target.setInner()
Function to target an HTML element to listen for the inner mouse position.

mouse.target.clearInner()
Function to remove set inner target element.

mouse.isDown( button_s )
Function returns true or false, determines if the mouse is held down.

mouse.isUp( button_s )
Function returns true or false, determines if the mouse is up.

mouse.start()
Function to start the mouse API.

mouse.stop()
Function to stop the mouse API.

isDown and isUp Arguments:

left
middle
right
ctrl
shift
alt
cmd

Note: Arguments are not case sensitize.
Note: (ctrl, shift, alt, cmd) event is fired when the key is held down while the mouse is up or down

 

Advertisement

Donate Now!

I don't always use the women's bathroom, but when I do, you can bet it really smells. If you like my blog, please consider donating.


 

Post Meta

Share Post

 

Comments: Write Comment

Be the first to write a comment.


Leave a Comment


All comments are reviewed before publishing. Comments must be related to the page topic, must not be spam, and must comply with the criminal code of Canada.