<commit_before>/* =============================================================================

  Product                 :           PoziTone
  Author                  :           PoziWorld
  Copyright               :           Copyright (c) 2013-2016 PoziWorld
  License                 :           pozitone.com/license
  File                    :           global/js/global.js
  Description             :           Global JavaScript

  Table of Contents:

    Global
      init()
      getAllCommands()
      getStorageItems()
      setStorageItems()
      showNotification()
      showNotificationCallback()
      showSystemNotification()
      removeNotification()
      saveTabsIds()
      saveActiveButtons()
      getSavedOpenTabs()
      saveOpenTabs()
      getModuleId()
      getModuleIdFromProvided()
      getModules()
      isEmpty()
      findFirstOpenTabInvokeCallback()
      checkIfModuleIsEnabled()
      getTabIdFromNotificationId()
      composeNotificationId()
      returnIndexOfSubitemContaining()
      addShortcutInfo()
      createTabOrUpdate()
      makeHttpRequest()
      checkForDevelopersMessage()
      checkForRuntimeError()
      openOptionsPage()
    On Load
      Initialize

 ============================================================================ */

/* =============================================================================

  Global

 ============================================================================ */

const
    // Developers Message
    strDevelopersMessageBannerId              = 'pwMessage'
  , strDevelopersMessageBannerNotActiveClass  = 'notActive'
  ;

