|
|
|
/*!
|
|
|
|
* Webogram v0.5.5 - messaging web application for MTProto
|
|
|
|
* https://github.com/zhukov/webogram
|
|
|
|
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
|
|
|
|
* https://github.com/zhukov/webogram/blob/master/LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
Config = window.Config || {}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
IMPORTANT NOTICE
|
|
|
|
================
|
|
|
|
|
|
|
|
Do not publish your Webogram fork with my app credentials (below), or your application may be blocked.
|
|
|
|
You can get your own api_id, api_hash at https://my.telegram.org, see manual at https://core.telegram.org/api/obtaining_api_id.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
Config.App = {
|
|
|
|
id: 2496,
|
|
|
|
hash: '8da85b0d5bfe62527e5b244c209159c3',
|
|
|
|
version: '0.5.5',
|
|
|
|
domains: ['web.telegram.org', 'zhukov.github.io']
|
|
|
|
}
|
|
|
|
|
|
|
|
Config.Modes = {
|
|
|
|
test: location.search.indexOf('test=1') > 0,
|
|
|
|
debug: location.search.indexOf('debug=1') > 0,
|
|
|
|
http: location.search.indexOf('http=1') > 0,
|
|
|
|
ssl: location.search.indexOf('ssl=1') > 0 || location.protocol == 'https:' && location.search.indexOf('ssl=0') == -1,
|
|
|
|
force_mobile: location.search.indexOf('mobile=1') > 0,
|
|
|
|
force_desktop: location.search.indexOf('desktop=1') > 0,
|
|
|
|
nacl: location.search.indexOf('nacl=0') == -1,
|
|
|
|
webcrypto: location.search.indexOf('webcrypto=0') == -1,
|
|
|
|
packed: location.protocol == 'app:' || location.protocol == 'chrome-extension:',
|
|
|
|
ios_standalone: window.navigator.standalone && navigator.userAgent.match(/iOS|iPhone|iPad/),
|
|
|
|
chrome_packed: window.chrome && chrome.app && chrome.app.window && true || false,
|
|
|
|
animations: true,
|
|
|
|
memory_only: false
|
|
|
|
}
|
|
|
|
|
|
|
|
Config.Navigator = {
|
|
|
|
osX: (navigator.platform || '').toLowerCase().indexOf('mac') != -1 ||
|
|
|
|
(navigator.userAgent || '').toLowerCase().indexOf('mac') != -1,
|
|
|
|
msie: (navigator.userAgent || '').search(/MSIE | Trident\/|Edge\//) != -1,
|
|
|
|
retina: window.devicePixelRatio > 1,
|
|
|
|
ffos: navigator.userAgent.search(/mobi.+Gecko/i) != -1,
|
|
|
|
ffos2p: navigator.userAgent.search(/mobi.+Gecko\/[34567]/i) != -1,
|
|
|
|
touch: screen.width <= 768 || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,
|
|
|
|
mobile: screen.width && screen.width < 480 || navigator.userAgent.search(/iOS|iPhone OS|Android|BlackBerry|BB10|Series ?[64]0|J2ME|MIDP|opera mini|opera mobi|mobi.+Gecko|Windows Phone/i) != -1
|
|
|
|
}
|
|
|
|
|
|
|
|
// Touch detect: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
|
|
|
|
|
|
Config.I18n = {
|
|
|
|
locale: 'en-us',
|
|
|
|
supported: [
|
|
|
|
'en-us'
|
|
|
|
, 'es-es'
|
|
|
|
, 'de-de'
|
|
|
|
, 'it-it'
|
|
|
|
, 'nl-nl'
|
|
|
|
, 'pt-br'
|
|
|
|
// ,"ru-ru"
|
|
|
|
], // To be copied to package.json
|
|
|
|
languages: {
|
|
|
|
'en-us': 'English',
|
|
|
|
'de-de': 'Deutsch',
|
|
|
|
'es-es': 'Español',
|
|
|
|
'it-it': 'Italiano',
|
|
|
|
'ru-ru': 'Русский',
|
|
|
|
'nl-nl': 'Nederlands',
|
|
|
|
'pt-br': 'Português (Brazil)'
|
|
|
|
},
|
|
|
|
aliases: {
|
|
|
|
'en': 'en-us',
|
|
|
|
'de': 'de-de',
|
|
|
|
'es': 'es-es',
|
|
|
|
'it': 'it-it',
|
|
|
|
'ru': 'ru-ru',
|
|
|
|
'nl': 'nl-nl'
|
|
|
|
},
|
|
|
|
messages: {},
|
|
|
|
fallback_messages: {}
|
|
|
|
}
|
|
|
|
|
|
|
|
Config.ExtCredentials = {
|
|
|
|
gmaps: {
|
|
|
|
api_key: 'AIzaSyC32ij28dCa0YzEV_HqbWfIwTZQql-RNS0'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Config.Schema = Config.Schema || {}
|
|
|
|
|
|
|
|
Config.Schema.MTProto = {'constructors': [{'id': '481674261','predicate': 'vector','params': [],'type': 'Vector t'}, {'id': '85337187','predicate': 'resPQ','params': [{'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'pq','type': 'bytes'}, {'name': 'server_public_key_fingerprints','type': 'Vector<long>'}],'type': 'ResPQ'}, {'id': '-2083955988','predicate': 'p_q_inner_data','params': [{'name': 'pq','type': 'bytes'}, {'name': 'p','type': 'bytes'}, {'name': 'q','type': 'bytes'}, {'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'new_nonce','type': 'int256'}],'type': 'P_Q_inner_data'}, {'id': '2043348061','predicate': 'server_DH_params_fail','params': [{'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'new_nonce_hash','type': 'int128'}],'type': 'Server_DH_Params'}, {'id': '-790100132','predicate': 'server_DH_params_ok','params': [{'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'encrypted_answer','type': 'bytes'}],'type': 'Server_DH_Params'}, {'id': '-1249309254','predicate': 'server_DH_inner_data','params': [{'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'g','type': 'int'}, {'name': 'dh_prime','type': 'bytes'}, {'name': 'g_a','type': 'bytes'}, {'name': 'server_time','type': 'int'}],'type': 'Server_DH_inner_data'}, {'id': '1715713620','predicate': 'client_DH_inner_data','params': [{'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'retry_id','type': 'long'}, {'name': 'g_b','type': 'bytes'}],'type': 'Client_DH_Inner_Data'}, {'id': '1003222836','predicate': 'dh_gen_ok','params': [{'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'new_nonce_hash1','type': 'int128'}],'type': 'Set_client_DH_params_answer'}, {'id': '1188831161','predicate': 'dh_gen_retry','params': [{'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'new_nonce_hash2','type': 'int128'}],'type': 'Set_client_DH_params_answer'}, {'id': '-1499615742','predicate': 'dh_gen_fail','params': [{'name': 'nonce','type': 'int128'}, {'name': 'server_nonce','type': 'int128'}, {'name': 'new_nonce_hash3','type': 'int128'}],'type': 'Set_client_DH_params_answer'}, {'id': '-212046591','predicate': 'rpc_result','params': [{'name': 'req_msg_id','type': 'long'}, {'name': 'result','type': 'Object'}],'type': 'RpcResult'}, {'id': '558156313','predicate': 'rpc_error','params': [{'name': 'error_code','type': 'int'}, {'name': 'error_message','type': 'string'}],'type': 'RpcError'}, {'id': '1579864942','predicate': 'rpc_answer_unknown','params': [],'type': 'RpcDropAnswer'}, {'id': '-847714938','predicate': 'rpc_answer_dropped_running','params': [],'type': 'RpcDropAnswer'}, {'id': '-1539647305','predicate': 'rpc_answer_dropped','params': [{'name': 'msg_id','type': 'long'}, {'name': 'seq_no','type': 'int'}, {'name': 'bytes','type': 'int'}],'type': 'RpcDropAnswer'}, {'id': '155834844','predicate': 'future_salt','params': [{'name': 'valid_since','type': 'int'}, {'name': 'valid_until','type': 'int'}, {'name': 'salt','type': 'long'}],'type': 'FutureSalt'}, {'id': '-1370486635','predicate': 'future_salts','params': [{'name': 'req_msg_id','type': 'long'}, {'name': 'now','type': 'int'}, {'name': 'salts','type': 'vector<future_salt>'}],'type': 'FutureSalts'}, {'id': '880243653','predicate': 'pong','params': [{'name': 'msg_id','type': 'long'}, {'name': 'ping_id','type': 'long'}],'type': 'Pong'}, {'id': '-501201412','predicate': 'destroy_session_ok','params': [{'name': 'session_id','type': 'long'}],'type': 'DestroySessionRes'}, {'id': '1658015945','predicate': 'destroy_session_none','params': [{'name': 'session_id','type': 'long'}],'type': 'DestroySessionRes'}, {'id': '-1631450872','predicate': 'new_session_created','params': [{'name': 'first_msg_id','type': 'long'}, {'name': 'unique_id','type': 'long'}, {'name': 'server_salt','type': 'long'}],'type': 'NewSession'}, {'id': '1945237724','predicate': 'msg_co
|
|
|
|
|
|
|
|
// From https://github.com/stephenmathieson/node-tlds/blob/master/index.js
|
|
|
|
Config.TLD = ['abogado', 'ac', 'academy', 'accountants', 'active', 'actor', 'ad', 'adult', 'ae', 'aero', 'af', 'ag', 'agency', 'ai', 'airforce', 'al', 'allfinanz', 'alsace', 'am', 'amsterdam', 'an', 'android', 'ao', 'apartments', 'aq', 'aquarelle', 'ar', 'archi', 'army', 'arpa', 'as', 'asia', 'associates', 'at', 'attorney', 'au', 'auction', 'audio', 'autos', 'aw', 'ax', 'axa', 'az', 'ba', 'band', 'bank', 'bar', 'barclaycard', 'barclays', 'bargains', 'bayern', 'bb', 'bd', 'be', 'beer', 'berlin', 'best', 'bf', 'bg', 'bh', 'bi', 'bid', 'bike', 'bingo', 'bio', 'biz', 'bj', 'black', 'blackfriday', 'bloomberg', 'blue', 'bm', 'bmw', 'bn', 'bnpparibas', 'bo', 'boo', 'boutique', 'br', 'brussels', 'bs', 'bt', 'budapest', 'build', 'builders', 'business', 'buzz', 'bv', 'bw', 'by', 'bz', 'bzh', 'ca', 'cab', 'cal', 'camera', 'camp', 'cancerresearch', 'canon', 'capetown', 'capital', 'caravan', 'cards', 'care', 'career', 'careers', 'cartier', 'casa', 'cash', 'cat', 'catering', 'cc', 'cd', 'center', 'ceo', 'cern', 'cf', 'cg', 'ch', 'channel', 'chat', 'cheap', 'christmas', 'chrome', 'church', 'ci', 'citic', 'city', 'ck', 'cl', 'claims', 'cleaning', 'click', 'clinic', 'clothing', 'club', 'cm', 'cn', 'co', 'coach', 'codes', 'coffee', 'college', 'cologne', 'com', 'community', 'company', 'computer', 'condos', 'construction', 'consulting', 'contractors', 'cooking', 'cool', 'coop', 'country', 'cr', 'credit', 'creditcard', 'cricket', 'crs', 'cruises', 'cu', 'cuisinella', 'cv', 'cw', 'cx', 'cy', 'cymru', 'cz', 'dabur', 'dad', 'dance', 'dating', 'day', 'dclk', 'de', 'deals', 'degree', 'delivery', 'democrat', 'dental', 'dentist', 'desi', 'design', 'dev', 'diamonds', 'diet', 'digital', 'direct', 'directory', 'discount', 'dj', 'dk', 'dm', 'dnp', 'do', 'docs', 'domains', 'doosan', 'durban', 'dvag', 'dz', 'eat', 'ec', 'edu', 'education', 'ee', 'eg', 'email', 'emerck', 'energy', 'engineer', 'engineering', 'enterprises', 'equipment', 'er', 'es', 'esq', 'estate', 'et', 'eu', 'eurovision', 'eus', 'events', 'everbank', 'exchange', 'expert', 'exposed', 'fail', 'farm', 'fashion', 'feedback', 'fi', 'finance', 'financial', 'firmdale', 'fish', 'fishing', 'fit', 'fitness', 'fj', 'fk', 'flights', 'florist', 'flowers', 'flsmidth', 'fly', 'fm', 'fo', 'foo', 'forsale', 'foundation', 'fr', 'frl', 'frogans', 'fund', 'furniture', 'futbol', 'ga', 'gal', 'gallery', 'garden', 'gb', 'gbiz', 'gd', 'ge', 'gent', 'gf', 'gg', 'ggee', 'gh', 'gi', 'gift', 'gifts', 'gives', 'gl', 'glass', 'gle', 'global', 'globo', 'gm', 'gmail', 'gmo', 'gmx', 'gn', 'goog', 'google', 'gop', 'gov', 'gp', 'gq', 'gr', 'graphics', 'gratis', 'green', 'gripe', 'gs', 'gt', 'gu', 'guide', 'guitars', 'guru', 'gw', 'gy', 'hamburg', 'hangout', 'haus', 'healthcare', 'help', 'here', 'hermes', 'hiphop', 'hiv', 'hk', 'hm', 'hn', 'holdings', 'holiday', 'homes', 'horse', 'host', 'hosting', 'house', 'how', 'hr', 'ht', 'hu', 'ibm', 'id', 'ie', 'ifm', 'il', 'im', 'immo', 'immobilien', 'in', 'industries', 'info', 'ing', 'ink', 'institute', 'insure', 'int', 'international', 'investments', 'io', 'iq', 'ir', 'irish', 'is', 'it', 'iwc', 'jcb', 'je', 'jetzt', 'jm', 'jo', 'jobs', 'joburg', 'jp', 'juegos', 'kaufen', 'kddi', 'ke', 'kg', 'kh', 'ki', 'kim', 'kitchen', 'kiwi', 'km', 'kn', 'koeln', 'kp', 'kr', 'krd', 'kred', 'kw', 'ky', 'kyoto', 'kz', 'la', 'lacaixa', 'land', 'lat', 'latrobe', 'lawyer', 'lb', 'lc', 'lds', 'lease', 'legal', 'lgbt', 'li', 'lidl', 'life', 'lighting', 'limited', 'limo', 'link', 'lk', 'loans', 'london', 'lotte', 'lotto', 'lr', 'ls', 'lt', 'ltda', 'lu', 'luxe', 'luxury', 'lv', 'ly', 'ma', 'madrid', 'maison', 'management', 'mango', 'market', 'marketing', 'marriott', 'mc', 'md', 'me', 'media', 'meet', 'melbourne', 'meme', 'memorial', 'menu', 'mg', 'mh', 'miami', 'mil', 'mini', 'mk', 'ml', 'mm', 'mn', 'mo', 'mobi', 'moda', 'moe', 'monash', 'money', 'mormon', 'mortgage', 'moscow', 'motorcycles', 'mov', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'museum', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nagoya', 'name', 'navy', 'nc', 'ne', 'net', 'network', 'neustar', 'new', 'nexus', 'nf', 'ng', 'ngo', 'nhk', 'ni', 'nico', 'n
|
|
|
|
|
|
|
|
Config.Schema.API = {'constructors': [{'id': '-1132882121','predicate': 'boolFalse','params': [],'type': 'Bool'}, {'id': '-1720552011','predicate': 'boolTrue','params': [],'type': 'Bool'}, {'id': '1072550713','predicate': 'true','params': [],'type': 'True'}, {'id': '481674261','predicate': 'vector','params': [],'type': 'Vector t'}, {'id': '-994444869','predicate': 'error','params': [{'name': 'code','type': 'int'}, {'name': 'text','type': 'string'}],'type': 'Error'}, {'id': '1450380236','predicate': 'null','params': [],'type': 'Null'}, {'id': '2134579434','predicate': 'inputPeerEmpty','params': [],'type': 'InputPeer'}, {'id': '2107670217','predicate': 'inputPeerSelf','params': [],'type': 'InputPeer'}, {'id': '396093539','predicate': 'inputPeerChat','params': [{'name': 'chat_id','type': 'int'}],'type': 'InputPeer'}, {'id': '-1182234929','predicate': 'inputUserEmpty','params': [],'type': 'InputUser'}, {'id': '-138301121','predicate': 'inputUserSelf','params': [],'type': 'InputUser'}, {'id': '-208488460','predicate': 'inputPhoneContact','params': [{'name': 'client_id','type': 'long'}, {'name': 'phone','type': 'string'}, {'name': 'first_name','type': 'string'}, {'name': 'last_name','type': 'string'}],'type': 'InputContact'}, {'id': '-181407105','predicate': 'inputFile','params': [{'name': 'id','type': 'long'}, {'name': 'parts','type': 'int'}, {'name': 'name','type': 'string'}, {'name': 'md5_checksum','type': 'string'}],'type': 'InputFile'}, {'id': '-1771768449','predicate': 'inputMediaEmpty','params': [],'type': 'InputMedia'}, {'id': '-139464256','predicate': 'inputMediaUploadedPhoto','params': [{'name': 'file','type': 'InputFile'}, {'name': 'caption','type': 'string'}],'type': 'InputMedia'}, {'id': '-373312269','predicate': 'inputMediaPhoto','params': [{'name': 'id','type': 'InputPhoto'}, {'name': 'caption','type': 'string'}],'type': 'InputMedia'}, {'id': '-104578748','predicate': 'inputMediaGeoPoint','params': [{'name': 'geo_point','type': 'InputGeoPoint'}],'type': 'InputMedia'}, {'id': '-1494984313','predicate': 'inputMediaContact','params': [{'name': 'phone_number','type': 'string'}, {'name': 'first_name','type': 'string'}, {'name': 'last_name','type': 'string'}],'type': 'InputMedia'}, {'id': '480546647','predicate': 'inputChatPhotoEmpty','params': [],'type': 'InputChatPhoto'}, {'id': '-1809496270','predicate': 'inputChatUploadedPhoto','params': [{'name': 'file','type': 'InputFile'}, {'name': 'crop','type': 'InputPhotoCrop'}],'type': 'InputChatPhoto'}, {'id': '-1293828344','predicate': 'inputChatPhoto','params': [{'name': 'id','type': 'InputPhoto'}, {'name': 'crop','type': 'InputPhotoCrop'}],'type': 'InputChatPhoto'}, {'id': '-457104426','predicate': 'inputGeoPointEmpty','params': [],'type': 'InputGeoPoint'}, {'id': '-206066487','predicate': 'inputGeoPoint','params': [{'name': 'lat','type': 'double'}, {'name': 'long','type': 'double'}],'type': 'InputGeoPoint'}, {'id': '483901197','predicate': 'inputPhotoEmpty','params': [],'type': 'InputPhoto'}, {'id': '-74070332','predicate': 'inputPhoto','params': [{'name': 'id','type': 'long'}, {'name': 'access_hash','type': 'long'}],'type': 'InputPhoto'}, {'id': '342061462','predicate': 'inputFileLocation','params': [{'name': 'volume_id','type': 'long'}, {'name': 'local_id','type': 'int'}, {'name': 'secret','type': 'long'}],'type': 'InputFileLocation'}, {'id': '-1377390588','predicate': 'inputPhotoCropAuto','params': [],'type': 'InputPhotoCrop'}, {'id': '-644787419','predicate': 'inputPhotoCrop','params': [{'name': 'crop_left','type': 'double'}, {'name': 'crop_top','type': 'double'}, {'name': 'crop_width','type': 'double'}],'type': 'InputPhotoCrop'}, {'id': '1996904104','predicate': 'inputAppEvent','params': [{'name': 'time','type': 'double'}, {'name': 'type','type': 'string'}, {'name': 'peer','type': 'long'}, {'name': 'data','type': 'string'}],'type': 'InputAppEvent'}, {'id': '-1649296275','predicate': 'peerUser','params': [{'name': 'user_id','type': 'int'}],'type': 'Peer'}, {'id': '-1160714821','predicate': 'peerChat','params': [{'name': 'chat_id','type': 'int'}],'type': 'Peer'}, {
|
|
|
|
|
|
|
|
Config.Schema.API.layer = 53
|
|
|
|
|
|
|
|
Config.Emoji = {'00a9': ['\u00A9', ['copyright']],'00ae': ['\u00AE', ['registered']],'203c': ['\u203C', ['bangbang']],'2049': ['\u2049', ['interrobang']],'2122': ['\u2122', ['tm']],'2139': ['\u2139', ['information_source']],'2194': ['\u2194', ['left_right_arrow']],'2195': ['\u2195', ['arrow_up_down']],'2196': ['\u2196', ['arrow_upper_left']],'2197': ['\u2197', ['arrow_upper_right']],'2198': ['\u2198', ['arrow_lower_right']],'2199': ['\u2199', ['arrow_lower_left']],'21a9': ['\u21A9', ['leftwards_arrow_with_hook']],'21aa': ['\u21AA', ['arrow_right_hook']],'231a': ['\u231A', ['watch']],'231b': ['\u231B', ['hourglass']],'23e9': ['\u23E9', ['fast_forward']],'23ea': ['\u23EA', ['rewind']],'23eb': ['\u23EB', ['arrow_double_up']],'23ec': ['\u23EC', ['arrow_double_down']],'23f0': ['\u23F0', ['alarm_clock']],'23f3': ['\u23F3', ['hourglass_flowing_sand']],'24c2': ['\u24C2', ['m']],'25aa': ['\u25AA', ['black_small_square']],'25ab': ['\u25AB', ['white_small_square']],'25b6': ['\u25B6', ['arrow_forward']],'25c0': ['\u25C0', ['arrow_backward']],'25fb': ['\u25FB', ['white_medium_square']],'25fc': ['\u25FC', ['black_medium_square']],'25fd': ['\u25FD', ['white_medium_small_square']],'25fe': ['\u25FE', ['black_medium_small_square']],'2600': ['\u2600', ['sunny']],'2601': ['\u2601', ['cloud']],'260e': ['\u260E', ['phone', 'telephone']],'2611': ['\u2611', ['ballot_box_with_check']],'2614': ['\u2614', ['umbrella']],'2615': ['\u2615', ['coffee']],'261d': ['\u261D', ['point_up']],'263a': ['\u263A', ['relaxed']],'2648': ['\u2648', ['aries']],'2649': ['\u2649', ['taurus']],'264a': ['\u264A', ['gemini']],'264b': ['\u264B', ['cancer']],'264c': ['\u264C', ['leo']],'264d': ['\u264D', ['virgo']],'264e': ['\u264E', ['libra']],'264f': ['\u264F', ['scorpius']],'2650': ['\u2650', ['sagittarius']],'2651': ['\u2651', ['capricorn']],'2652': ['\u2652', ['aquarius']],'2653': ['\u2653', ['pisces']],'2660': ['\u2660', ['spades']],'2663': ['\u2663', ['clubs']],'2665': ['\u2665', ['hearts']],'2666': ['\u2666', ['diamonds']],'2668': ['\u2668', ['hotsprings']],'267b': ['\u267B', ['recycle']],'267f': ['\u267F', ['wheelchair']],'2693': ['\u2693', ['anchor']],'26a0': ['\u26A0', ['warning']],'26a1': ['\u26A1', ['zap']],'26aa': ['\u26AA', ['white_circle']],'26ab': ['\u26AB', ['black_circle']],'26bd': ['\u26BD', ['soccer']],'26be': ['\u26BE', ['baseball']],'26c4': ['\u26C4', ['snowman']],'26c5': ['\u26C5', ['partly_sunny']],'26ce': ['\u26CE', ['ophiuchus']],'26d4': ['\u26D4', ['no_entry']],'26ea': ['\u26EA', ['church']],'26f2': ['\u26F2', ['fountain']],'26f3': ['\u26F3', ['golf']],'26f5': ['\u26F5', ['boat', 'sailboat']],'26fa': ['\u26FA', ['tent']],'26fd': ['\u26FD', ['fuelpump']],'2702': ['\u2702', ['scissors']],'2705': ['\u2705', ['white_check_mark']],'2708': ['\u2708', ['airplane']],'2709': ['\u2709', ['email', 'envelope']],'270a': ['\u270A', ['fist']],'270b': ['\u270B', ['hand', 'raised_hand']],'270c': ['\u270C', ['v']],'270f': ['\u270F', ['pencil2']],'2712': ['\u2712', ['black_nib']],'2714': ['\u2714', ['heavy_check_mark']],'2716': ['\u2716', ['heavy_multiplication_x']],'2728': ['\u2728', ['sparkles']],'2733': ['\u2733', ['eight_spoked_asterisk']],'2734': ['\u2734', ['eight_pointed_black_star']],'2744': ['\u2744', ['snowflake']],'2747': ['\u2747', ['sparkle']],'274c': ['\u274C', ['x']],'274e': ['\u274E', ['negative_squared_cross_mark']],'2753': ['\u2753', ['question']],'2754': ['\u2754', ['grey_question']],'2755': ['\u2755', ['grey_exclamation']],'2757': ['\u2757', ['exclamation', 'heavy_exclamation_mark']],'2764': ['\u2764', ['heart'], '<3'],'2795': ['\u2795', ['heavy_plus_sign']],'2796': ['\u2796', ['heavy_minus_sign']],'2797': ['\u2797', ['heavy_division_sign']],'27a1': ['\u27A1', ['arrow_right']],'27b0': ['\u27B0', ['curly_loop']],'27bf': ['\u27BF', ['loop']],'2934': ['\u2934', ['arrow_heading_up']],'2935': ['\u2935', ['arrow_heading_down']],'2b05': ['\u2B05', ['arrow_left']],'2b06': ['\u2B06', ['arrow_up']],'2b07': ['\u2B07', ['arrow_down']],'2b1b': ['\u2B1B', ['black_large_square']],'2b1c': ['\u2B1C', ['white_large_square']],'2b50': ['\u2B50', ['star']],'2b55'
|
|
|
|
|
|
|
|
Config.EmojiCategories = [[ '1f604', '1f603', '1f600', '1f60a', '263a', '1f609', '1f60d', '1f618', '1f61a', '1f617', '1f619', '1f61c', '1f61d', '1f61b', '1f633', '1f601', '1f614', '1f60c', '1f612', '1f61e', '1f623', '1f622', '1f602', '1f62d', '1f62a', '1f625', '1f630', '1f605', '1f613', '1f629', '1f62b', '1f628', '1f631', '1f620', '1f621', '1f624', '1f616', '1f606', '1f60b', '1f637', '1f60e', '1f634', '1f635', '1f632', '1f61f', '1f626', '1f627', '1f608', '1f47f', '1f62e', '1f62c', '1f610', '1f615', '1f62f', '1f636', '1f607', '1f60f', '1f611', '1f472', '1f473', '1f46e', '1f477', '1f482', '1f476', '1f466', '1f467', '1f468', '1f469', '1f474', '1f475', '1f471', '1f47c', '1f478', '1f63a', '1f638', '1f63b', '1f63d', '1f63c', '1f640', '1f63f', '1f639', '1f63e', '1f479', '1f47a', '1f648', '1f649', '1f64a', '1f480', '1f47d', '1f4a9', '1f525', '2728', '1f31f', '1f4ab', '1f4a5', '1f4a2', '1f4a6', '1f4a7', '1f4a4', '1f4a8', '1f442', '1f440', '1f443', '1f445', '1f444', '1f44d', '1f44e', '1f44c', '1f44a', '270a', '270c', '1f44b', '270b', '1f450', '1f446', '1f447', '1f449', '1f448', '1f64c', '1f64f', '261d', '1f44f', '1f4aa', '1f6b6', '1f3c3', '1f483', '1f46b', '1f46a', '1f46c', '1f46d', '1f48f', '1f491', '1f46f', '1f646', '1f645', '1f481', '1f64b', '1f486', '1f487', '1f485', '1f470', '1f64e', '1f64d', '1f647', '1f3a9', '1f451', '1f452', '1f45f', '1f45e', '1f461', '1f460', '1f462', '1f455', '1f454', '1f45a', '1f457', '1f3bd', '1f456', '1f458', '1f459', '1f4bc', '1f45c', '1f45d', '1f45b', '1f453', '1f380', '1f302', '1f484', '1f49b', '1f499', '1f49c', '1f49a', '2764', '1f494', '1f497', '1f493', '1f495', '1f496', '1f49e', '1f498', '1f48c', '1f48b', '1f48d', '1f48e', '1f464', '1f465', '1f4ac', '1f463', '1f4ad' ], [ '1f436', '1f43a', '1f431', '1f42d', '1f439', '1f430', '1f438', '1f42f', '1f428', '1f43b', '1f437', '1f43d', '1f42e', '1f417', '1f435', '1f412', '1f434', '1f411', '1f418', '1f43c', '1f427', '1f426', '1f424', '1f425', '1f423', '1f414', '1f40d', '1f422', '1f41b', '1f41d', '1f41c', '1f41e', '1f40c', '1f419', '1f41a', '1f420', '1f41f', '1f42c', '1f433', '1f40b', '1f404', '1f40f', '1f400', '1f403', '1f405', '1f407', '1f409', '1f40e', '1f410', '1f413', '1f415', '1f416', '1f401', '1f402', '1f432', '1f421', '1f40a', '1f42b', '1f42a', '1f406', '1f408', '1f429', '1f43e', '1f490', '1f338', '1f337', '1f340', '1f339', '1f33b', '1f33a', '1f341', '1f343', '1f342', '1f33f', '1f33e', '1f344', '1f335', '1f334', '1f332', '1f333', '1f330', '1f331', '1f33c', '1f310', '1f31e', '1f31d', '1f31a', '1f311', '1f312', '1f313', '1f314', '1f315', '1f316', '1f317', '1f318', '1f31c', '1f31b', '1f319', '1f30d', '1f30e', '1f30f', '1f30b', '1f30c', '1f320', '2b50', '2600', '26c5', '2601', '26a1', '2614', '2744', '26c4', '1f300', '1f301', '1f308', '1f30a' ], [ '1f38d', '1f49d', '1f38e', '1f392', '1f393', '1f38f', '1f386', '1f387', '1f390', '1f391', '1f383', '1f47b', '1f385', '1f384', '1f381', '1f38b', '1f389', '1f38a', '1f388', '1f38c', '1f52e', '1f3a5', '1f4f7', '1f4f9', '1f4fc', '1f4bf', '1f4c0', '1f4bd', '1f4be', '1f4bb', '1f4f1', '260e', '1f4de', '1f4df', '1f4e0', '1f4e1', '1f4fa', '1f4fb', '1f50a', '1f509', '1f508', '1f507', '1f514', '1f515', '1f4e3', '1f4e2', '23f3', '231b', '23f0', '231a', '1f513', '1f512', '1f50f', '1f510', '1f511', '1f50e', '1f4a1', '1f526', '1f506', '1f505', '1f50c', '1f50b', '1f50d', '1f6c0', '1f6c1', '1f6bf', '1f6bd', '1f527', '1f529', '1f528', '1f6aa', '1f6ac', '1f4a3', '1f52b', '1f52a', '1f48a', '1f489', '1f4b0', '1f4b4', '1f4b5', '1f4b7', '1f4b6', '1f4b3', '1f4b8', '1f4f2', '1f4e7', '1f4e5', '1f4e4', '2709', '1f4e9', '1f4e8', '1f4ef', '1f4eb', '1f4ea', '1f4ec', '1f4ed', '1f4ee', '1f4e6', '1f4dd', '1f4c4', '1f4c3', '1f4d1', '1f4ca', '1f4c8', '1f4c9', '1f4dc', '1f4cb', '1f4c5', '1f4c6', '1f4c7', '1f4c1', '1f4c2', '2702', '1f4cc', '1f4ce', '2712', '270f', '1f4cf', '1f4d0', '1f4d5', '1f4d7', '1f4d8', '1f4d9', '1f4d3', '1f4d4', '1f4d2', '1f4da', '1f4d6', '1f516', '1f4db', '1f52c', '1f52d', '1f4f0', '1f3a8', '1f3ac', '1f3a4', '1f3a7', '1f3bc', '1f3b5', '1f3b6', '1f3b9', '1f3bb', '1f3ba', '1f3b7', '1f3b8', '1f47e', '1f3ae', '1f0cf', '1f3b4
|
|
|
|
|
|
|
|
Config.EmojiCategorySpritesheetDimens = [[7, 27], [4, 29], [7, 33], [3, 34], [7, 34]]
|
|
|
|
|
|
|
|
// From https://raw.githubusercontent.com/FGRibreau/latenize/master/latinize_map.js
|
|
|
|
Config.LatinizeMap = {'Á': 'A','Ă': 'A','Ắ': 'A','Ặ': 'A','Ằ': 'A','Ẳ': 'A','Ẵ': 'A','Ǎ': 'A','Â': 'A','Ấ': 'A','Ậ': 'A','Ầ': 'A','Ẩ': 'A','Ẫ': 'A','Ä': 'A','Ǟ': 'A','Ȧ': 'A','Ǡ': 'A','Ạ': 'A','Ȁ': 'A','À': 'A','Ả': 'A','Ȃ': 'A','Ā': 'A','Ą': 'A','Å': 'A','Ǻ': 'A','Ḁ': 'A','Ⱥ': 'A','Ã': 'A','Ꜳ': 'AA','Æ': 'AE','Ǽ': 'AE','Ǣ': 'AE','Ꜵ': 'AO','Ꜷ': 'AU','Ꜹ': 'AV','Ꜻ': 'AV','Ꜽ': 'AY','Ḃ': 'B','Ḅ': 'B','Ɓ': 'B','Ḇ': 'B','Ƀ': 'B','Ƃ': 'B','Ć': 'C','Č': 'C','Ç': 'C','Ḉ': 'C','Ĉ': 'C','Ċ': 'C','Ƈ': 'C','Ȼ': 'C','Ď': 'D','Ḑ': 'D','Ḓ': 'D','Ḋ': 'D','Ḍ': 'D','Ɗ': 'D','Ḏ': 'D','Dz': 'D','Dž': 'D','Đ': 'D','Ƌ': 'D','DZ': 'DZ','DŽ': 'DZ','É': 'E','Ĕ': 'E','Ě': 'E','Ȩ': 'E','Ḝ': 'E','Ê': 'E','Ế': 'E','Ệ': 'E','Ề': 'E','Ể': 'E','Ễ': 'E','Ḙ': 'E','Ë': 'E','Ė': 'E','Ẹ': 'E','Ȅ': 'E','È': 'E','Ẻ': 'E','Ȇ': 'E','Ē': 'E','Ḗ': 'E','Ḕ': 'E','Ę': 'E','Ɇ': 'E','Ẽ': 'E','Ḛ': 'E','Ꝫ': 'ET','Ḟ': 'F','Ƒ': 'F','Ǵ': 'G','Ğ': 'G','Ǧ': 'G','Ģ': 'G','Ĝ': 'G','Ġ': 'G','Ɠ': 'G','Ḡ': 'G','Ǥ': 'G','Ḫ': 'H','Ȟ': 'H','Ḩ': 'H','Ĥ': 'H','Ⱨ': 'H','Ḧ': 'H','Ḣ': 'H','Ḥ': 'H','Ħ': 'H','Í': 'I','Ĭ': 'I','Ǐ': 'I','Î': 'I','Ï': 'I','Ḯ': 'I','İ': 'I','Ị': 'I','Ȉ': 'I','Ì': 'I','Ỉ': 'I','Ȋ': 'I','Ī': 'I','Į': 'I','Ɨ': 'I','Ĩ': 'I','Ḭ': 'I','Ꝺ': 'D','Ꝼ': 'F','Ᵹ': 'G','Ꞃ': 'R','Ꞅ': 'S','Ꞇ': 'T','Ꝭ': 'IS','Ĵ': 'J','Ɉ': 'J','Ḱ': 'K','Ǩ': 'K','Ķ': 'K','Ⱪ': 'K','Ꝃ': 'K','Ḳ': 'K','Ƙ': 'K','Ḵ': 'K','Ꝁ': 'K','Ꝅ': 'K','Ĺ': 'L','Ƚ': 'L','Ľ': 'L','Ļ': 'L','Ḽ': 'L','Ḷ': 'L','Ḹ': 'L','Ⱡ': 'L','Ꝉ': 'L','Ḻ': 'L','Ŀ': 'L','Ɫ': 'L','Lj': 'L','Ł': 'L','LJ': 'LJ','Ḿ': 'M','Ṁ': 'M','Ṃ': 'M','Ɱ': 'M','Ń': 'N','Ň': 'N','Ņ': 'N','Ṋ': 'N','Ṅ': 'N','Ṇ': 'N','Ǹ': 'N','Ɲ': 'N','Ṉ': 'N','Ƞ': 'N','Nj': 'N','Ñ': 'N','NJ': 'NJ','Ó': 'O','Ŏ': 'O','Ǒ': 'O','Ô': 'O','Ố': 'O','Ộ': 'O','Ồ': 'O','Ổ': 'O','Ỗ': 'O','Ö': 'O','Ȫ': 'O','Ȯ': 'O','Ȱ': 'O','Ọ': 'O','Ő': 'O','Ȍ': 'O','Ò': 'O','Ỏ': 'O','Ơ': 'O','Ớ': 'O','Ợ': 'O','Ờ': 'O','Ở': 'O','Ỡ': 'O','Ȏ': 'O','Ꝋ': 'O','Ꝍ': 'O','Ō': 'O','Ṓ': 'O','Ṑ': 'O','Ɵ': 'O','Ǫ': 'O','Ǭ': 'O','Ø': 'O','Ǿ': 'O','Õ': 'O','Ṍ': 'O','Ṏ': 'O','Ȭ': 'O','Ƣ': 'OI','Ꝏ': 'OO','Ɛ': 'E','Ɔ': 'O','Ȣ': 'OU','Ṕ': 'P','Ṗ': 'P','Ꝓ': 'P','Ƥ': 'P','Ꝕ': 'P','Ᵽ': 'P','Ꝑ': 'P','Ꝙ': 'Q','Ꝗ': 'Q','Ŕ': 'R','Ř': 'R','Ŗ': 'R','Ṙ': 'R','Ṛ': 'R','Ṝ': 'R','Ȑ': 'R','Ȓ': 'R','Ṟ': 'R','Ɍ': 'R','Ɽ': 'R','Ꜿ': 'C','Ǝ': 'E','Ś': 'S','Ṥ': 'S','Š': 'S','Ṧ': 'S','Ş': 'S','Ŝ': 'S','Ș': 'S','Ṡ': 'S','Ṣ': 'S','Ṩ': 'S','ẞ': 'SS','Ť': 'T','Ţ': 'T','Ṱ': 'T','Ț': 'T','Ⱦ': 'T','Ṫ': 'T','Ṭ': 'T','Ƭ': 'T','Ṯ': 'T','Ʈ': 'T','Ŧ': 'T','Ɐ': 'A','Ꞁ': 'L','Ɯ': 'M','Ʌ': 'V','Ꜩ': 'TZ','Ú': 'U','Ŭ': 'U','Ǔ': 'U','Û': 'U','Ṷ': 'U','Ü': 'U','Ǘ': 'U','Ǚ': 'U','Ǜ': 'U','Ǖ': 'U','Ṳ': 'U','Ụ': 'U','Ű': 'U','Ȕ': 'U','Ù': 'U','Ủ': 'U','Ư': 'U','Ứ': 'U','Ự': 'U','Ừ': 'U','Ử': 'U','Ữ': 'U','Ȗ': 'U','Ū': 'U','Ṻ': 'U','Ų': 'U','Ů': 'U','Ũ': 'U','Ṹ': 'U','Ṵ': 'U','Ꝟ': 'V','Ṿ': 'V','Ʋ': 'V','Ṽ': 'V','Ꝡ': 'VY','Ẃ': 'W','Ŵ': 'W','Ẅ': 'W','Ẇ': 'W','Ẉ': 'W','Ẁ': 'W','Ⱳ': 'W','Ẍ': 'X','Ẋ': 'X','Ý': 'Y','Ŷ': 'Y','Ÿ': 'Y','Ẏ': 'Y','Ỵ': 'Y','Ỳ': 'Y','Ƴ': 'Y','Ỷ': 'Y','Ỿ': 'Y','Ȳ': 'Y','Ɏ': 'Y','Ỹ': 'Y','Ź': 'Z','Ž': 'Z','Ẑ': 'Z','Ⱬ': 'Z','Ż': 'Z','Ẓ': 'Z','Ȥ': 'Z','Ẕ': 'Z','Ƶ': 'Z','IJ': 'IJ','Œ': 'OE','ᴀ': 'A','ᴁ': 'AE','ʙ': 'B','ᴃ': 'B','ᴄ': 'C','ᴅ': 'D','ᴇ': 'E','ꜰ': 'F','ɢ': 'G','ʛ': 'G','ʜ': 'H','ɪ': 'I','ʁ': 'R','ᴊ': 'J','ᴋ': 'K','ʟ': 'L','ᴌ': 'L','ᴍ': 'M','ɴ': 'N','ᴏ': 'O','ɶ': 'OE','ᴐ': 'O','ᴕ': 'OU','ᴘ': 'P','ʀ': 'R','ᴎ': 'N','ᴙ': 'R','ꜱ': 'S','ᴛ': 'T','ⱻ': 'E','ᴚ': 'R','ᴜ': 'U','ᴠ': 'V','ᴡ': 'W','ʏ': 'Y','ᴢ': 'Z','á': 'a','ă': 'a','ắ': 'a','ặ': 'a','ằ': 'a','ẳ': 'a','ẵ': 'a','ǎ': 'a','â'
|
|
|
|
|
|
|
|
Config.CountryCodes = [['AB', 'country_select_modal_country_ab', '+7 840', '+7 940', '+995 44'], ['AF', 'country_select_modal_country_af', '+93'], ['AX', 'country_select_modal_country_ax', '+358 18'], ['AL', 'country_select_modal_country_al', '+355'], ['DZ', 'country_select_modal_country_dz', '+213'], ['AS', 'country_select_modal_country_as', '+1 684'], ['AD', 'country_select_modal_country_ad', '+376'], ['AO', 'country_select_modal_country_ao', '+244'], ['AI', 'country_select_modal_country_ai', '+1 264'], ['AG', 'country_select_modal_country_ag', '+1 268'], ['AR', 'country_select_modal_country_ar', '+54'], ['AM', 'country_select_modal_country_am', '+374'], ['AW', 'country_select_modal_country_aw', '+297'], ['SH', 'country_select_modal_country_sh_ac', '+247'], ['AU', 'country_select_modal_country_au', '+61'], ['AU', 'country_select_modal_country_au_et', '+672'], ['AT', 'country_select_modal_country_at', '+43'], ['AZ', 'country_select_modal_country_az', '+994'], ['BS', 'country_select_modal_country_bs', '+1 242'], ['BH', 'country_select_modal_country_bh', '+973'], ['BD', 'country_select_modal_country_bd', '+880'], ['BB', 'country_select_modal_country_bb', '+1 246'], ['AG', 'country_select_modal_country_ag_bar', '+1 268'], ['BY', 'country_select_modal_country_by', '+375'], ['BE', 'country_select_modal_country_be', '+32'], ['BZ', 'country_select_modal_country_bz', '+501'], ['BJ', 'country_select_modal_country_bj', '+229'], ['BM', 'country_select_modal_country_bm', '+1 441'], ['BT', 'country_select_modal_country_bt', '+975'], ['BO', 'country_select_modal_country_bo', '+591'], ['BQ', 'country_select_modal_country_bq', '+599 7'], ['BA', 'country_select_modal_country_ba', '+387'], ['BW', 'country_select_modal_country_bw', '+267'], ['BR', 'country_select_modal_country_br', '+55'], ['IO', 'country_select_modal_country_io', '+246'], ['VG', 'country_select_modal_country_vg', '+1 284'], ['BN', 'country_select_modal_country_bn', '+673'], ['BG', 'country_select_modal_country_bg', '+359'], ['BF', 'country_select_modal_country_bf', '+226'], ['MY', 'country_select_modal_country_mm', '+95'], ['BI', 'country_select_modal_country_bi', '+257'], ['KH', 'country_select_modal_country_kh', '+855'], ['CM', 'country_select_modal_country_cm', '+237'], ['CA', 'country_select_modal_country_ca', '+1'], ['CV', 'country_select_modal_country_cv', '+238'], ['KY', 'country_select_modal_country_ky', '+1 345'], ['CF', 'country_select_modal_country_cf', '+236'], ['TD', 'country_select_modal_country_td', '+235'], ['CL', 'country_select_modal_country_cl', '+56'], ['CN', 'country_select_modal_country_cn', '+86'], ['CX', 'country_select_modal_country_cx', '+61'], ['CC', 'country_select_modal_country_cc', '+61'], ['CO', 'country_select_modal_country_co', '+57'], ['KM', 'country_select_modal_country_km', '+269'], ['CG', 'country_select_modal_country_cg', '+242'], ['CD', 'country_select_modal_country_cd', '+243'], ['CK', 'country_select_modal_country_ck', '+682'], ['CR', 'country_select_modal_country_cr', '+506'], ['CI', 'country_select_modal_country_ci', '+225'], ['HR', 'country_select_modal_country_hr', '+385'], ['CU', 'country_select_modal_country_cu', '+53'], ['CW', 'country_select_modal_country_cw', '+599 9'], ['CY', 'country_select_modal_country_cy', '+357'], ['CZ', 'country_select_modal_country_cz', '+420'], ['DK', 'country_select_modal_country_dk', '+45'], ['DG', 'country_select_modal_country_dg', '+246'], ['DJ', 'country_select_modal_country_dj', '+253'], ['DM', 'country_select_modal_country_dm', '+1 767'], ['DO', 'country_select_modal_country_do', '+1 809', '+1 829', '+1 849'], ['TL', 'country_select_modal_country_tl', '+670'], ['EC', 'country_select_modal_country_ec', '+593'], ['EG', 'country_select_modal_country_eg', '+20'], ['SV', 'country_select_modal_country_sv', '+503'], ['GQ', 'country_select_modal_country_gq', '+240'], ['ER', 'country_select_modal_country_er', '+291'], ['EE', 'country_select_modal_country_ee', '+372'], ['ET', 'country_select_modal_country_et', '+251'], ['FK', 'country_select_modal_country_fk', '+500'], ['FO', 'country_select_modal_
|
|
|
|
|
|
|
|
Config.LangCountries = {'es': 'ES', 'ru': 'RU', 'en': 'US', 'de': 'DE', 'it': 'IT', 'nl': 'NL', 'fr': 'FR', 'ca': 'ES', 'es-419': 'MX', 'ar': 'SA', 'he': 'IL', 'tr': 'TR', 'id': 'ID', 'pl': 'PL'}
|
|
|
|
|
|
|
|
// ConfigStorage
|
|
|
|
;(function (window) {
|
|
|
|
var keyPrefix = ''
|
|
|
|
var noPrefix = false
|
|
|
|
var cache = {}
|
|
|
|
var useCs = !!(window.chrome && chrome.storage && chrome.storage.local)
|
|
|
|
var useLs = !useCs && !!window.localStorage
|
|
|
|
|
|
|
|
function storageSetPrefix (newPrefix) {
|
|
|
|
keyPrefix = newPrefix
|
|
|
|
}
|
|
|
|
|
|
|
|
function storageSetNoPrefix () {
|
|
|
|
noPrefix = true
|
|
|
|
}
|
|
|
|
|
|
|
|
function storageGetPrefix () {
|
|
|
|
if (noPrefix) {
|
|
|
|
noPrefix = false
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
return keyPrefix
|
|
|
|
}
|
|
|
|
|
|
|
|
function storageGetValue (keys, callback) {
|
|
|
|
var single = false
|
|
|
|
if (!Array.isArray(keys)) {
|
|
|
|
keys = Array.prototype.slice.call(arguments)
|
|
|
|
callback = keys.pop()
|
|
|
|
single = keys.length == 1
|
|
|
|
}
|
|
|
|
var result = [],
|
|
|
|
value
|
|
|
|
var allFound = true
|
|
|
|
var prefix = storageGetPrefix(),
|
|
|
|
i, key
|
|
|
|
|
|
|
|
for (i = 0; i < keys.length; i++) {
|
|
|
|
key = keys[i] = prefix + keys[i]
|
|
|
|
if (key.substr(0, 3) != 'xt_' && cache[key] !== undefined) {
|
|
|
|
result.push(cache[key])
|
|
|
|
}
|
|
|
|
else if (useLs) {
|
|
|
|
try {
|
|
|
|
value = localStorage.getItem(key)
|
|
|
|
} catch (e) {
|
|
|
|
useLs = false
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
value = (value === undefined || value === null) ? false : JSON.parse(value)
|
|
|
|
} catch (e) {
|
|
|
|
value = false
|
|
|
|
}
|
|
|
|
result.push(cache[key] = value)
|
|
|
|
}
|
|
|
|
else if (!useCs) {
|
|
|
|
result.push(cache[key] = false)
|
|
|
|
}else {
|
|
|
|
allFound = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (allFound) {
|
|
|
|
return callback(single ? result[0] : result)
|
|
|
|
}
|
|
|
|
|
|
|
|
chrome.storage.local.get(keys, function (resultObj) {
|
|
|
|
var value
|
|
|
|
result = []
|
|
|
|
for (i = 0; i < keys.length; i++) {
|
|
|
|
key = keys[i]
|
|
|
|
value = resultObj[key]
|
|
|
|
value = value === undefined || value === null ? false : JSON.parse(value)
|
|
|
|
result.push(cache[key] = value)
|
|
|
|
}
|
|
|
|
|
|
|
|
callback(single ? result[0] : result)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function storageSetValue (obj, callback) {
|
|
|
|
var keyValues = {}
|
|
|
|
var prefix = storageGetPrefix(),
|
|
|
|
key, value
|
|
|
|
|
|
|
|
for (key in obj) {
|
|
|
|
if (obj.hasOwnProperty(key)) {
|
|
|
|
value = obj[key]
|
|
|
|
key = prefix + key
|
|
|
|
cache[key] = value
|
|
|
|
value = JSON.stringify(value)
|
|
|
|
if (useLs) {
|
|
|
|
try {
|
|
|
|
localStorage.setItem(key, value)
|
|
|
|
} catch (e) {
|
|
|
|
useLs = false
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
keyValues[key] = value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (useLs || !useCs) {
|
|
|
|
if (callback) {
|
|
|
|
callback()
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
chrome.storage.local.set(keyValues, callback)
|
|
|
|
}
|
|
|
|
|
|
|
|
function storageRemoveValue (keys, callback) {
|
|
|
|
if (!Array.isArray(keys)) {
|
|
|
|
keys = Array.prototype.slice.call(arguments)
|
|
|
|
if (typeof keys[keys.length - 1] === 'function') {
|
|
|
|
callback = keys.pop()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var prefix = storageGetPrefix(),
|
|
|
|
i, key
|
|
|
|
|
|
|
|
for (i = 0; i < keys.length; i++) {
|
|
|
|
key = keys[i] = prefix + keys[i]
|
|
|
|
delete cache[key]
|
|
|
|
if (useLs) {
|
|
|
|
try {
|
|
|
|
localStorage.removeItem(key)
|
|
|
|
} catch (e) {
|
|
|
|
useLs = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (useCs) {
|
|
|
|
chrome.storage.local.remove(keys, callback)
|
|
|
|
}
|
|
|
|
else if (callback) {
|
|
|
|
callback()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function storageClear (callback) {
|
|
|
|
if (useLs) {
|
|
|
|
try {
|
|
|
|
localStorage.clear()
|
|
|
|
} catch (e) {
|
|
|
|
useLs = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (useCs) {
|
|
|
|
chrome.storage.local.clear(function () {
|
|
|
|
cache = {}
|
|
|
|
callback()
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
cache = {}
|
|
|
|
callback()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
window.ConfigStorage = {
|
|
|
|
prefix: storageSetPrefix,
|
|
|
|
noPrefix: storageSetNoPrefix,
|
|
|
|
get: storageGetValue,
|
|
|
|
set: storageSetValue,
|
|
|
|
remove: storageRemoveValue,
|
|
|
|
clear: storageClear
|
|
|
|
}
|
|
|
|
})(this)
|