| <html> |
| <head> |
| <title>commands-sk demo</title> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> |
| <script src="/res/common/js/common.js"></script> |
| <script src="/res/imp/bower_components/webcomponentsjs/webcomponents-lite.js"></script> |
| <link rel=import href="/res/imp/bower_components/polymer/polymer.html"> |
| <link rel="stylesheet" href="/res/common/css/md.css" type="text/css" media="all"> |
| <link rel=import href="commands.html"> |
| <style type="text/css" media="screen"> |
| #wrapper { |
| width: 40em; |
| margin: auto; |
| } |
| </style> |
| </head> |
| <body> |
| <h1>Commands Demo</h1> |
| |
| <button id="to">301</button> |
| <button id="prev">Prev</button> |
| <button id="next">Next</button> |
| <div id=wrapper> |
| <commands-sk id=cmds grouping=100> </commands-sk> |
| </div> |
| |
| <script type="text/javascript" charset="utf-8"> |
| var data = { |
| version: 1, |
| commands: [ |
| { |
| details: |
| { command: "BeginDrawPicture" }, |
| _index: 0, |
| _depth: 0, |
| _prefix: [{icon: "image:image", color:"#A6CEE3"}] |
| }, |
| { |
| details: { command:"Save" }, |
| _index: 1, |
| _depth: 1, |
| _prefix: [{icon: "image:image", color: "#A6CEE3"}] |
| }, |
| ] |
| }; |
| for (var i = 0; i < 10003; i++) { |
| data.commands.push({ |
| details: { command:"BeginDrawPicture" }, |
| _index: i+2, |
| _depth: 0, |
| _prefix: [{icon: "image:image", color: "#A6CEE3"}] |
| } |
| ); |
| } |
| $$$('#cmds').cmd = data; |
| $$$('#to').addEventListener('click', function() { |
| $$$('#cmds').item = 301; |
| $$$('#cmds').scrollToTop(301); |
| }); |
| $$$('#next').addEventListener('click', function() { |
| $$$('#cmds').item = ($$$('#cmds').item + 1) % data.commands.length; |
| $$$('#cmds').scrollToTop($$$('#cmds').item); |
| }); |
| $$$('#prev').addEventListener('click', function() { |
| var item = $$$('#cmds').item-1; |
| if (item < 0) { |
| item = data.commands.length-1; |
| } |
| $$$('#cmds').item = item; |
| $$$('#cmds').scrollToTop(item); |
| }); |
| </script> |
| </body> |
| </html> |
| <html> |