var Global                        = {
    intNoVolume                   : 0

  , strNotificationIdSeparator    : strConstNotificationIdSeparator
  , strNotificationId             : strConstNotificationId // + module + tab ID
  , strSystemNotificationId       : 
      strConstNotificationId + 'system' + strConstNotificationIdSeparator
  , strNotificationIconUrl        : 'global/img/notification-icon-80.png'
  , strSystemNotificationIconUrl  :
      'global/img/pozitone-notification-icon-80.png'
  , intNotificationsClearTimeout  : 4000

  , strOptionsUiUrlPrefix         : 'chrome://extensions?options='
  , strNoTrackInfo                : '...'
  , strPlayerIsOffClass           : 'play'

  // Embedded modules (replicates manifest's "content_scripts")
  , objModules                    : {
        ru_101                    : {
            objRegex              : /(http:\/\/|https:\/\/)101.ru\/.*/
          , arrHosts              : [
                '101.ru'
            ]
          , arrOrigins            : [
                '*://101.ru/*'
            ]
          , arrJs                 : [
                'global/js/const.js'
              , 'modules/ru_101/js/uppod-player-api.js'
              , 'modules/general/js/page-watcher.js'
              , 'modules/ru_101/js/page-watcher.js'
            ]
        }
      , fm_di : {
            objRegex : /(http:\/\/|https:\/\/)www.di.fm\/.*/
          , strImageFileName : 'di-logo-120.svg'
          , arrHosts : [
                'di.fm'
              , 'audioaddict.com'
            ]
          , arrOrigins : [
                '*://*.audioaddict.com/*'
              , '*://*.di.fm/*'
            ]
          , arrJs : [
                'global/js/const.js'
              , 'modules/general/js/page-watcher.js'
              , 'modules/fm_di/js/page-watcher.js'
            ]
        }
      , ru_ok_audio               : {
            objRegex              :
              // TODO: Cover all possible “OK” URLs
              /(http:\/\/|https:\/\/)(odnoklassniki.ru|ok.ru)\/.*/
          , strImageFileName      : 'ok-logo-80.svg'
          , arrHosts              : [
                'odnoklassniki.ru'
              , 'ok.ru'
            ]
          , arrOrigins            : [
                '*://*.odnoklassniki.ru/*'
              , '*://*.ok.ru/*'
            ]
          , arrJs                 : [
                'global/js/const.js'
              , 'modules/general/js/page-watcher.js'
              , 'modules/ru_ok_audio/js/page-watcher.js'
            ]
        }
      , com_vk_audio              : {
            objRegex              : /(http:\/\/|https:\/\/)vk.com\/.*/
          , strImageFileName      : 'vk-logo-80.svg'
          , arrHosts              : [
                'vk.com'
            ]
          , arrOrigins            : [
                '*://vk.com/*'
            ]
          , arrJs                 : [
                'global/js/const.js'
              , 'modules/general/js/page-watcher.js'
              , 'modules/com_vk_audio/js/page-watcher.js'<commit_msg>Fix: VK module constant bitrate wouldn't show up<commit_after>/* =============================================================================

  Product                 :           PoziTone
  Author                  :           PoziWorld
  Copyright               :           Copyright (c) 2013-2016 PoziWorld
  License                 :           pozitone.com/license
  File                    :           global/js/global.js
  Description             :           Global JavaScript

  Table of Contents:

    Global
      init()
      getAllCommands()
      getStorageItems()
      setStorageItems()
      showNotification()
      showNotificationCallback()
      showSystemNotification()
      removeNotification()
      saveTabsIds()
      saveActiveButtons()
      getSavedOpenTabs()
      saveOpenTabs()
      getModuleId()
      getModuleIdFromProvided()
      getModules()
      isEmpty()
      findFirstOpenTabInvokeCallback()
      checkIfModuleIsEnabled()
      getTabIdFromNotificationId()
      composeNotificationId()
      returnIndexOfSubitemContaining()
      addShortcutInfo()
      createTabOrUpdate()
      makeHttpRequest()
      checkForDevelopersMessage()
      checkForRuntimeError()
      openOptionsPage()
    On Load
      Initialize

 ============================================================================ */

/* =============================================================================

  Global

 ============================================================================ */

const
    // Developers Message
    strDevelopersMessageBannerId              = 'pwMessage'
  , strDevelopersMessageBannerNotActiveClass  = 'notActive'
  ;

var Global                        = {
    intNoVolume                   : 0

  , strNotificationIdSeparator    : strConstNotificationIdSeparator
  , strNotificationId             : strConstNotificationId // + module + tab ID
  , strSystemNotificationId       : 
      strConstNotificationId + 'system' + strConstNotificationIdSeparator
  , strNotificationIconUrl        : 'global/img/notification-icon-80.png'
  , strSystemNotificationIconUrl  :
      'global/img/pozitone-notification-icon-80.png'
  , intNotificationsClearTimeout  : 4000

  , strOptionsUiUrlPrefix         : 'chrome://extensions?options='
  , strNoTrackInfo                : '...'
  , strPlayerIsOffClass           : 'play'

  // Embedded modules (replicates manifest's "content_scripts")
  , objModules                    : {
        ru_101                    : {
            objRegex              : /(http:\/\/|https:\/\/)101.ru\/.*/
          , arrHosts              : [
                '101.ru'
            ]
          , arrOrigins            : [
                '*://101.ru/*'
            ]
          , arrJs                 : [
                'global/js/const.js'
              , 'modules/ru_101/js/uppod-player-api.js'
              , 'modules/general/js/page-watcher.js'
              , 'modules/ru_101/js/page-watcher.js'
            ]
        }
      , fm_di : {
            objRegex : /(http:\/\/|https:\/\/)www.di.fm\/.*/
          , strImageFileName : 'di-logo-120.svg'
          , arrHosts : [
                'di.fm'
              , 'audioaddict.com'
            ]
          , arrOrigins : [
                '*://*.audioaddict.com/*'
              , '*://*.di.fm/*'
            ]
          , arrJs : [
                'global/js/const.js'
              , 'modules/general/js/page-watcher.js'
              , 'modules/fm_di/js/page-watcher.js'
            ]
        }
      , ru_ok_audio               : {
            objRegex              :
              // TODO: Cover all possible “OK” URLs
              /(http:\/\/|https:\/\/)(odnoklassniki.ru|ok.ru)\/.*/
          , strImageFileName      : 'ok-logo-80.svg'
          , arrHosts              : [
                'odnoklassniki.ru'
              , 'ok.ru'
            ]
          , arrOrigins            : [
                '*://*.odnoklassniki.ru/*'
              , '*://*.ok.ru/*'
            ]
          , arrJs                 : [
                'global/js/const.js'
              , 'modules/general/js/page-watcher.js'
              , 'modules/ru_ok_audio/js/page-watcher.js'
            ]
        }
      , com_vk_audio              : {
            objRegex              : /(http:\/\/|https:\/\/)vk.com\/.*/
          , strImageFileName      : 'vk-logo-80.svg'
          , arrHosts              : [
                'vk.com'
              , 'vk.me'
            ]
          , arrOrigins            : [
                '*://vk.com/*'
              , '*://*.vk.me/*'
            ]
          , arrJs                 : [
                'global/js/const.js'
              , 'modules/general/js/page-watcher.js'
              , 'modules/com_vk_audio/js/page-watcher.js'
{'fraction_non_alphanumeric': 0.17435356200527705, 'fraction_numerical': 0.008865435356200527, 'mean_word_length': 1.3157380254154447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2053766', 'n_tokens_mistral': 2681, 'n_tokens_neox': 2504, 'n_words': 312}