Best JavaScript code snippet using wpt
includes.js
Source:includes.js
1(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");2for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f)}})(document,window.mixpanel||[]);3mixpanel.init("86f681be6799f4750b83c8c1509420b2");4;5var COUNTRIES = [];6COUNTRIES.push({value: 'US', label: 'United States'})7COUNTRIES.push({value: 'AF', label: 'Afghanistan'})8COUNTRIES.push({value: 'AL', label: 'Albania'})9COUNTRIES.push({value: 'DZ', label: 'Algeria'})10COUNTRIES.push({value: 'AS', label: 'American Samoa'})11COUNTRIES.push({value: 'AD', label: 'Andorra'})12COUNTRIES.push({value: 'AO', label: 'Angola'})13COUNTRIES.push({value: 'AI', label: 'Anguilla'})14COUNTRIES.push({value: 'AQ', label: 'Antarctica'})15COUNTRIES.push({value: 'AG', label: 'Antigua and Barbuda'})16COUNTRIES.push({value: 'AR', label: 'Argentina'})17COUNTRIES.push({value: 'AM', label: 'Armenia'})18COUNTRIES.push({value: 'AW', label: 'Aruba'})19COUNTRIES.push({value: 'AU', label: 'Australia'})20COUNTRIES.push({value: 'AT', label: 'Austria'})21COUNTRIES.push({value: 'AZ', label: 'Azerbaijan'})22COUNTRIES.push({value: 'AP', label: 'Azores'})23COUNTRIES.push({value: 'BS', label: 'Bahamas'})24COUNTRIES.push({value: 'BH', label: 'Bahrain'})25COUNTRIES.push({value: 'BD', label: 'Bangladesh'})26COUNTRIES.push({value: 'BB', label: 'Barbados'})27COUNTRIES.push({value: 'BY', label: 'Belarus'})28COUNTRIES.push({value: 'BE', label: 'Belgium'})29COUNTRIES.push({value: 'BZ', label: 'Belize'})30COUNTRIES.push({value: 'BJ', label: 'Benin'})31COUNTRIES.push({value: 'BM', label: 'Bermuda'})32COUNTRIES.push({value: 'BT', label: 'Bhutan'})33COUNTRIES.push({value: 'BO', label: 'Bolivia'})34COUNTRIES.push({value: 'BA', label: 'Bosnia And Herzegowina'})35COUNTRIES.push({value: 'XB', label: 'Bosnia-Herzegovina'})36COUNTRIES.push({value: 'BW', label: 'Botswana'})37COUNTRIES.push({value: 'BV', label: 'Bouvet Island'})38COUNTRIES.push({value: 'BR', label: 'Brazil'})39COUNTRIES.push({value: 'IO', label: 'British Indian Ocean Territory'})40COUNTRIES.push({value: 'VG', label: 'British Virgin Islands'})41COUNTRIES.push({value: 'BN', label: 'Brunei Darussalam'})42COUNTRIES.push({value: 'BG', label: 'Bulgaria'})43COUNTRIES.push({value: 'BF', label: 'Burkina Faso'})44COUNTRIES.push({value: 'BI', label: 'Burundi'})45COUNTRIES.push({value: 'KH', label: 'Cambodia'})46COUNTRIES.push({value: 'CM', label: 'Cameroon'})47COUNTRIES.push({value: 'CA', label: 'Canada'})48COUNTRIES.push({value: 'CV', label: 'Cape Verde'})49COUNTRIES.push({value: 'KY', label: 'Cayman Islands'})50COUNTRIES.push({value: 'CF', label: 'Central African Republic'})51COUNTRIES.push({value: 'TD', label: 'Chad'})52COUNTRIES.push({value: 'CL', label: 'Chile'})53COUNTRIES.push({value: 'CN', label: 'China'})54COUNTRIES.push({value: 'CX', label: 'Christmas Island'})55COUNTRIES.push({value: 'CC', label: 'Cocos (Keeling) Islands'})56COUNTRIES.push({value: 'CO', label: 'Colombia'})57COUNTRIES.push({value: 'KM', label: 'Comoros'})58COUNTRIES.push({value: 'CG', label: 'Congo'})59COUNTRIES.push({value: 'CD', label: 'Congo, The Democratic Republic O'})60COUNTRIES.push({value: 'CK', label: 'Cook Islands'})61COUNTRIES.push({value: 'XE', label: 'Corsica'})62COUNTRIES.push({value: 'CR', label: 'Costa Rica'})63COUNTRIES.push({value: 'CI', label: 'Cote d` Ivoire (Ivory Coast)'})64COUNTRIES.push({value: 'HR', label: 'Croatia'})65COUNTRIES.push({value: 'CU', label: 'Cuba'})66COUNTRIES.push({value: 'CY', label: 'Cyprus'})67COUNTRIES.push({value: 'CZ', label: 'Czech Republic'})68COUNTRIES.push({value: 'DK', label: 'Denmark'})69COUNTRIES.push({value: 'DJ', label: 'Djibouti'})70COUNTRIES.push({value: 'DM', label: 'Dominica'})71COUNTRIES.push({value: 'DO', label: 'Dominican Republic'})72COUNTRIES.push({value: 'TP', label: 'East Timor'})73COUNTRIES.push({value: 'EC', label: 'Ecuador'})74COUNTRIES.push({value: 'EG', label: 'Egypt'})75COUNTRIES.push({value: 'SV', label: 'El Salvador'})76COUNTRIES.push({value: 'GQ', label: 'Equatorial Guinea'})77COUNTRIES.push({value: 'ER', label: 'Eritrea'})78COUNTRIES.push({value: 'EE', label: 'Estonia'})79COUNTRIES.push({value: 'ET', label: 'Ethiopia'})80COUNTRIES.push({value: 'FK', label: 'Falkland Islands (Malvinas)'})81COUNTRIES.push({value: 'FO', label: 'Faroe Islands'})82COUNTRIES.push({value: 'FJ', label: 'Fiji'})83COUNTRIES.push({value: 'FI', label: 'Finland'})84COUNTRIES.push({value: 'FR', label: 'France (Includes Monaco)'})85COUNTRIES.push({value: 'FX', label: 'France, Metropolitan'})86COUNTRIES.push({value: 'GF', label: 'French Guiana'})87COUNTRIES.push({value: 'PF', label: 'French Polynesia'})88COUNTRIES.push({value: 'TA', label: 'French Polynesia (Tahiti)'})89COUNTRIES.push({value: 'TF', label: 'French Southern Territories'})90COUNTRIES.push({value: 'GA', label: 'Gabon'})91COUNTRIES.push({value: 'GM', label: 'Gambia'})92COUNTRIES.push({value: 'GE', label: 'Georgia'})93COUNTRIES.push({value: 'DE', label: 'Germany'})94COUNTRIES.push({value: 'GH', label: 'Ghana'})95COUNTRIES.push({value: 'GI', label: 'Gibraltar'})96COUNTRIES.push({value: 'GR', label: 'Greece'})97COUNTRIES.push({value: 'GL', label: 'Greenland'})98COUNTRIES.push({value: 'GD', label: 'Grenada'})99COUNTRIES.push({value: 'GP', label: 'Guadeloupe'})100COUNTRIES.push({value: 'GU', label: 'Guam'})101COUNTRIES.push({value: 'GT', label: 'Guatemala'})102COUNTRIES.push({value: 'GN', label: 'Guinea'})103COUNTRIES.push({value: 'GW', label: 'Guinea-Bissau'})104COUNTRIES.push({value: 'GY', label: 'Guyana'})105COUNTRIES.push({value: 'HT', label: 'Haiti'})106COUNTRIES.push({value: 'HM', label: 'Heard And Mc Donald Islands'})107COUNTRIES.push({value: 'VA', label: 'Holy See (Vatican City State)'})108COUNTRIES.push({value: 'HN', label: 'Honduras'})109COUNTRIES.push({value: 'HK', label: 'Hong Kong'})110COUNTRIES.push({value: 'HU', label: 'Hungary'})111COUNTRIES.push({value: 'IS', label: 'Iceland'})112COUNTRIES.push({value: 'IN', label: 'India'})113COUNTRIES.push({value: 'ID', label: 'Indonesia'})114COUNTRIES.push({value: 'IR', label: 'Iran'})115COUNTRIES.push({value: 'IQ', label: 'Iraq'})116COUNTRIES.push({value: 'IE', label: 'Ireland'})117COUNTRIES.push({value: 'EI', label: 'Ireland (Eire)'})118COUNTRIES.push({value: 'IL', label: 'Israel'})119COUNTRIES.push({value: 'IT', label: 'Italy'})120COUNTRIES.push({value: 'JM', label: 'Jamaica'})121COUNTRIES.push({value: 'JP', label: 'Japan'})122COUNTRIES.push({value: 'JO', label: 'Jordan'})123COUNTRIES.push({value: 'KZ', label: 'Kazakhstan'})124COUNTRIES.push({value: 'KE', label: 'Kenya'})125COUNTRIES.push({value: 'KI', label: 'Kiribati'})126COUNTRIES.push({value: 'KP', label: 'Korea, Democratic People\'S Repub'})127COUNTRIES.push({value: 'KW', label: 'Kuwait'})128COUNTRIES.push({value: 'KG', label: 'Kyrgyzstan'})129COUNTRIES.push({value: 'LA', label: 'Laos'})130COUNTRIES.push({value: 'LV', label: 'Latvia'})131COUNTRIES.push({value: 'LB', label: 'Lebanon'})132COUNTRIES.push({value: 'LS', label: 'Lesotho'})133COUNTRIES.push({value: 'LR', label: 'Liberia'})134COUNTRIES.push({value: 'LY', label: 'Libya'})135COUNTRIES.push({value: 'LI', label: 'Liechtenstein'})136COUNTRIES.push({value: 'LT', label: 'Lithuania'})137COUNTRIES.push({value: 'LU', label: 'Luxembourg'})138COUNTRIES.push({value: 'MO', label: 'Macao'})139COUNTRIES.push({value: 'MK', label: 'Macedonia'})140COUNTRIES.push({value: 'MG', label: 'Madagascar'})141COUNTRIES.push({value: 'ME', label: 'Madeira Islands'})142COUNTRIES.push({value: 'MW', label: 'Malawi'})143COUNTRIES.push({value: 'MY', label: 'Malaysia'})144COUNTRIES.push({value: 'MV', label: 'Maldives'})145COUNTRIES.push({value: 'ML', label: 'Mali'})146COUNTRIES.push({value: 'MT', label: 'Malta'})147COUNTRIES.push({value: 'MH', label: 'Marshall Islands'})148COUNTRIES.push({value: 'MQ', label: 'Martinique'})149COUNTRIES.push({value: 'MR', label: 'Mauritania'})150COUNTRIES.push({value: 'MU', label: 'Mauritius'})151COUNTRIES.push({value: 'YT', label: 'Mayotte'})152COUNTRIES.push({value: 'MX', label: 'Mexico'})153COUNTRIES.push({value: 'FM', label: 'Micronesia, Federated States Of'})154COUNTRIES.push({value: 'MD', label: 'Moldova, Republic Of'})155COUNTRIES.push({value: 'MC', label: 'Monaco'})156COUNTRIES.push({value: 'MN', label: 'Mongolia'})157COUNTRIES.push({value: 'MS', label: 'Montserrat'})158COUNTRIES.push({value: 'MA', label: 'Morocco'})159COUNTRIES.push({value: 'MZ', label: 'Mozambique'})160COUNTRIES.push({value: 'MM', label: 'Myanmar (Burma)'})161COUNTRIES.push({value: 'NA', label: 'Namibia'})162COUNTRIES.push({value: 'NR', label: 'Nauru'})163COUNTRIES.push({value: 'NP', label: 'Nepal'})164COUNTRIES.push({value: 'NL', label: 'Netherlands'})165COUNTRIES.push({value: 'AN', label: 'Netherlands Antilles'})166COUNTRIES.push({value: 'NC', label: 'New Caledonia'})167COUNTRIES.push({value: 'NZ', label: 'New Zealand'})168COUNTRIES.push({value: 'NI', label: 'Nicaragua'})169COUNTRIES.push({value: 'NE', label: 'Niger'})170COUNTRIES.push({value: 'NG', label: 'Nigeria'})171COUNTRIES.push({value: 'NU', label: 'Niue'})172COUNTRIES.push({value: 'NF', label: 'Norfolk Island'})173COUNTRIES.push({value: 'MP', label: 'Northern Mariana Islands'})174COUNTRIES.push({value: 'NO', label: 'Norway'})175COUNTRIES.push({value: 'OM', label: 'Oman'})176COUNTRIES.push({value: 'PK', label: 'Pakistan'})177COUNTRIES.push({value: 'PW', label: 'Palau'})178COUNTRIES.push({value: 'PS', label: 'Palestinian Territory, Occupied'})179COUNTRIES.push({value: 'PA', label: 'Panama'})180COUNTRIES.push({value: 'PG', label: 'Papua New Guinea'})181COUNTRIES.push({value: 'PY', label: 'Paraguay'})182COUNTRIES.push({value: 'PE', label: 'Peru'})183COUNTRIES.push({value: 'PH', label: 'Philippines'})184COUNTRIES.push({value: 'PN', label: 'Pitcairn'})185COUNTRIES.push({value: 'PL', label: 'Poland'})186COUNTRIES.push({value: 'PT', label: 'Portugal'})187COUNTRIES.push({value: 'PR', label: 'Puerto Rico'})188COUNTRIES.push({value: 'QA', label: 'Qatar'})189COUNTRIES.push({value: 'RE', label: 'Reunion'})190COUNTRIES.push({value: 'RO', label: 'Romania'})191COUNTRIES.push({value: 'RU', label: 'Russian Federation'})192COUNTRIES.push({value: 'RW', label: 'Rwanda'})193COUNTRIES.push({value: 'KN', label: 'Saint Kitts And Nevis'})194COUNTRIES.push({value: 'SM', label: 'San Marino'})195COUNTRIES.push({value: 'ST', label: 'Sao Tome and Principe'})196COUNTRIES.push({value: 'SA', label: 'Saudi Arabia'})197COUNTRIES.push({value: 'SN', label: 'Senegal'})198COUNTRIES.push({value: 'XS', label: 'Serbia-Montenegro'})199COUNTRIES.push({value: 'SC', label: 'Seychelles'})200COUNTRIES.push({value: 'SL', label: 'Sierra Leone'})201COUNTRIES.push({value: 'SG', label: 'Singapore'})202COUNTRIES.push({value: 'SK', label: 'Slovak Republic'})203COUNTRIES.push({value: 'SI', label: 'Slovenia'})204COUNTRIES.push({value: 'SB', label: 'Solomon Islands'})205COUNTRIES.push({value: 'SO', label: 'Somalia'})206COUNTRIES.push({value: 'ZA', label: 'South Africa'})207COUNTRIES.push({value: 'GS', label: 'South Georgia And The South Sand'})208COUNTRIES.push({value: 'KR', label: 'South Korea'})209COUNTRIES.push({value: 'ES', label: 'Spain'})210COUNTRIES.push({value: 'LK', label: 'Sri Lanka'})211COUNTRIES.push({value: 'NV', label: 'St. Christopher and Nevis'})212COUNTRIES.push({value: 'SH', label: 'St. Helena'})213COUNTRIES.push({value: 'LC', label: 'St. Lucia'})214COUNTRIES.push({value: 'PM', label: 'St. Pierre and Miquelon'})215COUNTRIES.push({value: 'VC', label: 'St. Vincent and the Grenadines'})216COUNTRIES.push({value: 'SD', label: 'Sudan'})217COUNTRIES.push({value: 'SR', label: 'Suriname'})218COUNTRIES.push({value: 'SJ', label: 'Svalbard And Jan Mayen Islands'})219COUNTRIES.push({value: 'SZ', label: 'Swaziland'})220COUNTRIES.push({value: 'SE', label: 'Sweden'})221COUNTRIES.push({value: 'CH', label: 'Switzerland'})222COUNTRIES.push({value: 'SY', label: 'Syrian Arab Republic'})223COUNTRIES.push({value: 'TW', label: 'Taiwan'})224COUNTRIES.push({value: 'TJ', label: 'Tajikistan'})225COUNTRIES.push({value: 'TZ', label: 'Tanzania'})226COUNTRIES.push({value: 'TH', label: 'Thailand'})227COUNTRIES.push({value: 'TG', label: 'Togo'})228COUNTRIES.push({value: 'TK', label: 'Tokelau'})229COUNTRIES.push({value: 'TO', label: 'Tonga'})230COUNTRIES.push({value: 'TT', label: 'Trinidad and Tobago'})231COUNTRIES.push({value: 'XU', label: 'Tristan da Cunha'})232COUNTRIES.push({value: 'TN', label: 'Tunisia'})233COUNTRIES.push({value: 'TR', label: 'Turkey'})234COUNTRIES.push({value: 'TM', label: 'Turkmenistan'})235COUNTRIES.push({value: 'TC', label: 'Turks and Caicos Islands'})236COUNTRIES.push({value: 'TV', label: 'Tuvalu'})237COUNTRIES.push({value: 'UG', label: 'Uganda'})238COUNTRIES.push({value: 'UA', label: 'Ukraine'})239COUNTRIES.push({value: 'AE', label: 'United Arab Emirates'})240COUNTRIES.push({value: 'UK', label: 'United Kingdom'})241COUNTRIES.push({value: 'GB', label: 'Great Britain'})242COUNTRIES.push({value: 'UM', label: 'United States Minor Outlying Isl'})243COUNTRIES.push({value: 'UY', label: 'Uruguay'})244COUNTRIES.push({value: 'UZ', label: 'Uzbekistan'})245COUNTRIES.push({value: 'VU', label: 'Vanuatu'})246COUNTRIES.push({value: 'XV', label: 'Vatican City'})247COUNTRIES.push({value: 'VE', label: 'Venezuela'})248COUNTRIES.push({value: 'VN', label: 'Vietnam'})249COUNTRIES.push({value: 'VI', label: 'Virgin Islands (U.S.)'})250COUNTRIES.push({value: 'WF', label: 'Wallis and Furuna Islands'})251COUNTRIES.push({value: 'EH', label: 'Western Sahara'})252COUNTRIES.push({value: 'WS', label: 'Western Samoa'})253COUNTRIES.push({value: 'YE', label: 'Yemen'})254COUNTRIES.push({value: 'YU', label: 'Yugoslavia'})255COUNTRIES.push({value: 'ZR', label: 'Zaire'})256COUNTRIES.push({value: 'ZM', label: 'Zambia'})257COUNTRIES.push({value: 'ZW', label: 'Zimbabwe'})258var STATES = {259 US: [],260 CA: [],261 UK: [],262 BR: [],263 AU: [],264 NL: [],265 EI: [],266};267STATES.US.push({label: 'Alaska', value: 'AK'});268STATES.US.push({label: 'Alabama', value: 'AL'});269STATES.US.push({label: 'Arkansas', value: 'AR'});270STATES.US.push({label: 'American Samoa', value: 'AS'});271STATES.US.push({label: 'Arizona', value: 'AZ'});272STATES.US.push({label: 'California', value: 'CA'});273STATES.US.push({label: 'Colorado', value: 'CO'});274STATES.US.push({label: 'Connecticut', value: 'CT'});275STATES.US.push({label: 'D.C.', value: 'DC'});276STATES.US.push({label: 'Delaware', value: 'DE'});277STATES.US.push({label: 'Florida', value: 'FL'});278STATES.US.push({label: 'Micronesia', value: 'FM'});279STATES.US.push({label: 'Georgia', value: 'GA'});280STATES.US.push({label: 'Guam', value: 'GU'});281STATES.US.push({label: 'Hawaii', value: 'HI'});282STATES.US.push({label: 'Iowa', value: 'IA'});283STATES.US.push({label: 'Idaho', value: 'ID'});284STATES.US.push({label: 'Illinois', value: 'IL'});285STATES.US.push({label: 'Indiana', value: 'IN'});286STATES.US.push({label: 'Kansas', value: 'KS'});287STATES.US.push({label: 'Kentucky', value: 'KY'});288STATES.US.push({label: 'Louisiana', value: 'LA'});289STATES.US.push({label: 'Massachusetts', value: 'MA'});290STATES.US.push({label: 'Maryland', value: 'MD'});291STATES.US.push({label: 'Maine', value: 'ME'});292STATES.US.push({label: 'Marshall Islands', value: 'MH'});293STATES.US.push({label: 'Michigan', value: 'MI'});294STATES.US.push({label: 'Minnesota', value: 'MN'});295STATES.US.push({label: 'Missouri', value: 'MO'});296STATES.US.push({label: 'Marianas', value: 'MP'});297STATES.US.push({label: 'Mississippi', value: 'MS'});298STATES.US.push({label: 'Montana', value: 'MT'});299STATES.US.push({label: 'North Carolina', value: 'NC'});300STATES.US.push({label: 'North Dakota', value: 'ND'});301STATES.US.push({label: 'Nebraska', value: 'NE'});302STATES.US.push({label: 'New Hampshire', value: 'NH'});303STATES.US.push({label: 'New Jersey', value: 'NJ'});304STATES.US.push({label: 'New Mexico', value: 'NM'});305STATES.US.push({label: 'Nevada', value: 'NV'});306STATES.US.push({label: 'New York', value: 'NY'});307STATES.US.push({label: 'Ohio', value: 'OH'});308STATES.US.push({label: 'Oklahoma', value: 'OK'});309STATES.US.push({label: 'Oregon', value: 'OR'});310STATES.US.push({label: 'Pennsylvania', value: 'PA'});311STATES.US.push({label: 'Puerto Rico', value: 'PR'});312STATES.US.push({label: 'Palau', value: 'PW'});313STATES.US.push({label: 'Rhode Island', value: 'RI'});314STATES.US.push({label: 'South Carolina', value: 'SC'});315STATES.US.push({label: 'South Dakota', value: 'SD'});316STATES.US.push({label: 'Tennessee', value: 'TN'});317STATES.US.push({label: 'Texas', value: 'TX'});318STATES.US.push({label: 'Utah', value: 'UT'});319STATES.US.push({label: 'Virginia', value: 'VA'});320STATES.US.push({label: 'Virgin Islands', value: 'VI'});321STATES.US.push({label: 'Vermont', value: 'VT'});322STATES.US.push({label: 'Washington', value: 'WA'});323STATES.US.push({label: 'Wisconsin', value: 'WI'});324STATES.US.push({label: 'West Virginia', value: 'WV'});325STATES.US.push({label: 'Wyoming', value: 'WY'});326STATES.US.push({label: 'Military Americas', value: 'AA'});327STATES.US.push({label: 'Military Europe/ME/Canada', value: 'AE'});328STATES.US.push({label: 'Military Pacific', value: 'AP'});329STATES.CA.push({label: 'Alberta', value: 'AB'});330STATES.CA.push({label: 'Manitoba', value: 'MB'});331STATES.CA.push({label: 'Alberta', value: 'AB'});332STATES.CA.push({label: 'British Columbia', value: 'BC'});333STATES.CA.push({label: 'Manitoba', value: 'MB'});334STATES.CA.push({label: 'New Brunswick', value: 'NB'});335STATES.CA.push({label: 'Newfoundland and Labrador', value: 'NL'});336STATES.CA.push({label: 'Nova Scotia', value: 'NS'});337STATES.CA.push({label: 'Northwest Territories', value: 'NT'});338STATES.CA.push({label: 'Nunavut', value: 'NU'});339STATES.CA.push({label: 'Ontario', value: 'ON'});340STATES.CA.push({label: 'Prince Edward Island', value: 'PE'});341STATES.CA.push({label: 'Quebec', value: 'QC'});342STATES.CA.push({label: 'Saskatchewan', value: 'SK'});343STATES.CA.push({label: 'Yukon Territory', value: 'YT'});344STATES.AU.push({label: 'Australian Antarctic Territory', value: 'AA'});345STATES.AU.push({label: 'Australian Capital Territory', value: 'AC'});346STATES.AU.push({label: 'Northern Territory', value: 'NT'});347STATES.AU.push({label: 'New South Wales', value: 'NS'});348STATES.AU.push({label: 'Queensland', value: 'QL'});349STATES.AU.push({label: 'South Australia', value: 'SA'});350STATES.AU.push({label: 'Tasmania', value: 'TA'});351STATES.AU.push({label: 'Victoria', value: 'VI'});352STATES.AU.push({label: 'Western Australia', value: 'WA'});353STATES.BR.push({label: 'Acre', value: 'AC'});354STATES.BR.push({label: 'Alagoas', value: 'AL'});355STATES.BR.push({label: 'Amazonas', value: 'AM'});356STATES.BR.push({label: 'Amapa', value: 'AP'});357STATES.BR.push({label: 'Baia', value: 'BA'});358STATES.BR.push({label: 'Ceara', value: 'CE'});359STATES.BR.push({label: 'Distrito Federal', value: 'DF'});360STATES.BR.push({label: 'Espirito Santo', value: 'ES'});361STATES.BR.push({label: 'Fernando de Noronha', value: 'FN'});362STATES.BR.push({label: 'Goias', value: 'GO'});363STATES.BR.push({label: 'Maranhao', value: 'MA'});364STATES.BR.push({label: 'Minas Gerais', value: 'MG'});365STATES.BR.push({label: 'Mato Grosso do Sul', value: 'MS'});366STATES.BR.push({label: 'Mato Grosso', value: 'MT'});367STATES.BR.push({label: 'Para', value: 'PA'});368STATES.BR.push({label: 'Paraiba', value: 'PB'});369STATES.BR.push({label: 'Pernambuco', value: 'PE'});370STATES.BR.push({label: 'Piaui', value: 'PI'});371STATES.BR.push({label: 'Parana', value: 'PR'});372STATES.BR.push({label: 'Rio de Janeiro', value: 'RJ'});373STATES.BR.push({label: 'Rio Grande do Norte', value: 'RN'});374STATES.BR.push({label: 'Rondonia', value: 'RO'});375STATES.BR.push({label: 'Roraima', value: 'RR'});376STATES.BR.push({label: 'Rio Grande do Sul', value: 'RS'});377STATES.BR.push({label: 'Santa Catarina', value: 'SC'});378STATES.BR.push({label: 'Sergipe', value: 'SE'});379STATES.BR.push({label: 'Sao Paulo', value: 'SP'});380STATES.BR.push({label: 'Tocatins', value: 'TO'});381STATES.NL.push({label: 'Drente', value: 'DR'});382STATES.NL.push({label: 'Flevoland', value: 'FL'});383STATES.NL.push({label: 'Friesland', value: 'FR'});384STATES.NL.push({label: 'Gelderland', value: 'GL'});385STATES.NL.push({label: 'Groningen', value: 'GR'});386STATES.NL.push({label: 'Limburg', value: 'LB'});387STATES.NL.push({label: 'Noord Brabant', value: 'NB'});388STATES.NL.push({label: 'Noord Holland', value: 'NH'});389STATES.NL.push({label: 'Overijssel', value: 'OV'});390STATES.NL.push({label: 'Utrecht', value: 'UT'});391STATES.NL.push({label: 'Zuid Holland', value: 'ZH'});392STATES.NL.push({label: 'Zeeland', value: 'ZL'});393STATES.UK.push({label: 'Avon', value: 'AV'});394STATES.UK.push({label: 'Bedfordshire', value: 'BE'});395STATES.UK.push({label: 'Berkshire', value: 'BE'});396STATES.UK.push({label: 'Buckinghamshire', value: 'BU'});397STATES.UK.push({label: 'Cambridgeshire', value: 'CA'});398STATES.UK.push({label: 'Cheshire', value: 'CH'});399STATES.UK.push({label: 'Cleveland', value: 'CL'});400STATES.UK.push({label: 'Cornwall', value: 'CO'});401STATES.UK.push({label: 'Cumbria', value: 'CU'});402STATES.UK.push({label: 'Derbyshire', value: 'DE'});403STATES.UK.push({label: 'Devon', value: 'DE'});404STATES.UK.push({label: 'Dorset', value: 'DO'});405STATES.UK.push({label: 'Durham', value: 'DU'});406STATES.UK.push({label: 'Essex', value: 'ES'});407STATES.UK.push({label: 'Gloucestershire', value: 'GL'});408STATES.UK.push({label: 'Greater London', value: 'GL'});409STATES.UK.push({label: 'Greater Manchester', value: 'GM'});410STATES.UK.push({label: 'Hampshire', value: 'HA'});411STATES.UK.push({label: 'Hereford & Worcestershire', value: 'HE'});412STATES.UK.push({label: 'Hertfordshire', value: 'HE'});413STATES.UK.push({label: 'Humberside', value: 'HU'});414STATES.UK.push({label: 'Isle of Man', value: 'IO'});415STATES.UK.push({label: 'Isle of Wight', value: 'IO'});416STATES.UK.push({label: 'Kent', value: 'KE'});417STATES.UK.push({label: 'Lancashire', value: 'LA'});418STATES.UK.push({label: 'Leicestershire', value: 'LE'});419STATES.UK.push({label: 'Lincolnshire', value: 'LI'});420STATES.UK.push({label: 'Merseyside', value: 'ME'});421STATES.UK.push({label: 'Norfolk', value: 'NO'});422STATES.UK.push({label: 'Northamptonshire', value: 'NH'});423STATES.UK.push({label: 'Northumberland', value: 'NT'});424STATES.UK.push({label: 'Nottinghamshire', value: 'NO'});425STATES.UK.push({label: 'Oxfordshire', value: 'OX'});426STATES.UK.push({label: 'Shropshire', value: 'SH'});427STATES.UK.push({label: 'Somerset', value: 'SO'});428STATES.UK.push({label: 'Staffordshire', value: 'ST'});429STATES.UK.push({label: 'Suffolk', value: 'SU'});430STATES.UK.push({label: 'Surrey', value: 'SU'});431STATES.UK.push({label: 'Sussex', value: 'SU'});432STATES.UK.push({label: 'Warwickshire', value: 'WA'});433STATES.UK.push({label: 'West Midlands', value: 'WM'});434STATES.UK.push({label: 'Wiltshire', value: 'WI'});435STATES.UK.push({label: 'Yorkshire', value: 'YO'});436STATES.EI.push({label: 'County Antrim', value: 'CO'});437STATES.EI.push({label: 'County Armagh', value: 'CO'});438STATES.EI.push({label: 'County Down', value: 'CO'});439STATES.EI.push({label: 'County Fermanagh', value: 'CO'});440STATES.EI.push({label: 'County Londonderry', value: 'CO'});441STATES.EI.push({label: 'County Tyrone', value: 'CO'});442STATES.EI.push({label: 'County Cavan', value: 'CO'});443STATES.EI.push({label: 'County Donegal', value: 'CO'});444STATES.EI.push({label: 'County Monaghan', value: 'CO'});445STATES.EI.push({label: 'County Dublin', value: 'CO'});446STATES.EI.push({label: 'County Carlow', value: 'CO'});447STATES.EI.push({label: 'County Kildare', value: 'CO'});448STATES.EI.push({label: 'County Kilkenny', value: 'CO'});449STATES.EI.push({label: 'County Laois', value: 'CO'});450STATES.EI.push({label: 'County Longford', value: 'CO'});451STATES.EI.push({label: 'County Louth', value: 'CO'});452STATES.EI.push({label: 'County Meath', value: 'CO'});453STATES.EI.push({label: 'County Offaly', value: 'CO'});454STATES.EI.push({label: 'County Westmeath', value: 'CO'});455STATES.EI.push({label: 'County Wexford', value: 'CO'});456STATES.EI.push({label: 'County Wicklow', value: 'CO'});457STATES.EI.push({label: 'County Galway', value: 'CO'});458STATES.EI.push({label: 'County Mayo', value: 'CO'});459STATES.EI.push({label: 'County Leitrim', value: 'CO'});460STATES.EI.push({label: 'County Roscommon', value: 'CO'});461STATES.EI.push({label: 'County Sligo', value: 'CO'});462STATES.EI.push({label: 'County Clare', value: 'CO'});463STATES.EI.push({label: 'County Cork', value: 'CO'});464STATES.EI.push({label: 'County Kerry', value: 'CO'});465STATES.EI.push({label: 'County Limerick', value: 'CO'});466STATES.EI.push({label: 'County Tipperary', value: 'CO'});467STATES.EI.push({label: 'County Waterford', value: 'CO'});468;469 window.cookieconsent_options = {"message":"This website uses cookies to ensure you get the best experience on our website","dismiss":"Got it!","learnMore":"More info","link":null,"theme":"light-bottom"};470;471var COOKIE_TIMEOUT_MS = 900000;472var STORAGE_KEY = 'LUCYBOT_RECIPE_CREDS';473if (window.location.href.match(/\?.*signup=true/)) {474 $(document).ready(function() {475 $('#KalturaSignup').modal('show');476 });477}478App.controller('Kaltura', function($scope) {479 $scope.user = {};480 $scope.pathname = window.location.pathname;481 $scope.hash = window.location.hash;...
locations.js
Source:locations.js
1var COUNTRIES = [];2COUNTRIES.push({value: 'US', label: 'United States'})3COUNTRIES.push({value: 'AF', label: 'Afghanistan'})4COUNTRIES.push({value: 'AL', label: 'Albania'})5COUNTRIES.push({value: 'DZ', label: 'Algeria'})6COUNTRIES.push({value: 'AS', label: 'American Samoa'})7COUNTRIES.push({value: 'AD', label: 'Andorra'})8COUNTRIES.push({value: 'AO', label: 'Angola'})9COUNTRIES.push({value: 'AI', label: 'Anguilla'})10COUNTRIES.push({value: 'AQ', label: 'Antarctica'})11COUNTRIES.push({value: 'AG', label: 'Antigua and Barbuda'})12COUNTRIES.push({value: 'AR', label: 'Argentina'})13COUNTRIES.push({value: 'AM', label: 'Armenia'})14COUNTRIES.push({value: 'AW', label: 'Aruba'})15COUNTRIES.push({value: 'AU', label: 'Australia'})16COUNTRIES.push({value: 'AT', label: 'Austria'})17COUNTRIES.push({value: 'AZ', label: 'Azerbaijan'})18COUNTRIES.push({value: 'AP', label: 'Azores'})19COUNTRIES.push({value: 'BS', label: 'Bahamas'})20COUNTRIES.push({value: 'BH', label: 'Bahrain'})21COUNTRIES.push({value: 'BD', label: 'Bangladesh'})22COUNTRIES.push({value: 'BB', label: 'Barbados'})23COUNTRIES.push({value: 'BY', label: 'Belarus'})24COUNTRIES.push({value: 'BE', label: 'Belgium'})25COUNTRIES.push({value: 'BZ', label: 'Belize'})26COUNTRIES.push({value: 'BJ', label: 'Benin'})27COUNTRIES.push({value: 'BM', label: 'Bermuda'})28COUNTRIES.push({value: 'BT', label: 'Bhutan'})29COUNTRIES.push({value: 'BO', label: 'Bolivia'})30COUNTRIES.push({value: 'BA', label: 'Bosnia And Herzegowina'})31COUNTRIES.push({value: 'XB', label: 'Bosnia-Herzegovina'})32COUNTRIES.push({value: 'BW', label: 'Botswana'})33COUNTRIES.push({value: 'BV', label: 'Bouvet Island'})34COUNTRIES.push({value: 'BR', label: 'Brazil'})35COUNTRIES.push({value: 'IO', label: 'British Indian Ocean Territory'})36COUNTRIES.push({value: 'VG', label: 'British Virgin Islands'})37COUNTRIES.push({value: 'BN', label: 'Brunei Darussalam'})38COUNTRIES.push({value: 'BG', label: 'Bulgaria'})39COUNTRIES.push({value: 'BF', label: 'Burkina Faso'})40COUNTRIES.push({value: 'BI', label: 'Burundi'})41COUNTRIES.push({value: 'KH', label: 'Cambodia'})42COUNTRIES.push({value: 'CM', label: 'Cameroon'})43COUNTRIES.push({value: 'CA', label: 'Canada'})44COUNTRIES.push({value: 'CV', label: 'Cape Verde'})45COUNTRIES.push({value: 'KY', label: 'Cayman Islands'})46COUNTRIES.push({value: 'CF', label: 'Central African Republic'})47COUNTRIES.push({value: 'TD', label: 'Chad'})48COUNTRIES.push({value: 'CL', label: 'Chile'})49COUNTRIES.push({value: 'CN', label: 'China'})50COUNTRIES.push({value: 'CX', label: 'Christmas Island'})51COUNTRIES.push({value: 'CC', label: 'Cocos (Keeling) Islands'})52COUNTRIES.push({value: 'CO', label: 'Colombia'})53COUNTRIES.push({value: 'KM', label: 'Comoros'})54COUNTRIES.push({value: 'CG', label: 'Congo'})55COUNTRIES.push({value: 'CD', label: 'Congo, The Democratic Republic O'})56COUNTRIES.push({value: 'CK', label: 'Cook Islands'})57COUNTRIES.push({value: 'XE', label: 'Corsica'})58COUNTRIES.push({value: 'CR', label: 'Costa Rica'})59COUNTRIES.push({value: 'CI', label: 'Cote d` Ivoire (Ivory Coast)'})60COUNTRIES.push({value: 'HR', label: 'Croatia'})61COUNTRIES.push({value: 'CU', label: 'Cuba'})62COUNTRIES.push({value: 'CY', label: 'Cyprus'})63COUNTRIES.push({value: 'CZ', label: 'Czech Republic'})64COUNTRIES.push({value: 'DK', label: 'Denmark'})65COUNTRIES.push({value: 'DJ', label: 'Djibouti'})66COUNTRIES.push({value: 'DM', label: 'Dominica'})67COUNTRIES.push({value: 'DO', label: 'Dominican Republic'})68COUNTRIES.push({value: 'TP', label: 'East Timor'})69COUNTRIES.push({value: 'EC', label: 'Ecuador'})70COUNTRIES.push({value: 'EG', label: 'Egypt'})71COUNTRIES.push({value: 'SV', label: 'El Salvador'})72COUNTRIES.push({value: 'GQ', label: 'Equatorial Guinea'})73COUNTRIES.push({value: 'ER', label: 'Eritrea'})74COUNTRIES.push({value: 'EE', label: 'Estonia'})75COUNTRIES.push({value: 'ET', label: 'Ethiopia'})76COUNTRIES.push({value: 'FK', label: 'Falkland Islands (Malvinas)'})77COUNTRIES.push({value: 'FO', label: 'Faroe Islands'})78COUNTRIES.push({value: 'FJ', label: 'Fiji'})79COUNTRIES.push({value: 'FI', label: 'Finland'})80COUNTRIES.push({value: 'FR', label: 'France (Includes Monaco)'})81COUNTRIES.push({value: 'FX', label: 'France, Metropolitan'})82COUNTRIES.push({value: 'GF', label: 'French Guiana'})83COUNTRIES.push({value: 'PF', label: 'French Polynesia'})84COUNTRIES.push({value: 'TA', label: 'French Polynesia (Tahiti)'})85COUNTRIES.push({value: 'TF', label: 'French Southern Territories'})86COUNTRIES.push({value: 'GA', label: 'Gabon'})87COUNTRIES.push({value: 'GM', label: 'Gambia'})88COUNTRIES.push({value: 'GE', label: 'Georgia'})89COUNTRIES.push({value: 'DE', label: 'Germany'})90COUNTRIES.push({value: 'GH', label: 'Ghana'})91COUNTRIES.push({value: 'GI', label: 'Gibraltar'})92COUNTRIES.push({value: 'GR', label: 'Greece'})93COUNTRIES.push({value: 'GL', label: 'Greenland'})94COUNTRIES.push({value: 'GD', label: 'Grenada'})95COUNTRIES.push({value: 'GP', label: 'Guadeloupe'})96COUNTRIES.push({value: 'GU', label: 'Guam'})97COUNTRIES.push({value: 'GT', label: 'Guatemala'})98COUNTRIES.push({value: 'GN', label: 'Guinea'})99COUNTRIES.push({value: 'GW', label: 'Guinea-Bissau'})100COUNTRIES.push({value: 'GY', label: 'Guyana'})101COUNTRIES.push({value: 'HT', label: 'Haiti'})102COUNTRIES.push({value: 'HM', label: 'Heard And Mc Donald Islands'})103COUNTRIES.push({value: 'VA', label: 'Holy See (Vatican City State)'})104COUNTRIES.push({value: 'HN', label: 'Honduras'})105COUNTRIES.push({value: 'HK', label: 'Hong Kong'})106COUNTRIES.push({value: 'HU', label: 'Hungary'})107COUNTRIES.push({value: 'IS', label: 'Iceland'})108COUNTRIES.push({value: 'IN', label: 'India'})109COUNTRIES.push({value: 'ID', label: 'Indonesia'})110COUNTRIES.push({value: 'IR', label: 'Iran'})111COUNTRIES.push({value: 'IQ', label: 'Iraq'})112COUNTRIES.push({value: 'IE', label: 'Ireland'})113COUNTRIES.push({value: 'EI', label: 'Ireland (Eire)'})114COUNTRIES.push({value: 'IL', label: 'Israel'})115COUNTRIES.push({value: 'IT', label: 'Italy'})116COUNTRIES.push({value: 'JM', label: 'Jamaica'})117COUNTRIES.push({value: 'JP', label: 'Japan'})118COUNTRIES.push({value: 'JO', label: 'Jordan'})119COUNTRIES.push({value: 'KZ', label: 'Kazakhstan'})120COUNTRIES.push({value: 'KE', label: 'Kenya'})121COUNTRIES.push({value: 'KI', label: 'Kiribati'})122COUNTRIES.push({value: 'KP', label: 'Korea, Democratic People\'S Repub'})123COUNTRIES.push({value: 'KW', label: 'Kuwait'})124COUNTRIES.push({value: 'KG', label: 'Kyrgyzstan'})125COUNTRIES.push({value: 'LA', label: 'Laos'})126COUNTRIES.push({value: 'LV', label: 'Latvia'})127COUNTRIES.push({value: 'LB', label: 'Lebanon'})128COUNTRIES.push({value: 'LS', label: 'Lesotho'})129COUNTRIES.push({value: 'LR', label: 'Liberia'})130COUNTRIES.push({value: 'LY', label: 'Libya'})131COUNTRIES.push({value: 'LI', label: 'Liechtenstein'})132COUNTRIES.push({value: 'LT', label: 'Lithuania'})133COUNTRIES.push({value: 'LU', label: 'Luxembourg'})134COUNTRIES.push({value: 'MO', label: 'Macao'})135COUNTRIES.push({value: 'MK', label: 'Macedonia'})136COUNTRIES.push({value: 'MG', label: 'Madagascar'})137COUNTRIES.push({value: 'ME', label: 'Madeira Islands'})138COUNTRIES.push({value: 'MW', label: 'Malawi'})139COUNTRIES.push({value: 'MY', label: 'Malaysia'})140COUNTRIES.push({value: 'MV', label: 'Maldives'})141COUNTRIES.push({value: 'ML', label: 'Mali'})142COUNTRIES.push({value: 'MT', label: 'Malta'})143COUNTRIES.push({value: 'MH', label: 'Marshall Islands'})144COUNTRIES.push({value: 'MQ', label: 'Martinique'})145COUNTRIES.push({value: 'MR', label: 'Mauritania'})146COUNTRIES.push({value: 'MU', label: 'Mauritius'})147COUNTRIES.push({value: 'YT', label: 'Mayotte'})148COUNTRIES.push({value: 'MX', label: 'Mexico'})149COUNTRIES.push({value: 'FM', label: 'Micronesia, Federated States Of'})150COUNTRIES.push({value: 'MD', label: 'Moldova, Republic Of'})151COUNTRIES.push({value: 'MC', label: 'Monaco'})152COUNTRIES.push({value: 'MN', label: 'Mongolia'})153COUNTRIES.push({value: 'MS', label: 'Montserrat'})154COUNTRIES.push({value: 'MA', label: 'Morocco'})155COUNTRIES.push({value: 'MZ', label: 'Mozambique'})156COUNTRIES.push({value: 'MM', label: 'Myanmar (Burma)'})157COUNTRIES.push({value: 'NA', label: 'Namibia'})158COUNTRIES.push({value: 'NR', label: 'Nauru'})159COUNTRIES.push({value: 'NP', label: 'Nepal'})160COUNTRIES.push({value: 'NL', label: 'Netherlands'})161COUNTRIES.push({value: 'AN', label: 'Netherlands Antilles'})162COUNTRIES.push({value: 'NC', label: 'New Caledonia'})163COUNTRIES.push({value: 'NZ', label: 'New Zealand'})164COUNTRIES.push({value: 'NI', label: 'Nicaragua'})165COUNTRIES.push({value: 'NE', label: 'Niger'})166COUNTRIES.push({value: 'NG', label: 'Nigeria'})167COUNTRIES.push({value: 'NU', label: 'Niue'})168COUNTRIES.push({value: 'NF', label: 'Norfolk Island'})169COUNTRIES.push({value: 'MP', label: 'Northern Mariana Islands'})170COUNTRIES.push({value: 'NO', label: 'Norway'})171COUNTRIES.push({value: 'OM', label: 'Oman'})172COUNTRIES.push({value: 'PK', label: 'Pakistan'})173COUNTRIES.push({value: 'PW', label: 'Palau'})174COUNTRIES.push({value: 'PS', label: 'Palestinian Territory, Occupied'})175COUNTRIES.push({value: 'PA', label: 'Panama'})176COUNTRIES.push({value: 'PG', label: 'Papua New Guinea'})177COUNTRIES.push({value: 'PY', label: 'Paraguay'})178COUNTRIES.push({value: 'PE', label: 'Peru'})179COUNTRIES.push({value: 'PH', label: 'Philippines'})180COUNTRIES.push({value: 'PN', label: 'Pitcairn'})181COUNTRIES.push({value: 'PL', label: 'Poland'})182COUNTRIES.push({value: 'PT', label: 'Portugal'})183COUNTRIES.push({value: 'PR', label: 'Puerto Rico'})184COUNTRIES.push({value: 'QA', label: 'Qatar'})185COUNTRIES.push({value: 'RE', label: 'Reunion'})186COUNTRIES.push({value: 'RO', label: 'Romania'})187COUNTRIES.push({value: 'RU', label: 'Russian Federation'})188COUNTRIES.push({value: 'RW', label: 'Rwanda'})189COUNTRIES.push({value: 'KN', label: 'Saint Kitts And Nevis'})190COUNTRIES.push({value: 'SM', label: 'San Marino'})191COUNTRIES.push({value: 'ST', label: 'Sao Tome and Principe'})192COUNTRIES.push({value: 'SA', label: 'Saudi Arabia'})193COUNTRIES.push({value: 'SN', label: 'Senegal'})194COUNTRIES.push({value: 'XS', label: 'Serbia-Montenegro'})195COUNTRIES.push({value: 'SC', label: 'Seychelles'})196COUNTRIES.push({value: 'SL', label: 'Sierra Leone'})197COUNTRIES.push({value: 'SG', label: 'Singapore'})198COUNTRIES.push({value: 'SK', label: 'Slovak Republic'})199COUNTRIES.push({value: 'SI', label: 'Slovenia'})200COUNTRIES.push({value: 'SB', label: 'Solomon Islands'})201COUNTRIES.push({value: 'SO', label: 'Somalia'})202COUNTRIES.push({value: 'ZA', label: 'South Africa'})203COUNTRIES.push({value: 'GS', label: 'South Georgia And The South Sand'})204COUNTRIES.push({value: 'KR', label: 'South Korea'})205COUNTRIES.push({value: 'ES', label: 'Spain'})206COUNTRIES.push({value: 'LK', label: 'Sri Lanka'})207COUNTRIES.push({value: 'NV', label: 'St. Christopher and Nevis'})208COUNTRIES.push({value: 'SH', label: 'St. Helena'})209COUNTRIES.push({value: 'LC', label: 'St. Lucia'})210COUNTRIES.push({value: 'PM', label: 'St. Pierre and Miquelon'})211COUNTRIES.push({value: 'VC', label: 'St. Vincent and the Grenadines'})212COUNTRIES.push({value: 'SD', label: 'Sudan'})213COUNTRIES.push({value: 'SR', label: 'Suriname'})214COUNTRIES.push({value: 'SJ', label: 'Svalbard And Jan Mayen Islands'})215COUNTRIES.push({value: 'SZ', label: 'Swaziland'})216COUNTRIES.push({value: 'SE', label: 'Sweden'})217COUNTRIES.push({value: 'CH', label: 'Switzerland'})218COUNTRIES.push({value: 'SY', label: 'Syrian Arab Republic'})219COUNTRIES.push({value: 'TW', label: 'Taiwan'})220COUNTRIES.push({value: 'TJ', label: 'Tajikistan'})221COUNTRIES.push({value: 'TZ', label: 'Tanzania'})222COUNTRIES.push({value: 'TH', label: 'Thailand'})223COUNTRIES.push({value: 'TG', label: 'Togo'})224COUNTRIES.push({value: 'TK', label: 'Tokelau'})225COUNTRIES.push({value: 'TO', label: 'Tonga'})226COUNTRIES.push({value: 'TT', label: 'Trinidad and Tobago'})227COUNTRIES.push({value: 'XU', label: 'Tristan da Cunha'})228COUNTRIES.push({value: 'TN', label: 'Tunisia'})229COUNTRIES.push({value: 'TR', label: 'Turkey'})230COUNTRIES.push({value: 'TM', label: 'Turkmenistan'})231COUNTRIES.push({value: 'TC', label: 'Turks and Caicos Islands'})232COUNTRIES.push({value: 'TV', label: 'Tuvalu'})233COUNTRIES.push({value: 'UG', label: 'Uganda'})234COUNTRIES.push({value: 'UA', label: 'Ukraine'})235COUNTRIES.push({value: 'AE', label: 'United Arab Emirates'})236COUNTRIES.push({value: 'UK', label: 'United Kingdom'})237COUNTRIES.push({value: 'GB', label: 'Great Britain'})238COUNTRIES.push({value: 'UM', label: 'United States Minor Outlying Isl'})239COUNTRIES.push({value: 'UY', label: 'Uruguay'})240COUNTRIES.push({value: 'UZ', label: 'Uzbekistan'})241COUNTRIES.push({value: 'VU', label: 'Vanuatu'})242COUNTRIES.push({value: 'XV', label: 'Vatican City'})243COUNTRIES.push({value: 'VE', label: 'Venezuela'})244COUNTRIES.push({value: 'VN', label: 'Vietnam'})245COUNTRIES.push({value: 'VI', label: 'Virgin Islands (U.S.)'})246COUNTRIES.push({value: 'WF', label: 'Wallis and Furuna Islands'})247COUNTRIES.push({value: 'EH', label: 'Western Sahara'})248COUNTRIES.push({value: 'WS', label: 'Western Samoa'})249COUNTRIES.push({value: 'YE', label: 'Yemen'})250COUNTRIES.push({value: 'YU', label: 'Yugoslavia'})251COUNTRIES.push({value: 'ZR', label: 'Zaire'})252COUNTRIES.push({value: 'ZM', label: 'Zambia'})253COUNTRIES.push({value: 'ZW', label: 'Zimbabwe'})254var STATES = {255 US: [],256 CA: [],257 UK: [],258 BR: [],259 AU: [],260 NL: [],261 EI: [],262};263STATES.US.push({label: 'Alaska', value: 'AK'});264STATES.US.push({label: 'Alabama', value: 'AL'});265STATES.US.push({label: 'Arkansas', value: 'AR'});266STATES.US.push({label: 'American Samoa', value: 'AS'});267STATES.US.push({label: 'Arizona', value: 'AZ'});268STATES.US.push({label: 'California', value: 'CA'});269STATES.US.push({label: 'Colorado', value: 'CO'});270STATES.US.push({label: 'Connecticut', value: 'CT'});271STATES.US.push({label: 'D.C.', value: 'DC'});272STATES.US.push({label: 'Delaware', value: 'DE'});273STATES.US.push({label: 'Florida', value: 'FL'});274STATES.US.push({label: 'Micronesia', value: 'FM'});275STATES.US.push({label: 'Georgia', value: 'GA'});276STATES.US.push({label: 'Guam', value: 'GU'});277STATES.US.push({label: 'Hawaii', value: 'HI'});278STATES.US.push({label: 'Iowa', value: 'IA'});279STATES.US.push({label: 'Idaho', value: 'ID'});280STATES.US.push({label: 'Illinois', value: 'IL'});281STATES.US.push({label: 'Indiana', value: 'IN'});282STATES.US.push({label: 'Kansas', value: 'KS'});283STATES.US.push({label: 'Kentucky', value: 'KY'});284STATES.US.push({label: 'Louisiana', value: 'LA'});285STATES.US.push({label: 'Massachusetts', value: 'MA'});286STATES.US.push({label: 'Maryland', value: 'MD'});287STATES.US.push({label: 'Maine', value: 'ME'});288STATES.US.push({label: 'Marshall Islands', value: 'MH'});289STATES.US.push({label: 'Michigan', value: 'MI'});290STATES.US.push({label: 'Minnesota', value: 'MN'});291STATES.US.push({label: 'Missouri', value: 'MO'});292STATES.US.push({label: 'Marianas', value: 'MP'});293STATES.US.push({label: 'Mississippi', value: 'MS'});294STATES.US.push({label: 'Montana', value: 'MT'});295STATES.US.push({label: 'North Carolina', value: 'NC'});296STATES.US.push({label: 'North Dakota', value: 'ND'});297STATES.US.push({label: 'Nebraska', value: 'NE'});298STATES.US.push({label: 'New Hampshire', value: 'NH'});299STATES.US.push({label: 'New Jersey', value: 'NJ'});300STATES.US.push({label: 'New Mexico', value: 'NM'});301STATES.US.push({label: 'Nevada', value: 'NV'});302STATES.US.push({label: 'New York', value: 'NY'});303STATES.US.push({label: 'Ohio', value: 'OH'});304STATES.US.push({label: 'Oklahoma', value: 'OK'});305STATES.US.push({label: 'Oregon', value: 'OR'});306STATES.US.push({label: 'Pennsylvania', value: 'PA'});307STATES.US.push({label: 'Puerto Rico', value: 'PR'});308STATES.US.push({label: 'Palau', value: 'PW'});309STATES.US.push({label: 'Rhode Island', value: 'RI'});310STATES.US.push({label: 'South Carolina', value: 'SC'});311STATES.US.push({label: 'South Dakota', value: 'SD'});312STATES.US.push({label: 'Tennessee', value: 'TN'});313STATES.US.push({label: 'Texas', value: 'TX'});314STATES.US.push({label: 'Utah', value: 'UT'});315STATES.US.push({label: 'Virginia', value: 'VA'});316STATES.US.push({label: 'Virgin Islands', value: 'VI'});317STATES.US.push({label: 'Vermont', value: 'VT'});318STATES.US.push({label: 'Washington', value: 'WA'});319STATES.US.push({label: 'Wisconsin', value: 'WI'});320STATES.US.push({label: 'West Virginia', value: 'WV'});321STATES.US.push({label: 'Wyoming', value: 'WY'});322STATES.US.push({label: 'Military Americas', value: 'AA'});323STATES.US.push({label: 'Military Europe/ME/Canada', value: 'AE'});324STATES.US.push({label: 'Military Pacific', value: 'AP'});325STATES.CA.push({label: 'Alberta', value: 'AB'});326STATES.CA.push({label: 'Manitoba', value: 'MB'});327STATES.CA.push({label: 'Alberta', value: 'AB'});328STATES.CA.push({label: 'British Columbia', value: 'BC'});329STATES.CA.push({label: 'Manitoba', value: 'MB'});330STATES.CA.push({label: 'New Brunswick', value: 'NB'});331STATES.CA.push({label: 'Newfoundland and Labrador', value: 'NL'});332STATES.CA.push({label: 'Nova Scotia', value: 'NS'});333STATES.CA.push({label: 'Northwest Territories', value: 'NT'});334STATES.CA.push({label: 'Nunavut', value: 'NU'});335STATES.CA.push({label: 'Ontario', value: 'ON'});336STATES.CA.push({label: 'Prince Edward Island', value: 'PE'});337STATES.CA.push({label: 'Quebec', value: 'QC'});338STATES.CA.push({label: 'Saskatchewan', value: 'SK'});339STATES.CA.push({label: 'Yukon Territory', value: 'YT'});340STATES.AU.push({label: 'Australian Antarctic Territory', value: 'AA'});341STATES.AU.push({label: 'Australian Capital Territory', value: 'AC'});342STATES.AU.push({label: 'Northern Territory', value: 'NT'});343STATES.AU.push({label: 'New South Wales', value: 'NS'});344STATES.AU.push({label: 'Queensland', value: 'QL'});345STATES.AU.push({label: 'South Australia', value: 'SA'});346STATES.AU.push({label: 'Tasmania', value: 'TA'});347STATES.AU.push({label: 'Victoria', value: 'VI'});348STATES.AU.push({label: 'Western Australia', value: 'WA'});349STATES.BR.push({label: 'Acre', value: 'AC'});350STATES.BR.push({label: 'Alagoas', value: 'AL'});351STATES.BR.push({label: 'Amazonas', value: 'AM'});352STATES.BR.push({label: 'Amapa', value: 'AP'});353STATES.BR.push({label: 'Baia', value: 'BA'});354STATES.BR.push({label: 'Ceara', value: 'CE'});355STATES.BR.push({label: 'Distrito Federal', value: 'DF'});356STATES.BR.push({label: 'Espirito Santo', value: 'ES'});357STATES.BR.push({label: 'Fernando de Noronha', value: 'FN'});358STATES.BR.push({label: 'Goias', value: 'GO'});359STATES.BR.push({label: 'Maranhao', value: 'MA'});360STATES.BR.push({label: 'Minas Gerais', value: 'MG'});361STATES.BR.push({label: 'Mato Grosso do Sul', value: 'MS'});362STATES.BR.push({label: 'Mato Grosso', value: 'MT'});363STATES.BR.push({label: 'Para', value: 'PA'});364STATES.BR.push({label: 'Paraiba', value: 'PB'});365STATES.BR.push({label: 'Pernambuco', value: 'PE'});366STATES.BR.push({label: 'Piaui', value: 'PI'});367STATES.BR.push({label: 'Parana', value: 'PR'});368STATES.BR.push({label: 'Rio de Janeiro', value: 'RJ'});369STATES.BR.push({label: 'Rio Grande do Norte', value: 'RN'});370STATES.BR.push({label: 'Rondonia', value: 'RO'});371STATES.BR.push({label: 'Roraima', value: 'RR'});372STATES.BR.push({label: 'Rio Grande do Sul', value: 'RS'});373STATES.BR.push({label: 'Santa Catarina', value: 'SC'});374STATES.BR.push({label: 'Sergipe', value: 'SE'});375STATES.BR.push({label: 'Sao Paulo', value: 'SP'});376STATES.BR.push({label: 'Tocatins', value: 'TO'});377STATES.NL.push({label: 'Drente', value: 'DR'});378STATES.NL.push({label: 'Flevoland', value: 'FL'});379STATES.NL.push({label: 'Friesland', value: 'FR'});380STATES.NL.push({label: 'Gelderland', value: 'GL'});381STATES.NL.push({label: 'Groningen', value: 'GR'});382STATES.NL.push({label: 'Limburg', value: 'LB'});383STATES.NL.push({label: 'Noord Brabant', value: 'NB'});384STATES.NL.push({label: 'Noord Holland', value: 'NH'});385STATES.NL.push({label: 'Overijssel', value: 'OV'});386STATES.NL.push({label: 'Utrecht', value: 'UT'});387STATES.NL.push({label: 'Zuid Holland', value: 'ZH'});388STATES.NL.push({label: 'Zeeland', value: 'ZL'});389STATES.UK.push({label: 'Avon', value: 'AV'});390STATES.UK.push({label: 'Bedfordshire', value: 'BE'});391STATES.UK.push({label: 'Berkshire', value: 'BE'});392STATES.UK.push({label: 'Buckinghamshire', value: 'BU'});393STATES.UK.push({label: 'Cambridgeshire', value: 'CA'});394STATES.UK.push({label: 'Cheshire', value: 'CH'});395STATES.UK.push({label: 'Cleveland', value: 'CL'});396STATES.UK.push({label: 'Cornwall', value: 'CO'});397STATES.UK.push({label: 'Cumbria', value: 'CU'});398STATES.UK.push({label: 'Derbyshire', value: 'DE'});399STATES.UK.push({label: 'Devon', value: 'DE'});400STATES.UK.push({label: 'Dorset', value: 'DO'});401STATES.UK.push({label: 'Durham', value: 'DU'});402STATES.UK.push({label: 'Essex', value: 'ES'});403STATES.UK.push({label: 'Gloucestershire', value: 'GL'});404STATES.UK.push({label: 'Greater London', value: 'GL'});405STATES.UK.push({label: 'Greater Manchester', value: 'GM'});406STATES.UK.push({label: 'Hampshire', value: 'HA'});407STATES.UK.push({label: 'Hereford & Worcestershire', value: 'HE'});408STATES.UK.push({label: 'Hertfordshire', value: 'HE'});409STATES.UK.push({label: 'Humberside', value: 'HU'});410STATES.UK.push({label: 'Isle of Man', value: 'IO'});411STATES.UK.push({label: 'Isle of Wight', value: 'IO'});412STATES.UK.push({label: 'Kent', value: 'KE'});413STATES.UK.push({label: 'Lancashire', value: 'LA'});414STATES.UK.push({label: 'Leicestershire', value: 'LE'});415STATES.UK.push({label: 'Lincolnshire', value: 'LI'});416STATES.UK.push({label: 'Merseyside', value: 'ME'});417STATES.UK.push({label: 'Norfolk', value: 'NO'});418STATES.UK.push({label: 'Northamptonshire', value: 'NH'});419STATES.UK.push({label: 'Northumberland', value: 'NT'});420STATES.UK.push({label: 'Nottinghamshire', value: 'NO'});421STATES.UK.push({label: 'Oxfordshire', value: 'OX'});422STATES.UK.push({label: 'Shropshire', value: 'SH'});423STATES.UK.push({label: 'Somerset', value: 'SO'});424STATES.UK.push({label: 'Staffordshire', value: 'ST'});425STATES.UK.push({label: 'Suffolk', value: 'SU'});426STATES.UK.push({label: 'Surrey', value: 'SU'});427STATES.UK.push({label: 'Sussex', value: 'SU'});428STATES.UK.push({label: 'Warwickshire', value: 'WA'});429STATES.UK.push({label: 'West Midlands', value: 'WM'});430STATES.UK.push({label: 'Wiltshire', value: 'WI'});431STATES.UK.push({label: 'Yorkshire', value: 'YO'});432STATES.EI.push({label: 'County Antrim', value: 'CO'});433STATES.EI.push({label: 'County Armagh', value: 'CO'});434STATES.EI.push({label: 'County Down', value: 'CO'});435STATES.EI.push({label: 'County Fermanagh', value: 'CO'});436STATES.EI.push({label: 'County Londonderry', value: 'CO'});437STATES.EI.push({label: 'County Tyrone', value: 'CO'});438STATES.EI.push({label: 'County Cavan', value: 'CO'});439STATES.EI.push({label: 'County Donegal', value: 'CO'});440STATES.EI.push({label: 'County Monaghan', value: 'CO'});441STATES.EI.push({label: 'County Dublin', value: 'CO'});442STATES.EI.push({label: 'County Carlow', value: 'CO'});443STATES.EI.push({label: 'County Kildare', value: 'CO'});444STATES.EI.push({label: 'County Kilkenny', value: 'CO'});445STATES.EI.push({label: 'County Laois', value: 'CO'});446STATES.EI.push({label: 'County Longford', value: 'CO'});447STATES.EI.push({label: 'County Louth', value: 'CO'});448STATES.EI.push({label: 'County Meath', value: 'CO'});449STATES.EI.push({label: 'County Offaly', value: 'CO'});450STATES.EI.push({label: 'County Westmeath', value: 'CO'});451STATES.EI.push({label: 'County Wexford', value: 'CO'});452STATES.EI.push({label: 'County Wicklow', value: 'CO'});453STATES.EI.push({label: 'County Galway', value: 'CO'});454STATES.EI.push({label: 'County Mayo', value: 'CO'});455STATES.EI.push({label: 'County Leitrim', value: 'CO'});456STATES.EI.push({label: 'County Roscommon', value: 'CO'});457STATES.EI.push({label: 'County Sligo', value: 'CO'});458STATES.EI.push({label: 'County Clare', value: 'CO'});459STATES.EI.push({label: 'County Cork', value: 'CO'});460STATES.EI.push({label: 'County Kerry', value: 'CO'});461STATES.EI.push({label: 'County Limerick', value: 'CO'});462STATES.EI.push({label: 'County Tipperary', value: 'CO'});...
pokeNet.js
Source:pokeNet.js
...56 PokeNet.prototype.featurizeState = function(gameState, mySID){57 //TODO: Featurize58 var phi = [];59 // Constant for bias60 //phi.push(1);61 //getting opponent highest dmg move62 var oppPoke= gameState.sides[1-mySID].pokemon;63 var oppMoves = gameState.sides[1-mySID].active[0].moves;64 var maxDmg = 0;65 for(var i=0; i<4; i++) {66 var damage = 0;67 if(oppMoves.length>i){68 var attacker = gameState.sides[1-mySID].active[0];69 var defender = gameState.sides[mySID].active[0];70 var damage = gameState.getDamage(attacker, defender, oppMoves[i], null);71 }72 if(damage>maxDmg){73 maxDmg = damage;74 }75 }76 phi.push(maxDmg);77 //getting our highest dmg move78 var poke= gameState.sides[mySID].pokemon;79 var moves = gameState.sides[mySID].active[0].moves;80 var maxDmgU = 0;81 for(var i=0; i<4; i++) {82 if(moves.length>i){83 var attacker = gameState.sides[mySID].active[0];84 var defender = gameState.sides[1-mySID].active[0];85 var damage = gameState.getDamage(attacker, defender, moves[i], null);86 if(damage>maxDmgU){87 maxDmgU = damage;88 }89 }90 }91 phi.push(maxDmgU)92 //types93 for(var i=0; i<18; i++){94 if(i==0 && gameState.sides[1-mySID].active[0].types.includes("Grass")){95 phi.push(1);96 }97 else if(i==1 && gameState.sides[1-mySID].active[0].types.includes("Water")){98 phi.push(1);99 }100 else if(i==2 && gameState.sides[1-mySID].active[0].types.includes("Fire")){101 phi.push(1);102 }103 else if(i==3 && gameState.sides[1-mySID].active[0].types.includes("Normal")){104 phi.push(1);105 }106 else if(i==4 && gameState.sides[1-mySID].active[0].types.includes("Fighting")){107 phi.push(1);108 }109 else if(i==5 && gameState.sides[1-mySID].active[0].types.includes("Flying")){110 phi.push(1);111 }112 else if(i==6 && gameState.sides[1-mySID].active[0].types.includes("Poison")){113 phi.push(1);114 }115 else if(i==7 && gameState.sides[1-mySID].active[0].types.includes("Electric")){116 phi.push(1);117 }118 else if(i==8 && gameState.sides[1-mySID].active[0].types.includes("Ground")){119 phi.push(1);120 }121 else if(i==9 && gameState.sides[1-mySID].active[0].types.includes("Psychic")){122 phi.push(1);123 }124 else if(i==10 && gameState.sides[1-mySID].active[0].types.includes("Rock")){125 phi.push(1);126 }127 else if(i==11 && gameState.sides[1-mySID].active[0].types.includes("Ice")){128 phi.push(1);129 }130 else if(i==12 && gameState.sides[1-mySID].active[0].types.includes("Bug")){131 phi.push(1);132 }133 else if(i==13 && gameState.sides[1-mySID].active[0].types.includes("Dragon")){134 phi.push(1);135 }136 else if(i==14 && gameState.sides[1-mySID].active[0].types.includes("Ghost")){137 phi.push(1);138 }139 else if(i==15 && gameState.sides[1-mySID].active[0].types.includes("Dark")){140 phi.push(1);141 }142 else if(i==16 && gameState.sides[1-mySID].active[0].types.includes("Steel")){143 phi.push(1);144 }145 else if(i==17 && gameState.sides[1-mySID].active[0].types.includes("Fairy")){146 phi.push(1);147 }148 else{149 phi.push(0);150 }151 }152 for(var i=0; i<18; i++){153 if(i==0 && gameState.sides[mySID].active[0].types.includes("Grass")){154 phi.push(1);155 }156 else if(i==1 && gameState.sides[mySID].active[0].types.includes("Water")){157 phi.push(1);158 }159 else if(i==2 && gameState.sides[mySID].active[0].types.includes("Fire")){160 phi.push(1);161 }162 else if(i==3 && gameState.sides[mySID].active[0].types.includes("Normal")){163 phi.push(1);164 }165 else if(i==4 && gameState.sides[mySID].active[0].types.includes("Fighting")){166 phi.push(1);167 }168 else if(i==5 && gameState.sides[mySID].active[0].types.includes("Flying")){169 phi.push(1);170 }171 else if(i==6 && gameState.sides[mySID].active[0].types.includes("Poison")){172 phi.push(1);173 }174 else if(i==7 && gameState.sides[mySID].active[0].types.includes("Electric")){175 phi.push(1);176 }177 else if(i==8 && gameState.sides[mySID].active[0].types.includes("Ground")){178 phi.push(1);179 }180 else if(i==9 && gameState.sides[mySID].active[0].types.includes("Psychic")){181 phi.push(1);182 }183 else if(i==10 && gameState.sides[mySID].active[0].types.includes("Rock")){184 phi.push(1);185 }186 else if(i==11 && gameState.sides[mySID].active[0].types.includes("Ice")){187 phi.push(1);188 }189 else if(i==12 && gameState.sides[mySID].active[0].types.includes("Bug")){190 phi.push(1);191 }192 else if(i==13 && gameState.sides[mySID].active[0].types.includes("Dragon")){193 phi.push(1);194 }195 else if(i==14 && gameState.sides[mySID].active[0].types.includes("Ghost")){196 phi.push(1);197 }198 else if(i==15 && gameState.sides[mySID].active[0].types.includes("Dark")){199 phi.push(1);200 }201 else if(i==16 && gameState.sides[mySID].active[0].types.includes("Steel")){202 phi.push(1);203 }204 else if(i==17 && gameState.sides[mySID].active[0].types.includes("Fairy")){205 phi.push(1);206 }207 else{208 phi.push(0);209 }210 }211 var ourActive = gameState.sides[mySID].active[0];212 var oppActive = gameState.sides[1-mySID].active[0];213 //stats214 //Opponent Boosts215 phi.push(oppActive.hp/oppActive.maxhp);216 if(oppActive != null){217 var oppBoost = oppActive.boosts;218 phi.push(boostStat(oppActive.baseStats.atk,"atk",oppBoost['atk'])/200);219 phi.push(boostStat(oppActive.baseStats.def,"def",oppBoost['def'])/200);220 phi.push(boostStat(oppActive.baseStats.spa,"spa",oppBoost['spa'])/200);221 phi.push(boostStat(oppActive.baseStats.spd,"spd",oppBoost['spd'])/200);222 phi.push(boostStat(oppActive.baseStats.spe,"spe",oppBoost['spe'])/200);223 }224 else{225 phi.push(oppActive.baseStats.atk/200);226 phi.push(oppActive.baseStats.def/200);227 phi.push(oppActive.baseStats.spa/200);228 phi.push(oppActive.baseStats.spd/200);229 phi.push(oppActive.baseStats.spe/200);230 }231 //Adds six stats per loop232 for(var i=0; i<6; i++){233 if(i < oppPoke.length){234 if(oppPoke[i].species!=oppActive.species) {235 phi.push(oppPoke[i].hp/oppPoke[i].maxhp);236 phi.push(oppPoke[i].baseStats.atk/200);237 phi.push(oppPoke[i].baseStats.def/200);238 phi.push(oppPoke[i].baseStats.spa/200);239 phi.push(oppPoke[i].baseStats.spd/200);240 phi.push(oppPoke[i].baseStats.spe/200);241 }242 }243 else{244 for(var j=0; j<6; j++) {245 phi.push(1);246 }247 }248 }249 //ourBoosts250 phi.push(ourActive.hp/ourActive.maxhp);251 if(ourActive != null){252 var ourBoost = oppActive.boosts;253 phi.push(boostStat(ourActive.baseStats.atk,"atk",ourBoost['atk'])/200);254 phi.push(boostStat(ourActive.baseStats.def,"def",ourBoost['def'])/200);255 phi.push(boostStat(ourActive.baseStats.spa,"spa",ourBoost['spa'])/200);256 phi.push(boostStat(ourActive.baseStats.spd,"spd",ourBoost['spd'])/200);257 phi.push(boostStat(ourActive.baseStats.spe,"spe",ourBoost['spe'])/200);258 }259 else{260 phi.push(ourActive.baseStats.atk/200);261 phi.push(ourActive.baseStats.def/200);262 phi.push(ourActive.baseStats.spa/200);263 phi.push(ourActive.baseStats.spd/200);264 phi.push(ourActive.baseStats.spe/200);265 }266 for(var i=0; i<poke.length; i++){267 if(poke[i].species!=ourActive.species){268 phi.push(poke[i].hp/poke[i].maxhp);269 phi.push(poke[i].baseStats.atk/200);270 phi.push(poke[i].baseStats.def/200);271 phi.push(poke[i].baseStats.spa/200);272 phi.push(poke[i].baseStats.spd/200);273 phi.push(poke[i].baseStats.spe/200);274 }275 }276// volatiles 8277 if(ourActive.volatiles['encore']){278 phi.push(1);279 } else {280 phi.push(0);281 }282 if(ourActive.volatiles['substitute']){283 phi.push(1);284 } else {285 phi.push(0);286 }287 if(ourActive.volatiles['taunt']){288 phi.push(1);289 } else {290 phi.push(0);291 }292 if(ourActive.volatiles['leechseed']){293 phi.push(1);294 } else {295 phi.push(0);296 }297 if(oppActive.volatiles['encore']){298 phi.push(1);299 } else {300 phi.push(0);301 }302 if(oppActive.volatiles['substitute']){303 phi.push(1);304 } else {305 phi.push(0);306 }307 if(oppActive.volatiles['taunt']){308 phi.push(1);309 } else {310 phi.push(0);311 }312 if(oppActive.volatiles['leechseed']){313 phi.push(1);314 } else {315 phi.push(0);316 }317// Entry Hazards 2318 if(gameState.sides[mySID].sideConditions) {319 if(gameState.sides[mySID].sideConditions['stealthrock']){320 phi.push(1);321 } else{322 phi.push(0);323 }324 if(gameState.sides[mySID].sideConditions['stickyweb']){325 phi.push(1);326 } else{327 phi.push(0);328 }329 if(gameState.sides[mySID].sideConditions['spikes']){330 phi.push(1);331 } else{332 phi.push(0);333 }334 if(gameState.sides[mySID].sideConditions['toxicspikes']){335 phi.push(1);336 } else{337 phi.push(0);338 }339 }340 if(gameState.sides[1-mySID].sideConditions) {341 if(gameState.sides[1-mySID].sideConditions['stealthrock']){342 phi.push(1);343 } else{344 phi.push(0);345 }346 if(gameState.sides[1-mySID].sideConditions['stickyweb']){347 phi.push(1);348 } else{349 phi.push(0);350 }351 if(gameState.sides[1-mySID].sideConditions['spikes']){352 phi.push(1);353 } else{354 phi.push(0);355 }356 if(gameState.sides[1-mySID].sideConditions['toxicspikes']){357 phi.push(1);358 } else{359 phi.push(0);360 }361 }362//status363 if(oppActive.status == 'psn'){364 phi.push(1);365 }366 else{367 phi.push(0);368 }369 if(oppActive.status == 'tox'){370 phi.push(1);371 }372 else{373 phi.push(0);374 }375 if(oppActive.status == 'brn'){376 phi.push(1);377 }378 else{379 phi.push(0);380 }381 if(oppActive.status == 'par'){382 phi.push(1);383 }384 else{385 phi.push(0);386 }387 if(oppActive.status == 'slp'){388 phi.push(1);389 }390 else{391 phi.push(0);392 }393 phi.push(0)394 for(var i=0; i<6; i++){395 if(oppPoke.length>i) {396 if(oppPoke[i].species != oppActive.species){397 if(oppPoke[i].status == 'psn'){398 phi.push(1);399 }400 else{401 phi.push(0);402 }403 if(oppPoke[i].status == 'tox'){404 phi.push(1);405 }406 else{407 phi.push(0);408 }409 if(oppPoke[i].status == 'brn'){410 phi.push(1);411 }412 else{413 phi.push(0);414 }415 if(oppPoke[i].status == 'par'){416 phi.push(1);417 }418 else{419 phi.push(0);420 }421 if(oppPoke[i].status == 'slp'){422 phi.push(1);423 }424 else{425 phi.push(0);426 }427 phi.push(0);428 }429 }430 else{431 for(var j=0; j<6; j++){432 if(j!=5){433 phi.push(0);434 }435 else{436 phi.push(1);437 }438 }439 }440 }441 if(ourActive.status == 'psn'){442 phi.push(1);443 }444 else{445 phi.push(0);446 }447 if(ourActive.status == 'tox'){448 phi.push(1);449 }450 else{451 phi.push(0);452 }453 if(ourActive.status == 'brn'){454 phi.push(1);455 }456 else{457 phi.push(0);458 }459 if(ourActive.status == 'par'){460 phi.push(1);461 }462 else{463 phi.push(0);464 }465 if(ourActive.status == 'slp'){466 phi.push(1);467 }468 else{469 phi.push(0);470 }471 for(var i=0; i<6; i++){472 if(poke[i].species != ourActive.species){473 if(poke[i].status == 'psn'){474 phi.push(1);475 }476 else{477 phi.push(0);478 }479 if(poke[i].status == 'tox'){480 phi.push(1);481 }482 else{483 phi.push(0);484 }485 if(poke[i].status == 'brn'){486 phi.push(1);487 }488 else{489 phi.push(0);490 }491 if(poke[i].status == 'par'){492 phi.push(1);493 }494 else{495 phi.push(0);496 }497 if(poke[i].status == 'slp'){498 phi.push(1);499 }500 else{501 phi.push(0);502 }503 }504 }505 //If pokemon are fainted506 for(var i=0; i<6; i++){507 if(oppPoke.length>i){508 if(oppPoke[i].fainted == true){509 phi.push(1);510 }511 else {512 phi.push(0);513 }514 }515 else{516 phi.push(0);517 }518 }519 for(var i=0; i<6; i++){520 if(poke[i].fainted == true){521 phi.push(1);522 }523 else {524 phi.push(0);525 }526 }527 return phi;528 };529 PokeNet.prototype.learn = function(stateArray, mySID, learningRate){530 var rewardArray = this.rewardTD(stateArray, mySID);531 for(var i = 0; i < stateArray.length; i++){532 //console.log(this.net);533 var vecta = this.featurizeState(stateArray[i], mySID)534 if(!isNaN(this.net.activate(vecta))){535 this.net.propagate(learningRate, [rewardArray[i]]);536 }537 }538 };539 PokeNet.prototype.reward = function(stateArray, mySID){540 //TODO: Reward function from gameState array541 // TD Learning: val[i] = r + gamma val[i+1]542 // Baby gets bonus for doing fat damage543 var rewardArray = [];544 var gamma = .95;545 // Reward for kills ONLY546 // Punish for deaths Only547 for(var i = 0; i < stateArray.length; i++){548 var liveMons = 6;549 var enemyMons = 6;550 for(var Poke in stateArray[i].sides[mySID].pokemon){551 if(stateArray[i].sides[mySID].pokemon[Poke].hp <= 0){552 liveMons -= 1;553 }554 }555 for(var Poke in stateArray[i].sides[1-mySID].pokemon){556 if(stateArray[i].sides[1-mySID].pokemon[Poke].hp <= 0){557 enemyMons -= 1;558 }559 }560 var val = (liveMons - enemyMons)/(liveMons + enemyMons);561 val = (val + 1)/2;562 rewardArray.push(val);563 }564 console.log(rewardArray);565 return rewardArray;566 }567 PokeNet.prototype.rewardTD = function(stateArray, mySID){568 var rewardArray = [];569 var gamma = .95570 for(var i = 0; i < stateArray.length - 1; i++){571 rewardArray.push(.5 + gamma*(this.evaluate(stateArray[i+1], mySID) - .5))572 }573 var enemyMons = 0;574 for(var Poke in stateArray[i].sides[1-mySID].pokemon){575 if(stateArray[i].sides[1-mySID].pokemon[Poke].hp <= 0){576 enemyMons -= 1;577 }578 }579 if(enemyMons > 0) {580 rewardArray.push(0);581 } else {582 rewardArray.push(1);583 }584 return rewardArray;585 }586 PokeNet.prototype.evaluate = function(gameState, mySID){587 if(gameState == null) {588 console.log("GAMESTATE WAS NULL BREAKING NOW ===============");589 return 0;590 }591 var vecta = this.featurizeState(gameState, mySID);592 for(var i=0; i<vecta.length; i++){593 if(vecta[i]==null || typeof vecta[i] === 'undefined' || isNaN(vecta[i])){594 console.log("FEATURE VECTOR MACHINE BROKE ===========")595 return 0;596 }597 }598 return this.net.activate(vecta);599 }600/* class PokeNet {601 constructor(netPath) {602 if(!netPath){603 this.file = 'pokeNet.json'604 } else {605 this.file = netPath;606 }607 fs.readFile(this.file, function(err, data){608 if(err) {609 console.log('neural net does not exist, creating...');610 this.net = new Synaptic.Architect.Perceptron(featureCount, 20, 1);611 //TODO: 20 is a magic number, pulled out me hat612 } else {613 this.net = Network.fromJSON(data);614 }615 })616 this.saveNet(this.file);617 }618 saveNet(path){619 fs.access(path, fs.constants.W_OK, function(err){620 var netStream = fs.createWriteStream(path, {'flags': 'w'});621 var exported = this.net.toJSON();622 netStream.write(exported);623 })624 }625 featurizeState(gameState, mySID){626 //TODO: Featurize627 var phi = [];628 for(var i = 0; i < featureCount; i++){629 phi.push(0);630 }631 }632 learn(stateArray, mySID, learningRate){633 for(var i = 0; i < stateArray.length; i++){634 console.log(this.net);635 this.net.activate(this.featurizeState(stateArray[i]));636 this.net.propagate(learningRate, this.reward(rewardArray[i]));637 }638 }639 reward(stateArray){640 //TODO: Reward function from gameState array641 return 0;642 }643 evaluate(gameState, mySID){...
index.spec.js
Source:index.spec.js
1/* globals require */2/*!3 * Module dependencies.4 */5var cordova = require('./helper/cordova'),6 PushNotification = require('../www/push'),7 execSpy,8 execWin,9 options;10/*!11 * Specification.12 */13describe('phonegap-plugin-push', function () {14 beforeEach(function () {15 options = {android: {}, ios: {}, windows: {}};16 execWin = jasmine.createSpy();17 execSpy = spyOn(cordova.required, 'cordova/exec').andCallFake(execWin);18 });19 describe('PushNotification', function () {20 it('should exist', function () {21 expect(PushNotification).toBeDefined();22 expect(typeof PushNotification === 'object').toBe(true);23 });24 it('should contain a init function', function () {25 expect(PushNotification.init).toBeDefined();26 expect(typeof PushNotification.init === 'function').toBe(true);27 });28 it('should contain a unregister function', function () {29 var push = PushNotification.init({});30 expect(push.unregister).toBeDefined();31 expect(typeof push.unregister === 'function').toBe(true);32 });33 it('should contain a getApplicationIconBadgeNumber function', function () {34 var push = PushNotification.init({});35 expect(push.getApplicationIconBadgeNumber).toBeDefined();36 expect(typeof push.getApplicationIconBadgeNumber === 'function').toBe(true);37 });38 it('should contain a setApplicationIconBadgeNumber function', function () {39 var push = PushNotification.init({});40 expect(push.setApplicationIconBadgeNumber).toBeDefined();41 expect(typeof push.setApplicationIconBadgeNumber === 'function').toBe(true);42 });43 it('should contain a clearAllNotifications function', function () {44 var push = PushNotification.init({});45 expect(push.clearAllNotifications).toBeDefined();46 expect(typeof push.clearAllNotifications === 'function').toBe(true);47 });48 it('should contain a subscribe function', function () {49 var push = PushNotification.init({});50 expect(push.subscribe).toBeDefined();51 expect(typeof push.subscribe === 'function').toBe(true);52 });53 it('should contain a unsubscribe function', function () {54 var push = PushNotification.init({});55 expect(push.unsubscribe).toBeDefined();56 expect(typeof push.unsubscribe === 'function').toBe(true);57 });58 });59 describe('PushNotification instance', function () {60 describe('cordova.exec', function () {61 it('should call cordova.exec on next process tick', function (done) {62 PushNotification.init(options);63 setTimeout(function () {64 expect(execSpy).toHaveBeenCalledWith(65 jasmine.any(Function),66 jasmine.any(Function),67 'PushNotification',68 'init',69 jasmine.any(Object)70 );71 done();72 }, 100);73 });74 });75 describe('on "registration" event', function () {76 it('should be emitted with an argument', function (done) {77 execSpy.andCallFake(function (win, fail, service, id, args) {78 win({'registrationId': 1});79 });80 var push = PushNotification.init(options);81 push.on('registration', function (data) {82 expect(data.registrationId).toEqual(1);83 done();84 });85 });86 });87 describe('on "notification" event', function () {88 beforeEach(function () {89 execSpy.andCallFake(function (win, fail, service, id, args) {90 win({91 message: 'Message',92 title: 'Title',93 count: 1,94 sound: 'beep',95 image: 'Image',96 additionalData: {}97 });98 });99 });100 it('should be emitted on success', function (done) {101 var push = PushNotification.init(options);102 push.on('notification', function (data) {103 done();104 });105 });106 it('should provide the data.message argument', function (done) {107 var push = PushNotification.init(options);108 push.on('notification', function (data) {109 expect(data.message).toEqual('Message');110 done();111 });112 });113 it('should provide the data.title argument', function (done) {114 var push = PushNotification.init(options);115 push.on('notification', function (data) {116 expect(data.title).toEqual('Title');117 done();118 });119 });120 it('should provide the data.count argument', function (done) {121 var push = PushNotification.init(options);122 push.on('notification', function (data) {123 expect(data.count).toEqual(1);124 done();125 });126 });127 it('should provide the data.sound argument', function (done) {128 var push = PushNotification.init(options);129 push.on('notification', function (data) {130 expect(data.sound).toEqual('beep');131 done();132 });133 });134 it('should provide the data.image argument', function (done) {135 var push = PushNotification.init(options);136 push.on('notification', function (data) {137 expect(data.image).toEqual('Image');138 done();139 });140 });141 it('should provide the data.additionalData argument', function (done) {142 var push = PushNotification.init(options);143 push.on('notification', function (data) {144 expect(data.additionalData).toEqual({});145 done();146 });147 });148 });149 describe('on "error" event', function () {150 it('should be emitted with an Error', function (done) {151 execSpy.andCallFake(function (win, fail, service, id, args) {152 fail('something went wrong');153 });154 var push = PushNotification.init(options);155 push.on('error', function (e) {156 expect(e).toEqual(jasmine.any(Error));157 expect(e.message).toEqual('something went wrong');158 done();159 });160 });161 });162 describe('off "notification" event', function () {163 it('should exist and be registered a callback handle', function (done) {164 var push = PushNotification.init(options),165 eventHandler = function () {166 };167 push.on('notification', eventHandler);168 push.off('notification', eventHandler);169 expect(push._handlers.notification.indexOf(eventHandler)).toEqual(-1);170 done();171 });172 });173 describe('off "registration" event', function () {174 it('should exist and be registered a callback handle', function (done) {175 var push = PushNotification.init(options),176 eventHandler = function () {177 };178 push.on('registration', eventHandler);179 push.off('registration', eventHandler);180 expect(push._handlers.registration.indexOf(eventHandler)).toEqual(-1);181 done();182 });183 });184 describe('off "error" event', function () {185 it('should exist and be registered a callback handle', function (done) {186 var push = PushNotification.init(options),187 eventHandler = function () {188 };189 push.on('error', eventHandler);190 push.off('error', eventHandler);191 expect(push._handlers.error.indexOf(eventHandler)).toEqual(-1);192 done();193 });194 });195 describe('unregister method', function () {196 it('should clear "registration" event handlers', function (done) {197 var push = PushNotification.init(options),198 eventHandler = function () {199 };200 expect(push._handlers.registration.length).toEqual(0);201 push.on('registration',eventHandler);202 expect(push._handlers.registration.length).toEqual(1);203 expect(push._handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);204 execSpy.andCallFake(function (win, fail, service, id, args) {205 win();206 });207 push.unregister(function() {208 expect(push._handlers.registration.length).toEqual(0);209 expect(push._handlers.registration.indexOf(eventHandler)).toEqual(-1);210 done();211 });212 });213 it('should clear "notification" event handlers', function (done) {214 var push = PushNotification.init(options),215 eventHandler = function () {216 };217 expect(push._handlers.notification.length).toEqual(0);218 push.on('notification', eventHandler);219 expect(push._handlers.notification.length).toEqual(1);220 expect(push._handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);221 execSpy.andCallFake(function (win, fail, service, id, args) {222 win();223 });224 push.unregister(function() {225 expect(push._handlers.notification.length).toEqual(0);226 expect(push._handlers.notification.indexOf(eventHandler)).toEqual(-1);227 done();228 });229 });230 it('should clear "error" event handlers', function (done) {231 var push = PushNotification.init(options),232 eventHandler = function () {233 };234 expect(push._handlers.error.length).toEqual(0);235 push.on('error', eventHandler);236 expect(push._handlers.error.length).toEqual(1);237 expect(push._handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);238 execSpy.andCallFake(function (win, fail, service, id, args) {239 win();240 });241 push.unregister(function() {242 expect(push._handlers.error.length).toEqual(0);243 expect(push._handlers.error.indexOf(eventHandler)).toEqual(-1);244 done();245 });246 });247 });248 describe('unregister topics method', function () {249 it('should not clear "registration" event handlers', function (done) {250 var push = PushNotification.init(options),251 eventHandler = function () {252 };253 expect(push._handlers.registration.length).toEqual(0);254 push.on('registration',eventHandler);255 expect(push._handlers.registration.length).toEqual(1);256 expect(push._handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);257 execSpy.andCallFake(function (win, fail, service, id, args) {258 win();259 });260 push.unregister(function() {261 expect(push._handlers.registration.length).toEqual(1);262 expect(push._handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);263 done();264 }, null, ['foo', 'bar']);265 });266 it('should not clear "notification" event handlers', function (done) {267 var push = PushNotification.init(options),268 eventHandler = function () {269 };270 expect(push._handlers.notification.length).toEqual(0);271 push.on('notification', eventHandler);272 expect(push._handlers.notification.length).toEqual(1);273 expect(push._handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);274 execSpy.andCallFake(function (win, fail, service, id, args) {275 win();276 });277 push.unregister(function() {278 expect(push._handlers.notification.length).toEqual(1);279 expect(push._handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);280 done();281 }, null, ['foo', 'bar']);282 });283 it('should not clear "error" event handlers', function (done) {284 var push = PushNotification.init(options),285 eventHandler = function () {286 };287 expect(push._handlers.error.length).toEqual(0);288 push.on('error', eventHandler);289 expect(push._handlers.error.length).toEqual(1);290 expect(push._handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);291 execSpy.andCallFake(function (win, fail, service, id, args) {292 win();293 });294 push.unregister(function() {295 expect(push._handlers.error.length).toEqual(1);296 expect(push._handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);297 done();298 }, null, ['foo', 'bar']);299 });300 });301 describe('subscribe topic method', function () {302 describe('cordova.exec', function () {303 it('should call cordova.exec on next process tick', function (done) {304 var push = PushNotification.init(options);305 push.subscribe('foo', function() {}, function() {});306 setTimeout(function () {307 expect(execSpy).toHaveBeenCalledWith(308 jasmine.any(Function),309 jasmine.any(Function),310 'PushNotification',311 'subscribe',312 jasmine.any(Object)313 );314 done();315 }, 100);316 });317 });318 });319 describe('unsubscribe topic method', function () {320 describe('cordova.exec', function () {321 it('should call cordova.exec on next process tick', function (done) {322 var push = PushNotification.init(options);323 push.unsubscribe('foo', function() {}, function() {});324 setTimeout(function () {325 expect(execSpy).toHaveBeenCalledWith(326 jasmine.any(Function),327 jasmine.any(Function),328 'PushNotification',329 'unsubscribe',330 jasmine.any(Object)331 );332 done();333 }, 100);334 });335 });336 });337 });...
ClickInfo_FusionTable.js
Source:ClickInfo_FusionTable.js
2 3 var Properties_Comu = [];4 switch (Cod_Regi) {5 case "CMD1":6 Properties_Comu.push(" Capitão Felizardo");7 Properties_Comu.push("Cana, milho, feijão, mandioca, café");8 Properties_Comu.push("Possui");9 Properties_Comu.push("Banana, laranja, carambola, acerola, manga, uva, limão, goiaba");10 Properties_Comu.push("Queijo, doces, cachaça, farinha de mandioca, fubá de milho");11 Properties_Comu.push("Galinha (ovos), suÃnos, gado (para atividade leiteira))");12 break;13 14 case "CMD2":15 Properties_Comu.push(" Costa Sena e Goiabeiras");16 Properties_Comu.push("Cana, milho, feijão, mandioca, café");17 Properties_Comu.push("Possui");18 Properties_Comu.push("Banana, laranja, acerola, manga, limão, abacate e goiaba");19 Properties_Comu.push("Queijo, requeijão, polvilho, farinha de mandioca");20 Properties_Comu.push("Galinha (ovos), suÃnos e gado (para atividade leiteira)");21 break;22 case "CMD3":23 Properties_Comu.push(" Tapera e Santo Antônio do Cruzeiro");24 Properties_Comu.push("Milho, mandioca, amendoim, inhame e café ");25 Properties_Comu.push("Possui");26 Properties_Comu.push("Banana, laranja, manga");27 Properties_Comu.push("Quitandas (biscoito de polvilho, biscoito de amendoim, rosquinhas e pão de goiabada), doces (de laranja, limão, goiaba), geleias de frutas");28 Properties_Comu.push("Galinha (ovos)");29 break;30 case "CMD4":31 Properties_Comu.push(" Ouro Fino e Córregos");32 Properties_Comu.push("Milho, mandioca, feijão, café");33 Properties_Comu.push("Possui");34 Properties_Comu.push("Banana, laranja, carambola, acerola, caqui, goiaba");35 Properties_Comu.push("Queijo, requeijão, quitandas, doce de leite");36 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira), suÃnos e peixes");37 break;38 case "CMD5":39 Properties_Comu.push(" Ãgua Quente e Sapo");40 Properties_Comu.push("Cana, milho, feijão, mandioca, café");41 Properties_Comu.push("Não são mais cultivadas devido à falta dâágua, com exceção da comunidade de Passa Sete");42 Properties_Comu.push("Frutas não desenvolvem mais em seus quintais");43 Properties_Comu.push("Queijo (somente para consumo), farinha de mandioca");44 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira)");45 break;46 case "CMD6":47 Properties_Comu.push(" Parauninha e Itacolomi");48 Properties_Comu.push("Mandioca, cana, milho, feijão");49 Properties_Comu.push("Possui");50 Properties_Comu.push("Banana, laranja, manga, uvaia, goiaba");51 Properties_Comu.push("Farinha de mandioca, cachaça, rapadura e doces");52 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira)");53 break;54 case "CMD7":55 Properties_Comu.push(" Tabuleiro");56 Properties_Comu.push("Mandioca, cana, milho, amendoim, feijão, inhame, café e batata doce");57 Properties_Comu.push("Possui");58 Properties_Comu.push("Banana, laranja, manga, jabuticaba, goiaba");59 Properties_Comu.push("Farinha de mandioca, cachaça e rapadura");60 Properties_Comu.push("Galinha (ovos), suÃnos e abelhas");61 break;62 case "CMD8":63 Properties_Comu.push("Três Barras, Buraco e Cubas");64 Properties_Comu.push("Feijão, milho, mandioca, cana e café");65 Properties_Comu.push("Possui");66 Properties_Comu.push("Banana, laranja, manga, mamão, mexerica, limão, goiaba");67 Properties_Comu.push(" queijo, fubá, mel, farinha de mandioca");68 Properties_Comu.push("Galinha (ovos), gado (para a atividade leiteira), abelhas e peixes");69 break;70 case "CMD9":71 Properties_Comu.push(" Brejaúba e Socorro");72 Properties_Comu.push("Milho, mandioca, feijão, amendoim e café");73 Properties_Comu.push("Possui");74 Properties_Comu.push("Banana, laranja, manga, jabuticaba, mexerica, goiaba");75 Properties_Comu.push("Queijo, requeijão, muçarela, quitandas, fubá de milho, rapadura");76 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira), suÃnos, abelhas");77 break;78 case "AM1":79 Properties_Comu.push(" Lapinha e Ribeirão Santana");80 Properties_Comu.push("Cana, milho, feijão, mandioca e café");81 Properties_Comu.push("Possui");82 Properties_Comu.push("Banana, laranja, acerola, manga, mexerica, mamão, goiaba");83 Properties_Comu.push("Queijo (certificado), doces, geleias, quitandas, farinha de mandioca e rala de queijo");84 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira), suÃnos, peixes");85 break;86 case "AM2":87 Properties_Comu.push(" Fazenda da Ponte");88 Properties_Comu.push("Milho, cana, feijão, inhame e mandioca");89 Properties_Comu.push("Possui");90 Properties_Comu.push("Banana, laranja, acerola, manga, mamão, limão e goiaba");91 Properties_Comu.push("Queijo (certificado), cachaça e farinha de mandioca");92 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira), suÃnos");93 break;94 case "AM3":95 Properties_Comu.push(" Descoberto e Bom Jesus");96 Properties_Comu.push("Milho, feijão, mandioca, café");97 Properties_Comu.push("Possui");98 Properties_Comu.push("Banana, laranja e acerola");99 Properties_Comu.push("Farinha de mandioca");100 Properties_Comu.push("Galinha (ovos), gado, suÃnos e peixes");101 break;102 case "AM4":103 Properties_Comu.push(" Morro dos Monteiros");104 Properties_Comu.push("Milho, feijão, mandioca e café");105 Properties_Comu.push("Possui");106 Properties_Comu.push("Banana");107 Properties_Comu.push("Farinha de mandioca");108 Properties_Comu.push("Galinha (ovos), peixe");109 break;110 case "AM5":111 Properties_Comu.push(" Ribeirão de Trás");112 Properties_Comu.push("Milho, cana, feijão, mandioca, arroz, inhame, café");113 Properties_Comu.push("Possui");114 Properties_Comu.push("Banana, laranja, acerola, mamão, mexerica e goiaba");115 Properties_Comu.push("Queijo, farinha de mandioca, doces, geleias, rapadura e melado");116 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira), suÃnos");117 break;118 case "DJ1":119 Properties_Comu.push(" Cachoeira");120 Properties_Comu.push("Milho, cana, feijão, arroz, café,mandioca");121 Properties_Comu.push("Possui");122 Properties_Comu.push("Banana, laranja, acerola, mamão, abacate, mexerica e goiaba");123 Properties_Comu.push("Queijo, rapadura e melado");124 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira), suÃnos");125 break;126 case "DJ2":127 Properties_Comu.push(" Machados");128 Properties_Comu.push("Milho, cana, feijão, cafe");129 Properties_Comu.push("Possui");130 Properties_Comu.push("Banana, laranja, carambola, mexerica e abacaxi");131 Properties_Comu.push("Quitandas, doces e requeijão");132 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira), suÃnos");133 break;134 case "DJ3":135 Properties_Comu.push(" São José da Ilha");136 Properties_Comu.push("Milho, cana, feijão e mandioca");137 Properties_Comu.push("Possui");138 Properties_Comu.push("Mamão, manga, goiaba, laranja e mexerica");139 Properties_Comu.push("Quitandas, doce de leite, doces de frutas (cidra, mamão, manga e goiaba) e cachaça");140 Properties_Comu.push(" galinha (ovos), gado (para atividade leiteira), suÃnos");141 break;142 case "DJ4":143 Properties_Comu.push(" Sesmaria e Serra");144 Properties_Comu.push("Milho, cana, feijão, mandioca, café");145 Properties_Comu.push("Possui");146 Properties_Comu.push("Banana, laranja, acerola, manga, amora, graviola e goiaba");147 Properties_Comu.push("Queijo, requeijão, muçarela, provolone, iogurte, doce de leite, quitandas, doces e geleias de frutas diversas");148 Properties_Comu.push("Galinha (ovos), gado (para atividade leiteira), suÃnos, abelhas");149 break;150 case "DJ5":151 Properties_Comu.push(" São João");152 Properties_Comu.push("Milho, cana, feijão, café e mandioca");153 Properties_Comu.push("Possui");154 Properties_Comu.push("Banana, laranja, pera, goiaba e araçá");155 Properties_Comu.push("Mel, própolis e cachaça");156 Properties_Comu.push("Galinha, ovos e abelhas");157 break;158 }159 160 return Properties_Comu;161}162 ...
cylinder.js
Source:cylinder.js
...48 var currentHeight = heightHalf - h*heightLength49 for (var i=0; i <= radialSegments; i++) {50 var x = Math.sin(i * radialAngle);51 var z = Math.cos(i * radialAngle);52 normals.push(currentRadius * x);53 normals.push(normalY); //todo54 normals.push(currentRadius * z);55 uvs.push(1 - (i*radialLength));56 uvs.push(0 + h*1/heightSegments);57 positions.push(currentRadius * x);58 positions.push(currentHeight);59 positions.push(currentRadius * z);60 }61 }62 // create faces63 for (var h = 0; h < heightSegments; h++) {64 for (var i=0; i <= radialSegments; i++) {65 var first = h * (radialSegments + 1) + i;66 var second = first + radialSegments;67 indices.push(first);68 indices.push(second);69 indices.push(second + 1);70 indices.push(first);71 indices.push(second + 1);72 indices.push(first + 1);73 }74 }75 // create top cap76 if (!openEnded && radiusTop > 0) {77 var startIndex = (positions.length/3);78 // top center79 normals.push(0.0);80 normals.push(1.0);81 normals.push(0.0);82 uvs.push(0.5);83 uvs.push(0.5);84 positions.push(0);85 positions.push(heightHalf);86 positions.push(0);87 // top triangle fan88 for (var i=0; i <= radialSegments; i++) {89 var x = Math.sin(i * radialAngle);90 var z = Math.cos(i * radialAngle);91 var tu = (0.5 * Math.sin(i * radialAngle)) + 0.5;92 var tv = (0.5 * Math.cos(i * radialAngle)) + 0.5;93 normals.push(radiusTop * x);94 normals.push(1.0);95 normals.push(radiusTop * z);96 uvs.push(tu);97 uvs.push(tv);98 positions.push(radiusTop * x);99 positions.push(heightHalf);100 positions.push(radiusTop * z);101 }102 for (var i=0; i < radialSegments; i++) {103 var center = startIndex;104 var first = startIndex + 1 + i;105 indices.push(first);106 indices.push(first + 1);107 indices.push(center);108 }109 }110 // create bottom cap111 if (!openEnded && radiusBottom > 0) {112 var startIndex = (positions.length/3);113 // top center114 normals.push(0.0);115 normals.push(-1.0);116 normals.push(0.0);117 uvs.push(0.5);118 uvs.push(0.5);119 positions.push(0);120 positions.push(0-heightHalf);121 positions.push(0);122 // top triangle fan123 for (var i=0; i <= radialSegments; i++) {124 var x = Math.sin(i * radialAngle);125 var z = Math.cos(i * radialAngle);126 var tu = (0.5 * Math.sin(i * radialAngle)) + 0.5;127 var tv = (0.5 * Math.cos(i * radialAngle)) + 0.5;128 normals.push(radiusBottom * x);129 normals.push(-1.0);130 normals.push(radiusBottom * z);131 uvs.push(tu);132 uvs.push(tv);133 positions.push(radiusBottom * x);134 positions.push(0-heightHalf);135 positions.push(radiusBottom * z);136 }137 for (var i=0; i < radialSegments; i++) {138 var center = startIndex;139 var first = startIndex + 1 + i;140 indices.push(first);141 indices.push(first + 1);142 indices.push(center);143 }144 }145 return {146 type: "geometry",147 primitive:params.wire ? "lines" : "triangles",148 coreId : "cylinder_" + (params.wire ? "wire" : "solid") + "_" + (params.openEnded ? "open" : "closed") + "_"149 + radiusTop + "_" + radiusBottom + "_" + radialSegments + "_"150 + height + "_" + heightSegments,151 positions : new Float32Array(positions),152 normals: new Float32Array(normals),153 uv : new Float32Array(uvs),154 indices : new Uint16Array(indices)155 };156 }...
push_notifications.js
Source:push_notifications.js
1var push = null;2function push_notifications_register() {3 // Initializes the plugin.4 push = PushNotification.init(drupalgap.settings.push_notifications);5 // Set up the registration, notification and error handlers.6 push.on('registration', function(data) {7 push_notifications_register_device_token(data.registrationId);8 });9 // Handle the receipt of a notification.10 push.on('notification', function(data) {11 module_invoke_all('push_notifications_receive', data);12 });13 push.on('error', function(e) { drupalgap_alert(e.message); });14}15/**16 * Implements hook_services_postprocess().17 */18function push_notifications_services_postprocess(options, result) {19 try {20 if (drupalgap.settings.mode != 'phonegap') { return; }21 // When a user is connected and is allowed to register a token, do it.22 var pushNotEnabled = variable_get('app_settings_enable_push_notifications', 1);23 if (options.service == 'system' && options.resource == 'connect' && user_access('register device token') && pushNotEnabled == 1) {24 push_notifications_register();25 }26 }27 catch (error) {28 console.log('push_notifications_services_postprocess - ' + error);29 }30}31/**32 * Implements hook_services_preprocess().33 */34function push_notifications_services_preprocess(options, result) {35 try {36 if (drupalgap.settings.mode != 'phonegap') { return; }37 // When a user logs out and is allowed to delete a token, do it.38 if (options.service == 'user' && options.resource == 'logout' && user_access('remove device token')) {39 push_notifications_delete_device_token();40 }41 }42 catch (error) {43 console.log('push_notifications_services_preprocess - ' + error);44 }45}46function push_notifications_register_device_token(token) {47 var push_token = localStorage.getItem('push_notifications_token');48 if (push_token === null || push_token != token) {49 var data = {50 'token': token,51 'type': push_notifications_platform_token(device.platform)52 };53 // give other modules a chance to react to registering a push notification54 module_invoke_all('push_notifications_register');55 push_notifications_create(data, {56 success: function(result) {57 if (result['success'] == 1) {58 localStorage.setItem("push_notifications_token", token);59 }60 }61 });62 }63}64function push_notifications_delete_device_token() {65 var push_token = localStorage.getItem('push_notifications_token');66 if (push_token != null) {67 push_notifications_delete(push_token, {68 success: function(result) {69 if (result['success'] == 1) {70 localStorage.removeItem("push_notifications_token");71 }72 }73 });74 }75}76function push_notifications_create(data, options) {77 try {78 options.method = 'POST';79 options.path = 'push_notifications';80 options.service = 'push_notifications';81 options.resource = 'push_notifications';82 options.data = JSON.stringify(data);83 Drupal.services.call(options);84 }85 catch (error) {86 console.log('push_notifications_create - ' + data);87 }88}89function push_notifications_delete(token, options) {90 try {91 options.method = 'DELETE';92 options.path = 'push_notifications/' + token;93 options.service = 'push_notifications';94 options.resource = 'push_notifications';95 Drupal.services.call(options);96 }97 catch (error) {98 console.log('push_notifications_delete - ' + token);99 }100}101function push_notifications_platform_token(platform) {102 var token;103 switch (platform) {104 case "iOS":105 token = 'ios';106 break;107 case "Android":108 token = 'android';109 break;110 default:111 token = null;112 break;113 }114 return token;...
dsharpplus-embedbuilder.js
Source:dsharpplus-embedbuilder.js
...4 generateFrom(data) {5 const footerStyleCompact = false;6 const authorStyleCompact = false;7 const result = [];8 const push = e => result.push(e);9 // TODO: could use @"" to avoid escaping.10 const s = e => JSON.stringify(e);11 if (data.content) {12 push(`await new ModernEmbedBuilder`);13 } else {14 push(`new ModernEmbedBuilder`);15 }16 push(`{`);17 if (data.content) {18 push(` Content = (${s(data.content)}),`);19 }20 const e = data.embed;21 if (!e) {22 return `You forgot the, uh, 'embed' bit of the embed.`;23 }24 if (e.title) {25 push(` Title = ${s(e.title)},`);26 }27 if (e.description) {28 push(` Description = ${s(e.description)},`);29 }30 if (e.url) {31 push(` Url = ${s(e.url)},`);32 }33 if (e.color) { // use hex in case int is out of signed range34 push(` Color = 0x${e.color.toString(16).toUpperCase()},`);35 }36 if (e.timestamp) {37 //push(` Timestamp = ${Date.parse(e.timestamp)}UL`);38 push(` Timestamp = ${s(e.timestamp)},`);39 }40 if (e.footer) {41 if (!footerStyleCompact) {42 if (!e.footer.icon_url) {43 push(` Footer = ${s(e.footer.text)},`)44 } else {45 push(` Footer = (${s(e.footer.text)}, ${s(e.footer.icon_url)}),`)46 }47 } else {48 if (e.footer.text ) push(` FooterText = ${s(e.footer.text )},`);49 if (e.footer.icon_url) push(` FooterIcon = ${s(e.footer.icon_url)},`);50 }51 }52 if (e.thumbnail) {53 if (e.thumbnail.url) {54 push(` ThumbnailUrl = ${s(e.thumbnail.url)},`);55 } else {56 push(` // warning: bad thumbnail <${s(e.thumbnail)}>`);57 }58 }59 if (e.image) {60 if (e.image.url) {61 push(` ImageUrl = ${s(e.image.url)},`);62 } else {63 push(` // warning: bad image <${s(e.image)}>`);64 }65 }66 if (e.author) {67 if (!authorStyleCompact) {68 if (!e.author.url && !e.author.icon_url) {69 push(` Author = ${s(e.author.name)},`);70 } else {71 const author = [];72 if (e.author.name) {73 author.push(e.author.name);74 }75 if (e.author.url) {76 author.push(e.author.url);77 }78 if (e.author.icon_url) {79 author.push(e.author.icon_url);80 }81 push(` Author = (${author.map(e => `${s(e)}`).join(', ')}),`);82 }83 } else {84 if (e.author.name) {85 push(` AuthorName = ${s(e.author.name)},`);86 }87 if (e.author.url) {88 push(` AuthorUrl = ${s(e.author.url)},`);89 }90 if (e.author.icon_url) {91 push(` AuthorIcon = ${s(e.author.icon_url)},`);92 }93 }94 }95 if (e.fields && e.fields.length) {96 /*97 * 98 Fields =99 {100 "Field with just name",101 ("ay Name", "ay Value"),102 ("ay Name", "ay Value", inline: true),103 */104 push(` Fields = `);105 push(` {`);106 e.fields.forEach(e => {107 if (!e.value && !e.inline) {108 push(` ${s(e.name)}`)109 } else {110 const field = [];111 if (e.name) field.push(s(e.name));112 if (e.value) field.push(s(e.value));113 if (e.inline) field.push('inline: true');114 push(` (${field.join(', ')})`);115 }116 });117 push(` }`);118 }119 if (data.content) {120 push(`}.Send(message);`);121 } else {122 push(`};`);123 }124 return result.join('\n');125 }...
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) {4 console.error(err);5 } else {6 console.log(data);7 }8});9at Function.Module._resolveFilename (module.js:338:15)10at Function.Module._load (module.js:280:25)11at Module.require (module.js:364:17)12at require (module.js:380:17)13at Object. (/home/developer/test.js:2:16)14at Module._compile (module.js:456:26)15at Object.Module._extensions..js (module.js:474:10)16at Module.load (module.js:356:32)17at Function.Module._load (module.js:312:12)18at Function.Module.runMain (module.js:497:10)19at Function.Module._resolveFilename (module.js:338:15)20at Function.Module._load (module.js:280:25)21at Module.require (module.js:364:17)22at require (module.js:380:17)23at Object. (/home/developer/test.js:2:16)24at Module._compile (module.js:456:26)25at Object.Module._extensions..js (module.js:474:10)26at Module.load (module.js:356:32)27at Function.Module._load (module.js:312:12)28at Function.Module.runMain (module.js:497:10)29at Function.Module._resolveFilename (module.js:338:15)30at Function.Module._load (module.js:280:25)31at Module.require (module.js:364:17)32at require (module.js:380:17)33at Object. (/home/developer/test.js:
Using AI Code Generation
1var wpt = require('webpagetest');2var test = wpt('www.webpagetest.org');3test.runTest(url, function(err, data) {4 if (err) {5 console.log('Error: ' + err);6 } else {7 console.log(data);8 }9});
Using AI Code Generation
1var wpt = require('./wpt');2var wpt = new wpt('www.webpagetest.org');3 if (err) {4 console.log('Error: ' + err);5 } else {6 console.log('Test ID: ' + data.data.testId);7 console.log('Owner Key: ' + data.data.ownerKey);8 }9});10var request = require('request');11var WPT = function(server) {12 this.server = server;13};14WPT.prototype.runTest = function(url, callback) {15 var options = {
Using AI Code Generation
1var wptools = require('wptools');2var page = wptools.page('Barack Obama');3page.push('Barack Obama', function(err, resp){4 console.log(resp);5});6var wptools = require('wptools');7var page = wptools.page('Barack Obama');8page.pull('Barack Obama', function(err, resp){9 console.log(resp);10});11var wptools = require('wptools');12var page = wptools.page('Barack Obama');13page.pushpull('Barack Obama', function(err, resp){14 console.log(resp);15});16var wptools = require('wptools');17var page = wptools.page('Barack Obama');18page.pushpull('Barack Obama', function(err, resp){19 console.log(resp);20});21var wptools = require('wptools');22var page = wptools.page('Barack Obama');23page.get('Barack Obama', function(err, resp){24 console.log(resp);25});26var wptools = require('wptools');27var page = wptools.page('Barack Obama');28page.get('Barack Obama', function(err, resp){29 console.log(resp);30});31var wptools = require('wptools');32var page = wptools.page('Barack Obama');33page.get('Barack Obama', function(err, resp){34 console.log(resp);35});36var wptools = require('wptools');37var page = wptools.page('Barack Obama');38page.get('Barack Obama', function(err, resp){39 console.log(resp);40});41var wptools = require('wptools');42var page = wptools.page('Barack Obama');43page.get('Barack Obama', function(err, resp){44 console.log(resp);45});46var wptools = require('wptools');47var page = wptools.page('Barack Obama');
Using AI Code Generation
1var wptools = require('wptools');2var wiki = wptools.page('Barack Obama');3wiki.get(function(err, data){4 console.log(data);5});6{7 "dependencies": {8 }9}10{11 "dependencies": {12 "wptools": {13 "requires": {14 }15 }16 }17}
Using AI Code Generation
1function sendRequest()2{3var url = document.getElementById('url').value;4var wpt = new WebPageTest('www.webpagetest.org');5wpt.runTest(url, function(err, data) {6if (err) throw err;7console.log(data);8});9}10function getResults()11{12var url = document.getElementById('url').value;13var wpt = new WebPageTest('www.webpagetest.org');14wpt.runTest(url, function(err, data) {15if (err) throw err;16wpt.getTestResults(data.data.testId, function(err, data) {17if (err) throw err;18console.log(data);19});20});21}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!