GEO With Us
CSMOUSE JavaScript / HTML DOM Keyboard.key Property Class on Ctrl + Shift + Left Mouse Click Event

This functionality mimics Windows® File Explorer (or any other) gimmicks when selecting/deselecting files and folders.

In our CSMOUSE Object - we programmed it to work on web application sets of lists. Number of which is not limited per one page.

ALL SELECTABLE
/0 Selected:
0 Apple
1 Apricot
2 Avocado
3 Banana
4 Bilberry
5 Blackberry
6 Blackcurrant
7 Blueberry
8 Boysenberry
9 Currant
10 Cherry
11 Cherimoya
12 Cloudberry
13 Coconut
14 Cranberry
15 Cucumber
16 Custard apple
17 Damson
18 Date
19 Dragonfruit
20 Durian
21 Elderberry
22 Feijoa
23 Fig
24 Goji berry
25 Gooseberry
26 Grape
27 Raisin
28 Grapefruit
29 Guava
30 Honeyberry
31 Huckleberry
32 Jabuticaba
33 Jackfruit
34 Jambul
35 Jujube
36 Juniper berry
37 Kiwi
38 Kumquat
39 Lemon
40 Lime
41 Loquat
42 Longan
43 Lychee
44 Mango
45 Marionberry
46 Melon
SOME UNSELECTABLE
/0 Selected:
0 Cantaloupe
1 Honeydew
2 Watermelon
3 Miracle fruit
4 Mulberry
5 Nectarine
6 Nance
7 Olive
8 Orange
9 Blood orange
10 Clementine
11 Mandarine
12 Tangerine
13 Papaya
14 Passionfruit
15 Peach
16 Pear
17 Persimmon
18 Physalis
19 Plantain
20 Plum
21 Prune
22 Pineapple
23 Plumcot
24 Pomegranate
25 Pomelo
26 Purple mangosteen
27 Quince
28 Raspberry
29 Salmonberry
30 Rambutan
31 Redcurrant
32 Salal berry
33 Salak
34 Satsuma
35 Star fruit
36 Solanum quitoense
37 Strawberry
38 Tamarillo
39 Tamarind
40 Ugli fruit
41 Yuzu
Use Keyboard buttons Ctrl (Command on MAC), Shift or none with left mouse click.
First example (left list) uses element id as output values. Second example (right list) uses element data-value attribute as output values.


It is super-fast, simple in settings, 100% safe and styles and HTML/CSS/Datasets combinations are unlimited.

Feel free to check and explore examples from above.

Elements in lists can be div, a, li, even p or tr/td (following the HTML Standard), and they can differ from one list to another on the same web page.
List unique element class is a main selector. That is: for all selectable elements in one list, it has to be the same class name.

Number of lists (sets of elements determined by the same class name) is not limited per one document.
One can even split one list to as many lists as needed with same class selector and only one instance of this function.

The class is easily initialized via main selector and only a handful of optional settings:


var leftItemsClass, rightItemsClass;

// One can set-up unlimited number of lists, in this example we used only two.
window.addEventListener("load", function () {

	// LEFT SELECTION
	leftItemsClass = $('.sels').CSMouse('sels', {
		{
			first:  "first_sels",		// First clicked index storage.
			last:   "last_sels",		// Last clicked index storage.
			values: "sels_values",		// List of all selected values storage (DOM indexes).
			items:  "sels_items",		// Initialization list setting storage (usually returned by server):
										// (Or any unique server parsable attribute set), for example:
										// elem_1,elem_2,elem_3,...
										// It is element id attribute list delimited with comma on DOM load.
										// If not set, CSMOUSE will create items with your HTML list(s).
										// First three are dynamically created and maintained.
			color:  "sels-blue",		// Selected indicating class; There are two coloring classes. 
										// One is :hover and the other is this (color). 
										// Both must be defined in proper cascading order, like:
										// .selector:hover and .selector.color, for example: 
										// .sels:hover {background-color: #fedcba;} and 
										// .sels.sels-blue {background-color: #abcdef;}; 
										// This way, a :hover style will be overlapped with .selector.color, 
										// when element is selected;
										// Defining them without cascading order will not work, so no good: 
										// .sels:hover{}, .sels-blue{}
			all:    "sel_all",			// Select all elements button/link.
			none:   "unsel_all",		// Un-select all elements button/link.
			togg:	"toggle",			// Toggle selected elements button/link.
										// All, None and Toggle buttons are optional for use.
										// All three functions can be reached on global document scope, and
										// with no arguments.
			cnt:    "display_counter",	// Selected elements counter (recalculated on each click).
			elems:	"total_elems",		// Total elements counter (initialized on function init).
										// cnt and elems HTML elements are optional for use.
										// Both of functions can be reached on global document scope, and
										// with no arguments.
			json:   "json",				// JSON output formatter button/link. Global scope too.
			serial: "serial",			// Serialize output formatter button/link. Global scope too.
			output:	"id",				// Output attribute (can be any, should be unique id attribute).
			debug:  true				// Debug mode, should be set to false in production mode.
		}
	);

	// RIGHT SELECTION
	rightItemsClass = $('.sels').CSMouse('sels2', {
		{
			first:  "first_sels2",
			last:   "last_sels2",
			values: "sels_values2",
			items:  "sels_items2",
			color:  "sels-red",
			all:    "sel_all2",
			none:   "unsel_all2",
			togg:	"toggle2",
			cnt:    "display_counter2",
			elems:	"total_elems2",
			json:   "json2",
			serial: "serial2",
			output:	"data-value",
			debug:  true
		}
	);

});
			

Element ID (or any data- like argument, or any) can be set as an output. It exports selected items via JSON or form serialization formats.

The most interesting functions to use outside CSMOUSE are output functions - selected elements to be passed to server (or whatever) and counters. Here are examples of code on above buttons:


// Following functions shows external usage of some CSMOUSE functions (can be applied to all,
// for example if you use single submit button for all lists, play with combos here)
function getJSONLeft(){

	var a = leftItemsClass.getSelectedJSON();
	alert(a);

}
function getSerializedLeft(){

	var b = leftItemsClass.getSelectedSerialize();
	alert(b);

}
function getJSONRight(){

	var a = rightItemsClass.getSelectedJSON();
	alert(a);

}
function getSerializedRight(){

	var b = rightItemsClass.getSelectedSerialize();
	alert(b);

}
function numberSelectedLeft(){

	var c = leftItemsClass.getSelected();
	alert(c);

}
function numberSelectedRight(){

	var d = rightItemsClass.getSelected();
	alert(d);

}
			

Functions can be called anywhere from your web application (anchor, button, whatever with onClick event (or any event)):


...onclick="javascript: getJSONLeft();">OUTPUT LEFT JSON<...
...onclick="javascript: getSerializedLeft();">OUTPUT LEFT SERIALIZED<...
...onclick="javascript: numberSelectedLeft();">COUNT<...
...onclick="javascript: numberSelectedRight();">COUNT<...
...onclick="javascript: getSerializedRight();">OUTPUT RIGHT SERIALIZED<...
...onclick="javascript: getJSONRight();">OUTPUT RIGHT JSON<...
			

Of course, one can use completely it's own logics as needed. These are just examples.
Maybe combinations of selections from multiple lists, maybe anything.
This functionality is pure base for your imagination, creativity, engineering or developer demand tasks. VoilĂ .

This version relies on jQuery JavaScript (on any platform). There is, of course, our pure JavaScript veggies function implementation here.

Plugin can be downloaded here.
Available through Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License.
For commercial or any enterprise use, please contact us at copyright@geowith.us.
This functionality is yet not available for mobile platforms. Visit soon.