<commit_before>/**
 * TODO highlight matches
 * - glyphs fatsoenlijk maken
 * - sowieso de resultaten netjes opmaken
 * 
 */

var fc = angular.module('fc', ['ui.bootstrap']);

//TODO create a client config
var WOORDNL_MP3_BASE_URL = 'http://os-immix-w/woord-nl-mp3/';

/* Main controller */
fc.controller('feedCtrl', function ($scope, $sce) {
	
	/****************************************************************************/
	/* SCOPE VARIABLES */
	/****************************************************************************/
	
	$scope.feedItems = [];
	$scope.selectedFeedItem = null;
	$scope.selectedSource = null;
	$scope.lastMessage = 0;
	$scope.loading = false;
	
	/****************************************************************************/
	/* AJAX FUNCTIONS */
	/****************************************************************************/
	
	$scope.longPoll_feed = function() {
		console.debug('Long polling...');
		$.ajax({
				dataType: 'json',
				type: "GET",
				url: "/woordnl-fc/real_time_feed?since=" + $scope.lastMessage,
				error: function () {
					setTimeout($scope.longPoll_feed, 10*1000);
				},
				success: function (json) {
					$scope.$apply($scope.storeFeedItems(json));
					$scope.loading = false;
					$scope.longPoll_feed();
				}
			});
	}
	
	$scope.processFeed = function() {
		$scope.loading = true;
		var myUrl = "/woordnl-fc/add_rss_feed?url=" + encodeURIComponent($scope.feedURL);
		alert( myUrl);
		$.ajax({
			cache: false,
			dataType: 'json',
			type: "GET",
			url: "/woordnl-fc/add_rss_feed?url=" + encodeURIComponent($scope.feedURL),
			error: function () {
				console.debug('error');
				$scope.loading = false;
			},
			success: function (json) {
				console.debug('success');
			}
		});
	}
	
	$scope.addItemToFeed = function() {
		json = eval("({'title' : 'Dit is een testbericht', 'summary' : 'Hiermee test men de werking van het systeem'})");
		$.ajax({
			cache: false,
			dataType: 'text',<commit_msg>Fixed the URL bug with the RSS feed. Use encodeURIComponent<commit_after>/**
 * TODO highlight matches
 * - glyphs fatsoenlijk maken
 * - sowieso de resultaten netjes opmaken
 * 
 */

var fc = angular.module('fc', ['ui.bootstrap']);

//TODO create a client config
var WOORDNL_MP3_BASE_URL = 'http://os-immix-w/woord-nl-mp3/';

/* Main controller */
fc.controller('feedCtrl', function ($scope, $sce) {
	
	/****************************************************************************/
	/* SCOPE VARIABLES */
	/****************************************************************************/
	
	$scope.feedItems = [];
	$scope.selectedFeedItem = null;
	$scope.selectedSource = null;
	$scope.lastMessage = 0;
	$scope.loading = false;
	
	/****************************************************************************/
	/* AJAX FUNCTIONS */
	/****************************************************************************/
	
	$scope.longPoll_feed = function() {
		console.debug('Long polling...');
		$.ajax({
				dataType: 'json',
				type: "GET",
				url: "/woordnl-fc/real_time_feed?since=" + $scope.lastMessage,
				error: function () {
					setTimeout($scope.longPoll_feed, 10*1000);
				},
				success: function (json) {
					$scope.$apply($scope.storeFeedItems(json));
					$scope.loading = false;
					$scope.longPoll_feed();
				}
			});
	}
	
	$scope.processFeed = function() {
		$scope.loading = true;
		$.ajax({
			cache: false,
			dataType: 'json',
			type: "GET",
			url: "/woordnl-fc/add_rss_feed?url=" + encodeURIComponent($scope.feedURL),
			error: function () {
				console.debug('error');
				$scope.loading = false;
			},
			success: function (json) {
				console.debug('success');
			}
		});
	}
	
	$scope.addItemToFeed = function() {
		json = eval("({'title' : 'Dit is een testbericht', 'summary' : 'Hiermee test men de werking van het systeem'})");
		$.ajax({
			cache: false,
			dataType: 'text',
{'fraction_non_alphanumeric': 0.3075330054361895, 'fraction_numerical': 0.004659590991457417, 'mean_word_length': 4.024707412223667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4656623', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1184, 'n_words': 236}