2 var mainNav = $('ul.main-navigation, ul[role=main-navigation]').before('<fieldset class="mobile-nav">')
3 var mobileNav = $('fieldset.mobile-nav').append('<select>');
4 mobileNav.find('select').append('<option value="">Navigate…</option>');
5 var addOption = function(i, option) {
6 mobileNav.find('select').append('<option value="' + this.href + '">» ' + $(this).text() + '</option>');
8 mainNav.find('a').each(addOption);
9 $('ul.subscription a').each(addOption);
10 mobileNav.find('select').bind('change', function(event) {
11 if (event.target.value) { window.location.href = event.target.value; }
15 function addSidebarToggler() {
16 if(!$('body').hasClass('sidebar-footer')) {
17 $('#content').append('<span class="toggle-sidebar"></span>');
18 $('.toggle-sidebar').bind('click', function(e) {
20 $('body').toggleClass('collapse-sidebar');
23 var sections = $('aside.sidebar > section');
24 if (sections.length > 1) {
25 sections.each(function(index, section){
26 if ((sections.length >= 3) && index % 3 === 0) {
27 $(section).addClass("first");
29 var count = ((index +1) % 2) ? "odd" : "even";
30 $(section).addClass(count);
33 if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
36 function testFeatures() {
37 var features = ['maskImage'];
38 $(features).map(function(i, feature) {
39 if (Modernizr.testAllProps(feature)) {
40 $('html').addClass(feature);
42 $('html').addClass('no-'+feature);
45 if ("placeholder" in document.createElement("input")) {
46 $('html').addClass('placeholder');
48 $('html').addClass('no-placeholder');
53 $('document').ready(function() {
59 // iOS scaling bug fix
61 // By @mathias, @cheeaun and @jdalton
62 // Source url: https://gist.github.com/901295
64 var addEvent = 'addEventListener',
65 type = 'gesturestart',
66 qsa = 'querySelectorAll',
68 meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
70 meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
71 doc.removeEventListener(type, fix, true);
73 if ((meta = meta[meta.length - 1]) && addEvent in doc) {
76 doc[addEvent](type, fix, true);