Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*jslint white:false plusplus:false browser:true nomen:false */
- /*globals $, nav, log, lang, window */
- var UPP = {
- // class methods
- code_submit: function() {
- $('.error').hide();
- return nav.formjax($(this), UPP.register, log.error);
- },
- email_submit: function() {
- $('.error').hide();
- return nav.formjax($(this), UPP.thank_you, log.error);
- },
- vip_submit: function() {
- $('.error').hide();
- return nav.formjax($(this), UPP.thank_you_vip, log.error);
- },
- thank_you: function(response) {
- if (response.rc === 0) {
- $('.popper').hide();
- $('#thank_you').show();
- }
- else {
- $('.error').html(lang(response.error)).show();
- }
- },
- thank_you_vip: function(response) {
- if (response.rc === 0) {
- $('.grad').hide();
- $('#thank_you_vip').show();
- }
- else {
- $('.error').html(lang(response.error)).show();
- }
- },
- register: function(response) {
- if (response.rc === 0) {
- $('#popup').hide();
- $('#register').show();
- $('#vip_code').val(response.code);
- }
- else {
- $('.error').html(lang(response.error)).show();
- }
- },
- band_color: function() {
- var color = $(this).attr('href');
- $('.band_color').removeClass('selected');
- $(color).addClass('selected');
- $('#band_color').val(color.substring(1));
- return false;
- },
- colors: function(request) {
- return [
- { 'label' : "<span class='band_color white'></span> White", 'value' : 'White' },
- { 'label' : "<span class='band_color gray'></span> Gray", 'value': 'Gray' },
- { 'label' : "<span class='band_color blue'></span> Blue", 'value' : 'Blue' },
- { 'label' : "<span class='band_color red'></span> Red", 'value' : 'Red' }
- ];
- },
- colors2: function(request) {
- return [
- { 'label' : "<span class='band_color white'></span> White", 'value' : 'White' },
- { 'label' : "<span class='band_color gray'></span> Gray", 'value': 'Gray' },
- { 'label' : "<span class='band_color blue'></span> Blue", 'value' : 'Blue' },
- { 'label' : "<span class='band_color red'></span> Red", 'value' : 'Red' },
- { 'label' : "I'll wait for my first choice", 'value' : 'Wait' },
- { 'label' : "I'll take whatever I can get", 'value' : 'Whatever' }
- ];
- },
- countries: function(request) {
- var matcher, countries = [
- "United States",
- "United Kingdom",
- "Germany",
- "Cananda",
- "---",
- "Abkhazia",
- "Afghanistan",
- "Akrotiri and Dhekelia",
- "Aland",
- "Albania",
- "Algeria",
- "American Samoa",
- "Andorra",
- "Angola",
- "Anguilla",
- "Antigua and Barbuda",
- "Argentina",
- "Armenia",
- "Aruba",
- "Ascension Island",
- "Australia",
- "Austria",
- "Azerbaijan",
- "Bahamas, The",
- "Bahrain",
- "Bangladesh",
- "Barbados",
- "Belarus",
- "Belgium",
- "Belize",
- "Benin",
- "Bermuda",
- "Bhutan",
- "Bolivia",
- "Bosnia and Herzegovina",
- "Botswana",
- "Brazil",
- "Brunei",
- "Bulgaria",
- "Burkina Faso",
- "Burundi",
- "Cambodia",
- "Cameroon",
- "Canada",
- "Cape Verde",
- "Cayman Islands",
- "Central Africa Republic",
- "Chad",
- "Chile",
- "China",
- "Christmas Island",
- "Cocos (Keeling) Islands",
- "Colombia",
- "Comoros",
- "Congo",
- "Cook Islands",
- "Costa Rica",
- "Cote d'lvoire",
- "Croatia",
- "Cuba",
- "Cyprus",
- "Czech Republic",
- "Denmark",
- "Djibouti",
- "Dominica",
- "Dominican Republic",
- "East Timor Ecuador",
- "Egypt",
- "El Salvador",
- "Equatorial Guinea",
- "Eritrea",
- "Estonia",
- "Ethiopia",
- "Falkland Islands",
- "Faroe Islands",
- "Fiji",
- "Finland",
- "France",
- "French Polynesia",
- "Gabon",
- "Gambia, The",
- "Georgia",
- "Germany",
- "Ghana",
- "Gibraltar",
- "Greece",
- "Greenland",
- "Grenada",
- "Guam",
- "Guatemala",
- "Guemsey",
- "Guinea",
- "Guinea-Bissau",
- "Guyana",
- "Haiti",
- "Honduras",
- "Hong Kong",
- "Hungary",
- "Iceland",
- "India",
- "Indonesia",
- "Iran",
- "Iraq",
- "Ireland",
- "Isle of Man",
- "Israel",
- "Italy",
- "Jamaica",
- "Japan",
- "Jersey",
- "Jordan",
- "Kazakhstan",
- "Kenya",
- "Kiribati",
- "Korea, North",
- "Korea, South",
- "Kosovo",
- "Kuwait",
- "Kyrgyzstan",
- "Laos",
- "Latvia",
- "Lebanon",
- "Lesotho",
- "Liberia",
- "Libya",
- "Liechtenstein",
- "Lithuania",
- "Luxembourg",
- "Macao",
- "Macedonia",
- "Madagascar",
- "Malawi",
- "Malaysia",
- "Maldives",
- "Mali",
- "Malta",
- "Marshall Islands",
- "Mauritania",
- "Mauritius",
- "Mayotte",
- "Mexico",
- "Micronesia",
- "Moldova",
- "Monaco",
- "Mongolia",
- "Montenegro",
- "Montserrat",
- "Morocco",
- "Mozambique",
- "Myanmar",
- "Nagorno-Karabakh",
- "Namibia",
- "Nauru",
- "Nepal",
- "Netherlands",
- "Netherlands Antilles",
- "New Caledonia",
- "New Zealand",
- "Nicaragua",
- "Niger",
- "Nigeria",
- "Niue",
- "Norfolk Island",
- "Northern Cyprus",
- "Northern Mariana Islands",
- "Norway",
- "Oman",
- "Pakistan",
- "Palau",
- "Palestine",
- "Panama",
- "Papua New Guinea",
- "Paraguay",
- "Peru",
- "Philippines",
- "Pitcairn Islands",
- "Poland",
- "Portugal",
- "Puerto Rico",
- "Qatar",
- "Romania",
- "Russia",
- "Rwanda",
- "Sahrawi Arab Democratic Republic",
- "Saint-Barthelemy",
- "Saint Helena",
- "Saint Kitts and Nevis",
- "Saint Lucia",
- "Saint Martin",
- "Saint Pierre and Miquelon",
- "Saint Vincent and Grenadines",
- "Samos",
- "San Marino",
- "Sao Tome and Principe",
- "Saudi Arabia",
- "Senegal",
- "Serbia",
- "Seychelles",
- "Sierra Leone",
- "Singapore",
- "Slovakia",
- "Slovenia",
- "Solomon Islands",
- "Somalia",
- "Somaliland",
- "South Africa",
- "South Ossetia",
- "Spain",
- "Sri Lanka",
- "Sudan",
- "Suriname",
- "Svalbard",
- "Swaziland",
- "Sweden",
- "Switzerland",
- "Syria",
- "Tajikistan",
- "Tanzania",
- "Thailand",
- "Togo",
- "Tokelau",
- "Tonga",
- "Transnistria",
- "Trinidad and Tobago",
- "Tristan da Cunha",
- "Tunisia",
- "Turkey",
- "Turkmenistan",
- "Turks and Caicos Islands",
- "Tuvalu",
- "Uganda",
- "Ukraine",
- "United Arab Emirates",
- "United Kingdom",
- "United States",
- "Uruguay",
- "Uzbekistan",
- "Vanuatu",
- "Vatican City",
- "Venezuela",
- "Vietnam",
- "Virgin Islands, British",
- "Virgin Islands, U.S.",
- "Wallis and Futuna",
- "Yemen",
- "Zambia",
- "Zimbabwe"
- ];
- if (request.term === '---') {
- return countries;
- }
- matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
- return $.map(countries, function(n, i) {
- if ( matcher.test(n) ) {
- return n;
- }
- else {
- return null;
- }
- });
- },
- states: function(request) {
- var matcher, states = [
- "Alabama",
- "Alaska",
- "Arizona",
- "Arkansas",
- "California",
- "Colorado",
- "Connecticut",
- "Delaware",
- "Florida",
- "Georgia",
- "Hawaii",
- "Idaho",
- "Illinois",
- "Indiana",
- "Iowa",
- "Kansas",
- "Kentucky",
- "Louisiana",
- "Maine",
- "Maryland",
- "Massachusetts",
- "Michigan",
- "Minnesota",
- "Mississippi",
- "Missouri",
- "Montana",
- "Nebraska",
- "Nevada",
- "New Hampshire",
- "New Jersey",
- "New Mexico",
- "New York",
- "North Carolina",
- "North Dakota",
- "Ohio",
- "Oklahoma",
- "Oregon",
- "Pennsylvania",
- "Rhode Island",
- "South Carolina",
- "South Dakota",
- "Tennessee",
- "Texas",
- "Utah",
- "Vermont",
- "Virginia",
- "Washington",
- "West Virginia",
- "Wisconsin",
- "Wyoming",
- "*",
- "District of Columbia",
- "Puerto Rico",
- "Guam",
- "American Samoa",
- "U.S. Virgin Islands",
- "Northern Mariana Islands"
- ];
- if (request.term === "---") {
- return states;
- }
- matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
- return $.map(states, function(n, i) {
- if ( matcher.test(n) ) {
- return n;
- }
- else {
- return null;
- }
- });
- },
- combo: function(input, button, completion, classy) {
- input.autocomplete({
- 'delay':0,
- 'source':function( request, response ) {
- response(completion(request));
- }});
- input.autocomplete('widget').addClass(classy);
- button.bind('click', function() {
- if (input.autocomplete( "widget" ).is( ":visible" ) ) {
- input.autocomplete( "close" );
- return false;
- }
- // work around a bug (likely same cause as #5265)
- $( this ).blur();
- // pass empty string as value to search for, displaying all results
- input.autocomplete( "search", "---" );
- input.focus();
- return false;
- });
- }
- };
- $(document).ready(function() {
- $('#submit_code').bind('submit', UPP.code_submit);
- $('#submit_email').bind('submit', UPP.email_submit);
- $('#submit_vip').bind('submit', UPP.vip_submit);
- $('.band_color').bind('click', UPP.band_color);
- if (window.location.hash === '#vip') {
- $('#enter_passcode').fadeIn();
- }
- else {
- $('#stay_informed').fadeIn();
- }
- UPP.combo($("#country"),$('#country-picker'), UPP.countries, 'country-fill');
- UPP.combo($("#state"),$('#state-picker'), UPP.states, 'state-fill');
- UPP.combo($("#color"),$('#color-picker'), UPP.colors, 'color-fill');
- UPP.combo($("#color2"),$('#color2-picker'), UPP.colors2, 'color-fill');
- });
Add Comment
Please, Sign In to add comment