Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                  <body>
    <div class="grid-container">
      <!-- Top bar -->
      <div class="top-bar">
        <div class="top-bar-left">
          <div class="menu-text">WPA Supplicant Generator</div>
        </div>
        <div class="top-bar-right">
          <a href="#"><i class="fi-social-github"></i></a>
        </div>
      </div>
      <!-- Body of page -->
      <div class="grid-x grid-padding-x">
        <div class="cell small-4">
          <div class="card">
            <div class="card-divider">
              Config
            </div>
            <div class="card-section">
              <label >
                Country code:<br />
                <select data-bind="options: countryOptions, optionsText: 'text', optionsValue: 'value', value: chosenCountry"></select>
              </label>
              <label>
                Security Type:<br />
                <label>
                  <select data-bind="options: securityOptions, optionsText: 'text', optionsValue: 'value', value: chosenSecurity"></select>
                </label>
              </label>
              <!-- WPA/WPA2 -->
              <div data-bind="visible: chosenSecurityType() === 'wpa'">
                <label>
                  SSID (Network Name):<br />
                  <input type="text" data-bind="textInput: ssid" />
                </label>
                <label>
                  Password:<br />
                  <input type="text" data-bind="textInput: netPass">
                </label>
              </div>
              <!-- No Password (You live dangerously) -->
              <div data-bind="visible: chosenSecurityType() === 'open'">
                <label>
                  SSID (Network Name):<br />
                  <input type="text" data-bind="textInput: ssid" />
                </label>
              </div>
              <!-- Hidden SSID WPA/WPA2 -->
              <div data-bind="visible: chosenSecurityType() === 'hidden'">
                <label>
                  SSID (Network Name):<br />
                  <input type="text" data-bind="textInput: ssid" />
                </label>
              </div>
              <!-- Hidden SSID No Password -->
              <div data-bind="visible: chosenSecurityType() === 'hiddenPass'">
                <label>
                  SSID (Network Name):<br />
                  <input type="text" data-bind="textInput: ssid" />
                </label>
                <label>
                  Password:<br />
                  <input type="text" data-bind="textInput: netPass">
                </label>
              </div>
            </div>
          </div>
        </div>
        <div class="cell small-8">
          <label>
            File contents:
            <div contenteditable="true"  id="supplicantText" class="bordered">
              country=<span data-bind="text: chosenCountry"></span><br />
              update_config=1<br />
              ctrl_interface=/var/run/wpa_supplicant<br />
              <br />
              <div data-bind="visible: chosenSecurityType() === 'wpa'">
                network={<br />
                  ssid="<span data-bind="text: ssid"></span>"<br />
                  psk="<span data-bind="text: netPass"></span>"<br />
                  key_mgmt=WPA-PSK<br />
                }
              </div>
              <div data-bind="visible: chosenSecurityType() === 'open'">
                network={<br />
                  ssid="<span data-bind="text: ssid"></span>"<br />
                  key_mgmt=NONE<br />
                }
              </div>
              <div data-bind="visible: chosenSecurityType() === 'hidden'">
                network={<br />
                  ssid="<span data-bind="text: ssid"></span>"<br />
                  key_mgmt=NONE<br />
                  scan_ssid=1<br />
                }
              </div>
              <div data-bind="visible: chosenSecurityType() === 'hiddenPass'">
                network={<br />
                  ssid="<span data-bind="text: ssid"></span>"<br />
                  psk="<span data-bind="text: netPass"></span>"<br />
                  scan_ssid=1<br />
                }
              </div>
            </div>
          </label>
          
        </div>
        <div class="float-center">
          <a type="button" class="button" onclick="downloadInnerHtml('wpa_supplicant.conf', 'supplicantText', 'text/plain')">Download wpa_supplicant.conf</a>
          <a type="button" class="button" onclick="downloadInnerHtml('octopi-wpa-supplicant.txt', 'supplicantText', 'text/plain')">Download octoprint-wpa-supplicant.txt</a>
        </div>
      </div>
    </div>
              
            
