dqt

0.1.0 • Public • Published

dqt

npm license github-issues Circle CI build status

Techology for create one button controlled interfaces.

nodei.co

travis-status stars forks

forks

About

Do you know a man who can press only one button? Maybe. But i think you don't. In world many people wanna use your site, but can't. With this library you can create interface for them. Free and fast.

Demo

Install

npm install --save dqt

Example

var DQT = require("dqt");
var dqt = new DQT([['mum', 'dad'], ['son', 'dauther']]);
 
dqt.on('step', console.log).on('choosen', console.log);
process.stdin.on('data', (data)=>{
   dqt.emit('click');
});

Let's go with JQuery. Link navigation

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
      <ul>
        <li><a href="http://vk.com">vk</a></li>
        <li><a href="http://facebook.com">facebook</a></li>
        <li><a href="http://yandex.ru">yandex</a></li>
        <li><a href="http://google.ru">google</a></li>
      </ul>
      <button type="button" id="button">Choose</button>
      <script type="text/javascript" src="dqt.browser.js"></script> 
      <script type="text/javascript" src="http://code.jquery.com/jquery-2.2.1.min.js"></script> 
      <script type="text/javascript">
        var links = Array.prototype.slice.apply(document.querySelectorAll('a'));
 
        var dqt = new DQT(DQT.group(links)]);
        var prev;
        dqt.on('step', (el, x, y)=>{
          if (prev!=null) prev.toggle( "bounce" )
          prev = ($(el).toggle( "bounce" ));
        }).on('choosen', (el)=>{
 
          console.log('chosse',el);
          if (Array.isArray(el)) return;
          window.location.replace(el.href);
        });
        document.getElementById('button').onclick = ()=>{
          dqt.emit('click');
        };
      </script> 
  </body>
</html>
 

Scripts

  • npm run test : node test.js
  • npm run browserify : browserify index.js > dqt.browser.js

API

DQT extends EventEmitter. You create object of DQT.

DQT

Class representing dqt model.

constructor

Create a dqt.

Params:
  • array set - The set for chossen.
  • number interval - The timeout of choose.

Events

  • step, call in each timeout, Params is choosen element {Object} and x, y {number}
  • choose, call when user choose something, group or element.
  • click, you should emit it, oh you should do it.

Contributing

Contributions welcome; Please submit all pull requests the against master branch.Thanks!

Author

ibakaidov

License

Package Sidebar

Install

npm i dqt

Weekly Downloads

1

Version

0.1.0

License

ISC

Last publish

Collaborators

  • ibakaidov