PageRenderTime 1440ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/docs.js

https://github.com/krishnapvin/angular-timer
JavaScript | 37 lines | 33 code | 4 blank | 0 comment | 6 complexity | befe61b8792390af9b3bd3016363326d MD5 | raw file
Possible License(s): Apache-2.0
  1. function startTimer(sectionId) {
  2. document.getElementById(sectionId).getElementsByTagName('timer')[0].start();
  3. }
  4. function stopTimer(sectionId) {
  5. document.getElementById(sectionId).getElementsByTagName('timer')[0].stop();
  6. }
  7. function addCDSeconds(sectionId, extraTime) {
  8. document.getElementById(sectionId).getElementsByTagName('timer')[0].addCDSeconds(extraTime);
  9. }
  10. function stopResumeTimer(sectionId, btn) {
  11. if (btn.innerHTML === 'Start') {
  12. document.getElementById(sectionId).getElementsByTagName('timer')[0].start();
  13. btn.innerHTML = 'Stop';
  14. }
  15. else if (btn.innerHTML === 'Stop') {
  16. document.getElementById(sectionId).getElementsByTagName('timer')[0].stop();
  17. btn.innerHTML = 'Resume';
  18. }
  19. else {
  20. document.getElementById(sectionId).getElementsByTagName('timer')[0].resume();
  21. btn.innerHTML = 'Stop';
  22. }
  23. }
  24. angular.module('timer-demo',['timer']).controller('TimerDemoController',['$scope', function ($scope) {
  25. $scope.linkAnchors = function () {
  26. $('ul.nav a').click(function (){
  27. var path = $(this).attr('href');
  28. if (path != '#') {
  29. window.location = path;
  30. }
  31. });
  32. };
  33. }]);