<commit_before>/**
 * Load the stored sources for the tab URL. The schema for the
 * source is as follows. We have 6 groups of Sources. They are,
 * Images, Quotations, Text+Images, Files, Videos and All.
 * Each group has more than 1 sources. The groups have the following
 * properties:
 * icon - the icon name for the group (from core-iconset)
 * enabled - if the group is enabled
 * sources - the sources in this group
 *
 * Sources is a collection of objects with the following properties:
 * url - the url to be used for google searching
 * enabled - if this source is enabled
 *
 * Here is the entire schema layed out. This is how data is stored in the sync storage.
 *
 * <tab_url> <----> <item>
 * (key)           (value)
 *
 * <item> = {{title0: group0},{title1: group1},....,{titleN: groupN}}
 *
 * <title> : { icon: 'core-image',
 *             enabled: true,
 *             sources: <sources>
 *           }
 *
 * <sources> = {{title0 : source0}, {title1 : source1},....,{titleN: sourceN} }
 *
 * <title> : { url: 'flickr.com',
 *             enabled: true,
 *           }
 */

(function () {
  var currentItem = {};
  var storage = null;
  var port;

  var defaults = {
    'Images': {
      'icon': 'drive-image',
      'enabled': true,
      'sources': {
        'Google Images': {
          url: 'google.com',
          enabled: true
        },
        'Flickr': {
          url: 'flickr.com',
          enabled: true
        }
      }
    },
    'Quotations': {
      'icon': 'editor:format-color-text',
      'enabled': false,
      'sources': {
        'iHeart Quotes': {
          url: 'iheartquotes.com',
          enabled: false
        },
        'They said so!': {
          url: 'theysaidso.com',
          enabled: false
        }
      }
    },
    'Files': {
      'icon': 'editor:insert-drive-file',
      'enabled': true,
      'sources': {
        'Google Drive': {
          title: 'Google Drive',
          enabled: true
        }
      }
    }
  };

  /* Uncomment to over write the sync storage */
  //chrome.storage.sync.remove(url);

  function loadSources(url,result) {
    if (result.hasOwnProperty(url)){
      console.log('EP-SOURCES-STORAGE:result:' + result[url]);
      currentItem[url] = result[url];<commit_msg>[ep-sources-storage] Add sources from UX doc<commit_after>/**
 * Load the stored sources for the tab URL. The schema for the
 * source is as follows. We have 6 groups of Sources. They are,
 * Images, Quotations, Text+Images, Files, Videos and All.
 * Each group has more than 1 sources. The groups have the following
 * properties:
 * icon - the icon name for the group (from core-iconset)
 * enabled - if the group is enabled
 * sources - the sources in this group
 *
 * Sources is a collection of objects with the following properties:
 * url - the url to be used for google searching
 * enabled - if this source is enabled
 *
 * Here is the entire schema layed out. This is how data is stored in the sync storage.
 *
 * <tab_url> <----> <item>
 * (key)           (value)
 *
 * <item> = {{title0: group0},{title1: group1},....,{titleN: groupN}}
 *
 * <title> : { icon: 'core-image',
 *             enabled: true,
 *             sources: <sources>
 *           }
 *
 * <sources> = {{title0 : source0}, {title1 : source1},....,{titleN: sourceN} }
 *
 * <title> : { url: 'flickr.com',
 *             enabled: true,
 *           }
 */

(function () {
  var currentItem = {};
  var storage = null;
  var port;

  var defaults = {
    'Images': {
      'enabled': true,
      'sources': {
        'Google Images': {
          url: 'google.com',
          enabled: true
        },
        'Flickr': {
          url: 'flickr.com',
          enabled: true
        },
        'Instagram': {
          url: 'instagram.com',
          enabled: true
        },
        'Pinterest': {
          url: 'pinterest.com',
          enabled: true
        },
        'Wikimedia commons': {
          url: 'wikimedia.org',
          enabled: true
        }
      }
    },
    'Articles': {
      'enabled': true,
      'sources': {
        'Yahoo! news': {
          url: 'news.yahoo.com',
          enabled: true
        },
        'Google news': {
          url: 'news.google.com',
          enabled: true
        },
        'BBC news': {
          url: 'bbc.co.uk',
          enabled: true
        },
        'The Guardian': {
          url: 'theguardian.com',
          enabled: true
        },
        'CNN': {
          url: 'cnn.com',
          enabled: true
        },
        'New York Times': {
          url: 'nytimes.com',
          enabled: true
        },
        'Wikipedia': {
          url: 'wikipedia.org',
          enabled: true
        },
        'Google Books': {
          url: 'books.google.com',
          enabled: true
        },
        'TED': {
          url: 'www.ted.com/topics/news',
          enabled: true
        },
        'Twitter': {
          url: 'twitter.com',
          enabled: true
        },
        'Quora': {
          url: 'quora.com',
          enabled: true
        }
      }
    },
    'Quotations': {
      'enabled': false,
      'sources': {
        'iHeart Quotes': {
          url: 'iheartquotes.com',
          enabled: false
        },
        'They said so!': {
          url: 'theysaidso.com',
          enabled: false
        }
      }
    },
    'Files': {
      'enabled': true,
      'sources': {
        'Google Drive': {
          title: 'Google Drive',
          enabled: true
        }
      }
    }
  };

  /* Uncomment to over write the sync storage */
  //chrome.storage.sync.remove(url);

  function loadSources(url,result) {
    if (result.hasOwnProperty(url)){
      console.log('EP-SOURCES-STORAGE:result:' + result[url]);
      currentItem[url] = result[url];
{'fraction_non_alphanumeric': 0.14223839223839224, 'fraction_numerical': 0.003465003465003465, 'mean_word_length': 1.6926305970149254, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, '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': '2253654', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1730, 'n_words': 500}