Created by TheMitoSan, this is a simple plugin for managing css and HTML stuff without jQuery.
[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!
Apply CSS style on a DOM Element.
TMS.css('myDiv', {'width': '1920px', height: '1080px'});
Gives focus to a specific DOM Element.
TMS.focus('myButton');
This function will focus a DOM Element inside a scrollable list, making it centered.
TMS.scrollCenter('betrayDiv');
This will append a specified CSS class to a DOM Element.
TMS.addClass('myDiv', 'fixWidth');
This will remove some specific class from a DOM Element.
TMS.removeClass('myDiv', 'fixWidth');
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);