!

CSS

              
                
              
            
!

JS

              
                      var viewModel = {
        countryOptions: [
          { text: 'Afghanistan', value: 'AF' },
          { text: 'Aland Islands', value: 'AX' },
          { text: 'Albania', value: 'AL' },
          { text: 'Algeria', value: 'DZ' },
          { text: 'American Samoa', value: 'AS' },
          { text: 'Andorra', value: 'AD' },
          { text: 'Angola', value: 'AO' },
          { text: 'Anguilla', value: 'AI' },
          { text: 'Antarctica', value: 'AQ' },
          { text: 'Antigua and Barbuda', value: 'AG' },
          { text: 'Argentina', value: 'AR' },
          { text: 'Armenia', value: 'AM' },
          { text: 'Aruba', value: 'AW' },
          { text: 'Australia', value: 'AU' },
          { text: 'Austria', value: 'AT' },
          { text: 'Azerbaijan', value: 'AZ' },
          { text: 'Bahamas', value: 'BS' },
          { text: 'Bahrain', value: 'BH' },
          { text: 'Bangladesh', value: 'BD' },
          { text: 'Barbados', value: 'BB' },
          { text: 'Belarus', value: 'BY' },
          { text: 'Belgium', value: 'BE' },
          { text: 'Belize', value: 'BZ' },
          { text: 'Benin', value: 'BJ' },
          { text: 'Bermuda', value: 'BM' },
          { text: 'Bhutan', value: 'BT' },
          { text: 'Bolivia', value: 'BO' },
          { text: 'Bosnia and Herzegovina', value: 'BA' },
          { text: 'Botswana', value: 'BW' },
          { text: 'Bouvet Island', value: 'BV' },
          { text: 'Brazil', value: 'BR' },
          { text: 'British Indian Ocean Territory', value: 'IO' },
          { text: 'British Virgin Islands', value: 'VG' },
          { text: 'Brunei Darussalam', value: 'BN' },
          { text: 'Bulgaria', value: 'BG' },
          { text: 'Burkina Faso', value: 'BF' },
          { text: 'Burundi', value: 'BI' },
          { text: 'Cambodia', value: 'KH' },
          { text: 'Cameroon', value: 'CM' },
          { text: 'Canada', value: 'CA' },
          { text: 'Cape Verde', value: 'CV' },
          { text: 'Cayman Islands', value: 'KY' },
          { text: 'Central African Republic', value: 'CF' },
          { text: 'Chad', value: 'TD' },
          { text: 'Chile', value: 'CL' },
          { text: 'China', value: 'CN' },
          { text: 'Christmas Island', value: 'CX' },
          { text: 'Cocos (Keeling) Islands', value: 'CC' },
          { text: 'Colombia', value: 'CO' },
          { text: 'Comoros', value: 'KM' },
          { text: 'Congo (Brazzaville)', value: 'CG' },
          { text: 'Congo, (Kinshasa)', value: 'CD' },
          { text: 'Cook Islands', value: 'CK' },
          { text: 'Costa Rica', value: 'CR' },
          { text: 'Cote d\'Ivoire', value: 'CI' },
          { text: 'Croatia', value: 'HR' },
          { text: 'Cuba', value: 'CU' },
          { text: 'Cyprus', value: 'CY' },
          { text: 'Czech Republic', value: 'CZ' },
          { text: 'Denmark', value: 'DK' },
          { text: 'Djibouti', value: 'DJ' },
          { text: 'Dominica', value: 'DM' },
          { text: 'Dominican Republic', value: 'DO' },
          { text: 'Ecuador', value: 'EC' },
          { text: 'Egypt', value: 'EG' },
          { text: 'El Salvador', value: 'SV' },
          { text: 'Equatorial Guinea', value: 'GQ' },
          { text: 'Eritrea', value: 'ER' },
          { text: 'Estonia', value: 'EE' },
          { text: 'Ethiopia', value: 'ET' },
          { text: 'Falkland Islands (Malvinas)', value: 'FK' },
          { text: 'Faroe Islands', value: 'FO' },
          { text: 'Fiji', value: 'FJ' },
          { text: 'Finland', value: 'FI' },
          { text: 'France', value: 'FR' },
          { text: 'French Guiana', value: 'GF' },
          { text: 'French Polynesia', value: 'PF' },
          { text: 'French Southern Territories', value: 'TF' },
          { text: 'Gabon', value: 'GA' },
          { text: 'Gambia', value: 'GM' },
          { text: 'Georgia', value: 'GE' },
          { text: 'Germany', value: 'DE' },
          { text: 'Ghana', value: 'GH' },
          { text: 'Gibraltar', value: 'GI' },
          { text: 'Greece', value: 'GR' },
          { text: 'Greenland', value: 'GL' },
          { text: 'Grenada', value: 'GD' },
          { text: 'Guadeloupe', value: 'GP' },
          { text: 'Guam', value: 'GU' },
          { text: 'Guatemala', value: 'GT' },
          { text: 'Guernsey', value: 'GG' },
          { text: 'Guinea', value: 'GN' },
          { text: 'Guinea-Bissau', value: 'GW' },
          { text: 'Guyana', value: 'GY' },
          { text: 'Haiti', value: 'HT' },
          { text: 'Heard and Mcdonald Islands', value: 'HM' },
          { text: 'Holy See (Vatican City State)', value: 'VA' },
          { text: 'Honduras', value: 'HN' },
          { text: 'Hong Kong, SAR China', value: 'HK' },
          { text: 'Hungary', value: 'HU' },
          { text: 'Iceland', value: 'IS' },
          { text: 'India', value: 'IN' },
          { text: 'Indonesia', value: 'ID' },
          { text: 'Iran, Islamic Republic of', value: 'IR' },
          { text: 'Iraq', value: 'IQ' },
          { text: 'Ireland', value: 'IE' },
          { text: 'Isle of Man', value: 'IM' },
          { text: 'Israel', value: 'IL' },
          { text: 'Italy', value: 'IT' },
          { text: 'Jamaica', value: 'JM' },
          { text: 'Japan', value: 'JP' },
          { text: 'Jersey', value: 'JE' },
          { text: 'Jordan', value: 'JO' },
          { text: 'Kazakhstan', value: 'KZ' },
          { text: 'Kenya', value: 'KE' },
          { text: 'Kiribati', value: 'KI' },
          { text: 'Korea (North)', value: 'KP' },
          { text: 'Korea (South)', value: 'KR' },
          { text: 'Kuwait', value: 'KW' },
          { text: 'Kyrgyzstan', value: 'KG' },
          { text: 'Lao PDR', value: 'LA' },
          { text: 'Latvia', value: 'LV' },
          { text: 'Lebanon', value: 'LB' },
          { text: 'Lesotho', value: 'LS' },
          { text: 'Liberia', value: 'LR' },
          { text: 'Libya', value: 'LY' },
          { text: 'Liechtenstein', value: 'LI' },
          { text: 'Lithuania', value: 'LT' },
          { text: 'Luxembourg', value: 'LU' },
          { text: 'Macao, SAR China', value: 'MO' },
          { text: 'Macedonia, Republic of', value: 'MK' },
          { text: 'Madagascar', value: 'MG' },
          { text: 'Malawi', value: 'MW' },
          { text: 'Malaysia', value: 'MY' },
          { text: 'Maldives', value: 'MV' },
          { text: 'Mali', value: 'ML' },
          { text: 'Malta', value: 'MT' },
          { text: 'Marshall Islands', value: 'MH' },
          { text: 'Martinique', value: 'MQ' },
          { text: 'Mauritania', value: 'MR' },
          { text: 'Mauritius', value: 'MU' },
          { text: 'Mayotte', value: 'YT' },
          { text: 'Mexico', value: 'MX' },
          { text: 'Micronesia, Federated States of', value: 'FM' },
          { text: 'Moldova', value: 'MD' },
          { text: 'Monaco', value: 'MC' },
          { text: 'Mongolia', value: 'MN' },
          { text: 'Montenegro', value: 'ME' },
          { text: 'Montserrat', value: 'MS' },
          { text: 'Morocco', value: 'MA' },
          { text: 'Mozambique', value: 'MZ' },
          { text: 'Myanmar', value: 'MM' },
          { text: 'Namibia', value: 'NA' },
          { text: 'Nauru', value: 'NR' },
          { text: 'Nepal', value: 'NP' },
          { text: 'Netherlands', value: 'NL' },
          { text: 'Netherlands Antilles', value: 'AN' },
          { text: 'New Caledonia', value: 'NC' },
          { text: 'New Zealand', value: 'NZ' },
          { text: 'Nicaragua', value: 'NI' },
          { text: 'Niger', value: 'NE' },
          { text: 'Nigeria', value: 'NG' },
          { text: 'Niue', value: 'NU' },
          { text: 'Norfolk Island', value: 'NF' },
          { text: 'Northern Mariana Islands', value: 'MP' },
          { text: 'Norway', value: 'NO' },
          { text: 'Oman', value: 'OM' },
          { text: 'Pakistan', value: 'PK' },
          { text: 'Palau', value: 'PW' },
          { text: 'Palestinian Territory', value: 'PS' },
          { text: 'Panama', value: 'PA' },
          { text: 'Papua New Guinea', value: 'PG' },
          { text: 'Paraguay', value: 'PY' },
          { text: 'Peru', value: 'PE' },
          { text: 'Philippines', value: 'PH' },
          { text: 'Pitcairn', value: 'PN' },
          { text: 'Poland', value: 'PL' },
          { text: 'Portugal', value: 'PT' },
          { text: 'Puerto Rico', value: 'PR' },
          { text: 'Qatar', value: 'QA' },
          { text: 'Réunion', value: 'RE' },
          { text: 'Romania', value: 'RO' },
          { text: 'Russian Federation', value: 'RU' },
          { text: 'Rwanda', value: 'RW' },
          { text: 'Saint Helena', value: 'SH' },
          { text: 'Saint Kitts and Nevis', value: 'KN' },
          { text: 'Saint Lucia', value: 'LC' },
          { text: 'Saint Pierre and Miquelon', value: 'PM' },
          { text: 'Saint Vincent and Grenadines', value: 'VC' },
          { text: 'Saint-Barthélemy', value: 'BL' },
          { text: 'Saint-Martin (French part)', value: 'MF' },
          { text: 'Samoa', value: 'WS' },
          { text: 'San Marino', value: 'SM' },
          { text: 'Sao Tome and Principe', value: 'ST' },
          { text: 'Saudi Arabia', value: 'SA' },
          { text: 'Senegal', value: 'SN' },
          { text: 'Serbia', value: 'RS' },
          { text: 'Seychelles', value: 'SC' },
          { text: 'Sierra Leone', value: 'SL' },
          { text: 'Singapore', value: 'SG' },
          { text: 'Slovakia', value: 'SK' },
          { text: 'Slovenia', value: 'SI' },
          { text: 'Solomon Islands', value: 'SB' },
          { text: 'Somalia', value: 'SO' },
          { text: 'South Africa', value: 'ZA' },
          { text: 'South Georgia and the South Sandwich Islands', value: 'GS' },
          { text: 'South Sudan', value: 'SS' },
          { text: 'Spain', value: 'ES' },
          { text: 'Sri Lanka', value: 'LK' },
          { text: 'Sudan', value: 'SD' },
          { text: 'Suriname', value: 'SR' },
          { text: 'Svalbard and Jan Mayen Islands', value: 'SJ' },
          { text: 'Swaziland', value: 'SZ' },
          { text: 'Sweden', value: 'SE' },
          { text: 'Switzerland', value: 'CH' },
          { text: 'Syrian Arab Republic (Syria)', value: 'SY' },
          { text: 'Taiwan, Republic of China', value: 'TW' },
          { text: 'Tajikistan', value: 'TJ' },
          { text: 'Tanzania, United Republic of', value: 'TZ' },
          { text: 'Thailand', value: 'TH' },
          { text: 'Timor-Leste', value: 'TL' },
          { text: 'Togo', value: 'TG' },
          { text: 'Tokelau', value: 'TK' },
          { text: 'Tonga', value: 'TO' },
          { text: 'Trinidad and Tobago', value: 'TT' },
          { text: 'Tunisia', value: 'TN' },
          { text: 'Turkey', value: 'TR' },
          { text: 'Turkmenistan', value: 'TM' },
          { text: 'Turks and Caicos Islands', value: 'TC' },
          { text: 'Tuvalu', value: 'TV' },
          { text: 'Uganda', value: 'UG' },
          { text: 'Ukraine', value: 'UA' },
          { text: 'United Arab Emirates', value: 'AE' },
          { text: 'United Kingdom', value: 'GB' },
          { text: 'United States of America', value: 'US' },
          { text: 'Uruguay', value: 'UY' },
          { text: 'US Minor Outlying Islands', value: 'UM' },
          { text: 'Uzbekistan', value: 'UZ' },
          { text: 'Vanuatu', value: 'VU' },
          { text: 'Venezuela (Bolivarian Republic)', value: 'VE' },
          { text: 'Viet Nam', value: 'VN' },
          { text: 'Virgin Islands, US', value: 'VI' },
          { text: 'Wallis and Futuna Islands', value: 'WF' },
          { text: 'Western Sahara', value: 'EH' },
          { text: 'Yemen', value: 'YE' },
          { text: 'Zambia', value: 'ZM' },
          { text: 'Zimbabwe', value: 'ZW' }         
        ],
        chosenCountry: ko.observable("US"),
        securityOptions: [
          {text: 'WPA/WPA2', value: 'wpa'},
          {text: 'Open Network (No password)', value: 'open'},
          {text: 'Hidden SSID WPA/WPA2', value: 'hiddenPass'},
          {text: 'Hidden SSID (No password)', value: 'hidden'}
        ],
        chosenSecurity: ko.observable("wpa"),
        ssid: ko.observable(""),
        netPass: ko.observable(""),
        country: ko.observable("US"),
      };

      viewModel.chosenSecurityType = ko.computed(function () {
        var code = viewModel.chosenSecurity();
        for (var i = 0; i < viewModel.securityOptions.length; ++i) {
          var item = viewModel.securityOptions[i];
          if (item.value === code) return item.value;
        }
      });

      viewModel.chosenCountryCode = ko.computed(function () {
        var code = viewModel.chosenCountry();
        for (var i = 0; i < viewModel.countryOptions.length; ++i) {
          var item = viewModel.countryOptions[i];
          if (item.value === code) return item.value;
        }
      });

      ko.applyBindings(viewModel);

      // Download files
      function downloadInnerHtml(filename, elId, mimeType) {
        var elHtml = document.getElementById(elId).innerText;
        if (navigator.msSaveBlob) { // IE 10+
          navigator.msSaveBlob(new Blob([elHtml], { type: mimeType + ';charset=utf-8;' }), filename);
        } else {
          var link = document.createElement('a');
          mimeType = mimeType || 'text/plain';
          link.setAttribute('download', filename);
          link.setAttribute('href', 'data:' + mimeType  +  ';charset=utf-8,' + encodeURIComponent(elHtml));
          link.click();
        }
      }
              
            
!
999px

Console