Skip to content

This is a simple plugin for managing CSS and HTML suff without jQuery.

License

Notifications You must be signed in to change notification settings

themitosan/TMS.js

Repository files navigation


TMS.js
license build_status

Created by TheMitoSan, this is a simple plugin for managing css and HTML stuff without jQuery.

Setup

[TS] - It's deadly simple!

  • Download TMS.ts file and put it among your source files
  • Use a simple import to carry what you will need.
    Example: import * as TMS from './TMS.js';
  • Smile: you are a great person!

Here is a preview of how to use some commands:

TMS.css(domId, cssChanges)

Apply CSS style on a DOM Element.

TMS.css('myDiv', {'width': '1920px', height: '1080px'});

TMS.focus(domId)

Gives focus to a specific DOM Element.

TMS.focus('myButton');

TMS.scrollCenter(domId)

This function will focus a DOM Element inside a scrollable list, making it centered.

TMS.scrollCenter('betrayDiv');

TMS.addClass(domId, className)

This will append a specified CSS class to a DOM Element.

TMS.addClass('myDiv', 'fixWidth');

TMS.removeClass(domId, className)

This will remove some specific class from a DOM Element.

TMS.removeClass('myDiv', 'fixWidth');

Context

You can also provide other contexts for all available functions. This allows you to manipulate data from other windows (like nwjs nw.Window.open function).

Example:

/*
	Using TMS.js context with TS
*/

// Import module and create context variable
import * as TMS from './TMS';
var context:Document;

// Open window
nw.Window.open('project/somePage.html', {}, function(data:any){
	context = data.window.document;
});

// Set div CSS data from new opened window by providing context
TMS.css('someDivInsideNewWindow', { 'width': '100%', height: '20px' }, context);

External scripts / plugins used on this project:

Many Thanks To: