<commit_before>// @todo @release change metaUrl

angular
  .module('app')
  .factory('MetaMachine', function($rootScope, $location) {
     
    var removeHash = function(url) {
        return url.replace('#!/', '');
    };
        
    var base = $location.absUrl().replace($location.path(), '');
    base = removeHash(base);

    var metaDefaults = {
      metaType: "website",
      metaName: "Rootstrikers",
      metaTitle: "Home | Rootstrikers",
      metaDescription: "We fight the corrupting influence of money in politics",
      metaImage: base + "app/images/favicon/RS_Facebook_Icon.jpg",
      metaUrl: base
    };

    (function setDefaults() {
      _.each(metaDefaults, function(val, key) { $rootScope[key] = val; });
    })();

    var MetaMachine = {
      title: function(pageTitle, baseTitle) {
        baseTitle = typeof baseTitle != 'undefined' ? baseTitle : "Rootstrikers";
        $rootScope.metaTitle = typeof pageTitle != 'undefined' ? pageTitle + " | " + baseTitle : baseTitle;
      },
      description: function(description) {
        $rootScope.metaDescription = description || metaDefaults.metaDescription;
      },
      image: function(url) {
        $rootScope.metaImage = url || metaDefaults.metaImage;
      },
      url: function(url) {
        $rootScope.metaUrl = url || metaDefaults.metaUrl;
      }
    };
    return MetaMachine;
  });<commit_msg>Update MetaMachine service to use jQuery selectors instead of binding in order to update DOM attributes. <commit_after>// @todo @release change metaUrl

angular
  .module('app')
  .factory('MetaMachine', function($rootScope, $location) {

    // ************************************************************************ //
    // *************************** PRIVATE METHODS **************************** //
    // ************************************************************************ //
    var metaDefaults = {
      metaType: "website",
      metaName: "Rootstrikers",
      metaTitle: "Home | Rootstrikers",
      metaDescription: "We fight the corrupting influence of money in politics",
      metaImage: base + "app/images/favicon/RS_Facebook_Icon.jpg",
      metaUrl: base
    };

    var removeHash = function(url) {
        return url.replace('#!/', '');
    };
        
    var base = $location.absUrl().replace($location.path(), '');
    base = removeHash(base);

    var stripHTML = function(text) {
      return text.replace(/(<([^>]+)>)/ig,"");
    };

    // ************************************************************************ //
    // ************************** PUBLIC INTERFACE  *************************** //
    // ************************************************************************ //
    var MetaMachine = {
      title: function(pageTitle, baseTitle) {
        baseTitle = typeof baseTitle != 'undefined' ? baseTitle : "Rootstrikers";
        fullTitle = typeof pageTitle != 'undefined' ? pageTitle + " | " + baseTitle : baseTitle;
        $('title').text(fullTitle);
        $('meta[property="og:title"]').attr('content', fullTitle);
      },
      description: function(description) {
        description = stripHTML(description) || metaDefaults.metaDescription;
        $('meta[property="og:description"]').attr('content', description);
        $('meta[name="description"]').attr('content', description);
      },
      image: function(url) {
        metaImage = url || metaDefaults.metaImage;
        $('link[rel="image_src"]').attr('href', metaImage);
        $('meta[property="og:image"]').attr('content', metaImage);
      },
      url: function(url) {
        metaUrl = url || metaDefaults.metaUrl;
        $('meta[property="og:url"]').attr('content', metaUrl);
      }
    };
    return MetaMachine;
  });
{'fraction_non_alphanumeric': 0.24638457418318158, 'fraction_numerical': 0.0, 'mean_word_length': 3.2443181818181817, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, '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': '3422871', 'n_tokens_mistral': 1027, 'n_tokens_neox': 975, 'n_words': 203}