()
| 158 | }; |
| 159 | |
| 160 | function bind() { |
| 161 | window.cm = new CommentManager($('commentCanvas')); |
| 162 | cm.init(); |
| 163 | |
| 164 | var tmr = -1; |
| 165 | var start = 0; |
| 166 | var playhead = 0; |
| 167 | |
| 168 | $("control-stop").addEventListener("click", function(e) { |
| 169 | if (e && e.preventDefault) |
| 170 | e.preventDefault(); |
| 171 | stop(); |
| 172 | }); |
| 173 | |
| 174 | $("control-resume").addEventListener("click", function(e) { |
| 175 | if (e && e.preventDefault) |
| 176 | e.preventDefault(); |
| 177 | resume(); |
| 178 | }); |
| 179 | |
| 180 | $("control-reset").addEventListener("click", function(e) { |
| 181 | if (e && e.preventDefault) |
| 182 | e.preventDefault(); |
| 183 | playhead = 0; |
| 184 | start = (new Date()).getTime(); |
| 185 | cm.clear(); |
| 186 | }); |
| 187 | |
| 188 | $("w-main").addEventListener("keydown", function(k) { |
| 189 | if (k) { |
| 190 | if (k.keyCode === 70) { |
| 191 | state.format = (state.format === "hrf" ? "std" : "hrf"); |
| 192 | } else if (k.keyCode === 32) { |
| 193 | if (tmr < 0) { |
| 194 | resume(); |
| 195 | } else { |
| 196 | stop(); |
| 197 | } |
| 198 | } else if (k.keyCode === 66) { |
| 199 | $("player").style.backgroundColor = "#000"; //b |
| 200 | $("c-region").style.color = "#fff"; |
| 201 | } else if (k.keyCode === 87) { |
| 202 | $("player").style.backgroundColor = "#fff"; //w |
| 203 | $("c-region").style.color = "#000"; |
| 204 | } else if (k.keyCode === 82) { |
| 205 | var x = prompt("Resize player window (WxH or 'old','new')"); |
| 206 | if (x) { |
| 207 | if (x === "new") |
| 208 | x = "672x438"; |
| 209 | if (x === "old") |
| 210 | x = "512x384"; |
| 211 | var wh = x.split("x"); |
| 212 | var w = parseInt(wh[0]); |
| 213 | var h = parseInt(wh[1]); |
| 214 | if (w > 0 && h > 0) { |
| 215 | $("player").style.height = h + "px"; |
| 216 | $("player-unit").style.width = w + "px"; |
| 217 | if (cm) |
no test coverage detected