1'use strict'; 2 3 4 5(function (angular) { 6 var app = angular.module('ybmApp'); 7 app.controller('viewLessonCtrl', ViewLessonCtrl); 8 9 function ViewLessonCtrl($location, $scope, $rootScope, proxy, $timeout, utils, $anchorScroll/*, $mdDialog*/) { 10 utils.goToTop(); 11 this.rootScope = $rootScope; 12 this.location = $location; 13 this._proxy = proxy; 14 this.anchorScroll = $anchorScroll; 15 //this.$sce = $sce; 16 var self = this; 17 this.utils = utils; 18 this.scope = $scope; 19 this.scope.ic.header = ''; 20 //this.$mdDialog = $mdDialog; 21 22 console.log(this); 23 24 var f = this.location.search().format; 25 26 this.lessonId = this.location.search().lesson; 27 28 29 30 this.curLesson = { 31 Id: parseInt(this.lessonId) 32 }; 33 34 35 36 this.format = ''; 37 if (f == 'A') 38 this.format = 'Audio'; 39 else if (f=='V') { 40 this.format = "Video"; 41 } else if (f == 'H') { 42 this.format = 'Article'; 43 } 44 45 46 47 48 var p1 = this._proxy.getLessonsInSidra(this.lessonId, this.format); 49 p1.then(function (data) { 50 51 self.sidraLessons = data; 52 //self.lesson = data; 53 }); 54 55 56 57 58 var p = this._proxy.getLesson(this.lessonId,this.format); 59 p.then(function (data) { 60 self.lesson = data; 61 self.scope.ic.title = self.lesson.LessonName; 62 var h = self.lesson.LessonText.split(' '); 63 64 h.forEach(function(a) { 65 if (a.indexOf('href') > -1) { 66 var s = a.indexOf('#'); 67 if (s > -1) { 68 var e = a.lastIndexOf('"'); 69 var str = ' class="likeHref" scroll-to="' + a.substring(s + 1, e) + '"'; 70 self.lesson.LessonText = self.lesson.LessonText.replace(a, str); 71 } 72 } 73 74 75 }); 76 //indexOf('#'); 77 78 79 }); 80 81 82 var pSlider = this._proxy.getSliderLessons(); 83 pSlider.then(function(data) { 84 self.sliderLessons = data; 85 setTimeout(function () { 86 $('.flexslider').flexslider({ 87 animation: "slide", 88 animationLoop: false, 89 itemWidth: 280, 90 itemMargin: 5, 91 minItems: 2, 92 maxItems: 3 93 }); 94 }, 2000); 95 }); 96 97 98 /* var vm = this; 99 vm.currentUrl = ""; 100 // When the location changes, capture the state of the full URL. 101 $scope.$on( 102 "$locationChangeSuccess", 103 function locationChanged() { 104 vm.currentUrl = $location.url(); 105 } 106 );*/ 107 108 }; 109 110 ViewLessonCtrl.prototype.changeFormat = function(newFormat) { 111 if ((this.lesson.Format==1) || (this.lesson.Format==2)) 112 this.location.search('format', newFormat); 113 else { 114 this.location.search('lesson', this.lesson.Id); 115 this.location.search('format', newFormat); 116 } 117 }; 118 119 120 ViewLessonCtrl.prototype.setSidraLesson = function() { 121 this.sidraNextLesson(this.curLesson.Id); 122 123 }; 124 125 126 127 ViewLessonCtrl.prototype.sidraNextLesson = function(l) { 128 if (l!=-1) 129 this.location.search('lesson', l); 130 }; 131 132 133 ViewLessonCtrl.prototype.scrollTo = function(id) { 134 this.location.hash(id); 135 this.anchorScroll(); 136 }; 137 138 ViewLessonCtrl.prototype.openComment=function(ev) { 139 /*var self = this; 140 141 142 this.$mdDialog.show({ 143 locals: { dataToPass: self.lesson }, 144 controller: DialogController, 145 controllerAs: 'ctrl', 146 templateUrl: 'comment.html', 147 parent: angular.element(document.body), 148 targetEvent: ev, 149 clickOutsideToClose: true, 150 fullscreen: true 151 }) 152 .then(function (answer) { 153 var c= { 154 LessonName:self.lesson.LessonName, 155 CommentText:answer 156 } 157 var p = self._proxy.commentLesson(); 158 console.log(c); 159 }, function() { 160 161 }); 162 */ 163 164 } 165 166 167 function DialogController($scope, $mdDialog, dataToPass) { 168 169 $scope.mdDialogData = dataToPass; 170 171 /*$scope.hide = function () { 172 $mdDialog.hide(); 173 }; 174 175 $scope.cancel = function () { 176 $mdDialog.cancel(); 177 };*/ 178 179 $scope.ok = function () { 180 181 $mdDialog.hide($scope.mdDialogData.comment); 182 }; 183 } 184 185 186 187 188})(angular);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.