PageSourceSearch

https://melodic.net/app/controllers/PollController.js

js melodic.net collected 2026-10-02 10:14:17 UTC 4,295 bytes, 203 lines download raw bytes

1app.controller('PollController', function($scope, $http) {
2
3	$scope.pools = [];
4
5});
6
7
8
9app.controller('PollController', function(dataFactory, $scope, $routeParams,
10		$http, $rootScope, $window, $sce) {
11	
12
13	
14	var idParam = $routeParams.id;
15	
16	$scope.pollIdentifier = idParam;
17	
18	$scope.trustAsHtml = $sce.trustAsHtml;
19	$scope.loadingNews = true;
20	$scope.loadingRecommendations = true;
21	
22	
23	fetchPoll(idParam);
24	//fetchComments(idParam);
25	//fetchUserData();
26	fetchUpcomingReleases();
27	
28	$scope.selectedList = {};
29    
30	/**
31	 * Action
32	 */
33	$scope.submit = function () {
34				
35	    angular.forEach($scope.selectedList, function (selected, day) {
36	        if (selected) {
37	           console.log(day);
38	        //   alert(day);
39	       //    alert($scope.pollId);
40	           postSubmitItem(day);
41	        }
42	    });
43	    $("#submitPoll").attr("disabled","disabled");
44	    fetchPoll($scope.pollIdentifier);
45	    
46	};
47	
48	
49	
50	function postSubmitItem(id){
51		
52		$http({
53			method : 'post',
54			url : '?page=Poll&action=submitPoll',
55			data : JSON.stringify({
56				id : $scope.pollId,
57				selectedId : id
58			}), // forms user object
59			headers : {
60				'Content-Type' : 'application/x-www-form-urlencoded'
61			}
62		}).then(function(data) {		
63			$rootScope.adminLoggedIn = data.data.adminLoggedIn;
64			$rootScope.userLoggedIn = data.data.memberLoggedIn;
65			$rootScope.userType = data.data.userType;			
66		});
67	}
68	
69	
70
71	function fetchUserData() {
72		
73		$http({
74			method : 'post',
75			url : '?page=Auth&action=isUserLoggedIn',
76			data : JSON.stringify({
77			}), // forms user object
78			headers : {
79				'Content-Type' : 'application/x-www-form-urlencoded'
80			}
81		}).then(function(data) {		
82			$rootScope.adminLoggedIn = data.data.adminLoggedIn;
83			$rootScope.userLoggedIn = data.data.memberLoggedIn;
84			$rootScope.userType = data.data.userType;			
85		});
86	}
87	
88	
89	function fetchPoll(aIdParam) {
90				
91		$http({
92			method : 'post',
93			url : '?page=Poll&action=fetchPoll',
94			data : JSON.stringify({
95				id : aIdParam
96			}), // forms user object
97			headers : {
98				'Content-Type' : 'application/x-www-form-urlencoded'
99			}
100		}).then(function(data) {
101			
102			$scope.topList = data.data;
103			$scope.pollName = data.data[0].pollName;
104			$scope.pollId = data.data[0].pollId;
105			$scope.choiceList = data.data[0].choiceList;
106			$scope.voted = data.data[0].voted;
107			$scope.ended = data.data[0].ended;
108			$scope.loadingToplist = false;
109			str = JSON.stringify($scope.ended);
110			//alert(str);
111		});
112
113	}
114	
115function fetchUpcomingReleases() {
116		
117		$http({
118			method : 'post',
119			url : '?page=Album&action=fetchUpcomingReleases',
120			data : JSON.stringify({
121			}), // forms user object
122			headers : {
123				'Content-Type' : 'application/x-www-form-urlencoded'
124			}
125		}).then(function(data) {
126			
127			$scope.upcomingReleasesList = data.data;
128			$scope.loadingUpcomingReleases = false;
129			//str = JSON.stringify($scope.restNewsList, null, 4);
130			//alert(str);
131		});
132
133	}
134
135
136/**
137 * s
138 */
139function fetchComments(aIdParam) {
140
141	$http({
142		method : 'post',
143		url : '?page=Toplist&action=fetchComments',
144		data : JSON.stringify({
145			id : aIdParam
146		}), // forms user object
147		headers : {
148			'Content-Type' : 'application/x-www-form-urlencoded'
149		}
150	}).then(function(data) {
151
152		$scope.comments = data.data;
153		$scope.loadingCompanies = false;
154		$scope.totalItems = $scope.comments.length;
155
156		str = JSON.stringify(data, null, 4);
157		
158		//alert(str);
159	});
160
161}
162	
163	
164	
165	$scope.addComment = function () {
166		
167		var tName = $scope.selectedName;
168		var tEmail = $scope.selectedEmail;
169		var tComment = $scope.selectedComment;
170		var tResponseCode = grecaptcha.getResponse();
171		var idParam = $routeParams.id; 
172		$("#successBox").hide(200);
173		
174		$http({
175			method : 'post',
176			url : '?page=Toplist&action=addComment',
177			data : JSON.stringify({
178				id : idParam,
179				name : tName,
180				email : tEmail,
181				comment : tComment,
182				responseCode : tResponseCode
183			}), // forms user object
184			headers : {
185				'Content-Type' : 'application/x-www-form-urlencoded'
186			}
187		}).then(function(data) {
188			str = JSON.stringify(data, null, 4);
189			$scope.selectedName = "";
190			$scope.selectedEmail = "";
191			$scope.selectedComment = "";
192			//alert(str);
193
194			$("#successBox").delay(500).fadeIn(500);
195			scrollToSection('commentStart');
196			fetchComments(idParam);
197		});
198				
199    }
200	
201
202
203});

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.