<commit_before>'use strict';

var App = angular.module('RSSFeedApp', []);

App.controller("FeedCtrl", ['$scope','FeedService', function ($scope,Feed) {    
    $scope.loadButonText="Load";
        $scope.allFeeds = [{titleText:"CodeProject C#",url:"http://www.codeproject.com/webservices/articlerss.aspx?cat=3"}, 
                        {titleText:"ComputerWorld - News",url:"http://www.computerworld.com/index.rss"},
                        {titleText:"<NAME>",url:"http://www.drdobbs.com/rss/all"},
                        {titleText:"InfoWorld Today's News",url:"http://www.infoworld.com/news/feed"},
                        {titleText:"Inc. Magazine",url:"http://www.inc.com/rss/homepage.xml"},
                        {titleText:"TechCrunch",url:"http://feeds.feedburner.com/TechCrunch"},
                        {titleText:"CNN",url:"http://rss.cnn.com/rss/cnn_topstories.rss"}
                        ];
                        
    $scope.loadFeed=function(e){        
        Feed.parseFeed($scope.feedSrc).then(function(res){
            $scope.feeds=res.data.responseData.feed.entries;
            setTimeout (getMsg,500);
        });
    }


}]);

App.factory('FeedService',['$http',function($http){
    return {
        parseFeed : function(url){
            return $http.jsonp('http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=50&callback=JSON_CALLBACK&q=' + encodeURIComponent(url));

        }
    }
}]);

    remove();

    

function getMsg(e) {

    var header=document.querySelectorAll('ul.unstyled li h5');
    for (var i=0;i<header.length;i++){
        header[i].onclick=function() {
            var head=this.getElementsByTagName('a')[0].innerHTML;
            var content_wrap=document.createTextNode('div');
            var content=convertSpecSymbols(this.parentNode.getElementsByClassName('hidden_paragraph')[0].innerHTML);
            document.getElementById('msgTitle').innerHTML=head;
            document.getElementById('msgContent').innerHTML= content;
            /*---count symbol repeats-------------*/
            var str=content.toString().replace(/<\/?[^>]+>/g,'').toLowerCase();
            

            symbols_number(str);

        }
    }
    
}
function remove(e) {
    var remove_buttons=document.querySelectorAll('button.remove');
        for (var i=-0;i<remove_buttons.length;i++) {
            remove_buttons[i].onclick=function() {
            this.parentNode.parentNode.removeChild(this.parentNode);
        }
        
    }
}

function convertSpecSymbols (str, toText) {
  var
    symbols = [
      ['&amp;',     '&'],
      ['&lt;',      '<'],
      ['&gt;',      '>'],
      ['&and;',     '^'],
      ['&sim;',     '~']
    ],
    pos = -1;
 
  if (typeof toText == 'undefined' || toText) {
    for (var i = 0, n = symbols.length; i < n; i++) {
      while ((pos = str.indexOf(symbols[i][0], pos + 1)) != -1) {
        str = str.substring(0, pos) + symbols[i][1] + str.substring(pos + symbols[i][0].length);
      }
    }
  } else {
    for (var i = 0, n = symbols.length; i < n; i++) {
      while ((pos = str.indexOf(symbols[i][1], pos + 1)) != -1) {
        str = str.substring(0, pos) + symbols[i][0] + str.substring(pos + symbols[i][1].length);
      }
    }
  }
  return str;
}


function symbols_number(str){
        var letters=new Array();
        var numbers=new Array();
        var percent=new Array();
        var total_numbers=str.replace(/[^A-Z]/gi, "").length;<commit_msg>Update rss.js<commit_after>'use strict';

var App = angular.module('RSSFeedApp', []);
/*---controller----*/
App.controller("FeedCtrl", ['$scope','FeedService', function ($scope,Feed) {    
    $scope.loadButonText="Load";
        $scope.allFeeds = [{titleText:"CodeProject C#",url:"http://www.codeproject.com/webservices/articlerss.aspx?cat=3"}, 
                        {titleText:"ComputerWorld - News",url:"http://www.computerworld.com/index.rss"},
                        {titleText:"<NAME>",url:"http://www.drdobbs.com/rss/all"},
                        {titleText:"InfoWorld Today's News",url:"http://www.infoworld.com/news/feed"},
                        {titleText:"Inc. Magazine",url:"http://www.inc.com/rss/homepage.xml"},
                        {titleText:"TechCrunch",url:"http://feeds.feedburner.com/TechCrunch"},
                        {titleText:"CNN",url:"http://rss.cnn.com/rss/cnn_topstories.rss"}
                        ];
     /*---load feed---*/                   
    $scope.loadFeed=function(e){        
        Feed.parseFeed($scope.feedSrc).then(function(res){
            $scope.feeds=res.data.responseData.feed.entries;
            setTimeout (getMsg,500);
        });
    }


}]);
/*---load messages---*/
App.factory('FeedService',['$http',function($http){
    return {
        parseFeed : function(url){
            return $http.jsonp('http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=50&callback=JSON_CALLBACK&q=' + encodeURIComponent(url));

        }
    }
}]);

    remove();

    
/*---function of load message from feed---*/
function getMsg(e) {

    var header=document.querySelectorAll('ul.unstyled li h5');
    for (var i=0;i<header.length;i++){
        header[i].onclick=function() {
            var head=this.getElementsByTagName('a')[0].innerHTML;
            var content_wrap=document.createTextNode('div');
            var content=convertSpecSymbols(this.parentNode.getElementsByClassName('hidden_paragraph')[0].innerHTML);
            document.getElementById('msgTitle').innerHTML=head;
            document.getElementById('msgContent').innerHTML= content;
            /*---count symbol repeats-------------*/
            var str=content.toString().replace(/<\/?[^>]+>/g,'').toLowerCase();
            

            symbols_number(str);

        }
    }
    
}
/*---remove channel function-----*/
function remove(e) {
    var remove_buttons=document.querySelectorAll('button.remove');
        for (var i=-0;i<remove_buttons.length;i++) {
            remove_buttons[i].onclick=function() {
            this.parentNode.parentNode.removeChild(this.parentNode);
        }
        
    }
}
/*---convert html symbol function----*/
function convertSpecSymbols (str, toText) {
  var
    symbols = [
      ['&amp;',     '&'],
      ['&lt;',      '<'],
      ['&gt;',      '>'],
      ['&and;',     '^'],
      ['&sim;',     '~']
    ],
    pos = -1;
 
  if (typeof toText == 'undefined' || toText) {
    for (var i = 0, n = symbols.length; i < n; i++) {
      while ((pos = str.indexOf(symbols[i][0], pos + 1)) != -1) {
        str = str.substring(0, pos) + symbols[i][1] + str.substring(pos + symbols[i][0].length);
      }
    }
  } else {
    for (var i = 0, n = symbols.length; i < n; i++) {
      while ((pos = str.indexOf(symbols[i][1], pos + 1)) != -1) {
        str = str.substring(0, pos) + symbols[i][0] + str.substring(pos + symbols[i][1].length);
      }
    }
  }
  return str;
}

/*---count number clear canvas and draw diagram--*/
function symbols_number(str){
        var letters=new Array();
        var numbers=new Array();
        var percent=new Array();
        var total_numbers=str.replace(/[^A-Z]/gi, "").length;
{'fraction_non_alphanumeric': 0.1913433253957137, 'fraction_numerical': 0.007844235887379186, 'mean_word_length': 2.2979214780600463, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2668786', 'n_tokens_mistral': 2276, 'n_tokens_neox': 2219, 'n_words': 319}