]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/js/common.js
WordPress 3.9-scripts
[autoinstalls/wordpress.git] / wp-admin / js / common.js
1 /* global setUserSetting, ajaxurl, commonL10n, alert, confirm, pagenow */
2 var showNotice, adminMenu, columns, validateForm, screenMeta;
3 ( function( $, window, undefined ) {
4 // Removed in 3.3.
5 // (perhaps) needed for back-compat
6 adminMenu = {
7         init : function() {},
8         fold : function() {},
9         restoreMenuState : function() {},
10         toggle : function() {},
11         favorites : function() {}
12 };
13
14 // show/hide/save table columns
15 columns = {
16         init : function() {
17                 var that = this;
18                 $('.hide-column-tog', '#adv-settings').click( function() {
19                         var $t = $(this), column = $t.val();
20                         if ( $t.prop('checked') )
21                                 that.checked(column);
22                         else
23                                 that.unchecked(column);
24
25                         columns.saveManageColumnsState();
26                 });
27         },
28
29         saveManageColumnsState : function() {
30                 var hidden = this.hidden();
31                 $.post(ajaxurl, {
32                         action: 'hidden-columns',
33                         hidden: hidden,
34                         screenoptionnonce: $('#screenoptionnonce').val(),
35                         page: pagenow
36                 });
37         },
38
39         checked : function(column) {
40                 $('.column-' + column).show();
41                 this.colSpanChange(+1);
42         },
43
44         unchecked : function(column) {
45                 $('.column-' + column).hide();
46                 this.colSpanChange(-1);
47         },
48
49         hidden : function() {
50                 return $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
51         },
52
53         useCheckboxesForHidden : function() {
54                 this.hidden = function(){
55                         return $('.hide-column-tog').not(':checked').map(function() {
56                                 var id = this.id;
57                                 return id.substring( id, id.length - 5 );
58                         }).get().join(',');
59                 };
60         },
61
62         colSpanChange : function(diff) {
63                 var $t = $('table').find('.colspanchange'), n;
64                 if ( !$t.length )
65                         return;
66                 n = parseInt( $t.attr('colspan'), 10 ) + diff;
67                 $t.attr('colspan', n.toString());
68         }
69 };
70
71 $(document).ready(function(){columns.init();});
72
73 validateForm = function( form ) {
74         return !$( form )
75                 .find( '.form-required' )
76                 .filter( function() { return $( 'input:visible', this ).val() === ''; } )
77                 .addClass( 'form-invalid' )
78                 .find( 'input:visible' )
79                 .change( function() { $( this ).closest( '.form-invalid' ).removeClass( 'form-invalid' ); } )
80                 .size();
81 };
82
83 // stub for doing better warnings
84 showNotice = {
85         warn : function() {
86                 var msg = commonL10n.warnDelete || '';
87                 if ( confirm(msg) ) {
88                         return true;
89                 }
90
91                 return false;
92         },
93
94         note : function(text) {
95                 alert(text);
96         }
97 };
98
99 screenMeta = {
100         element: null, // #screen-meta
101         toggles: null, // .screen-meta-toggle
102         page:    null, // #wpcontent
103
104         init: function() {
105                 this.element = $('#screen-meta');
106                 this.toggles = $('.screen-meta-toggle a');
107                 this.page    = $('#wpcontent');
108
109                 this.toggles.click( this.toggleEvent );
110         },
111
112         toggleEvent: function( e ) {
113                 var panel = $( this.href.replace(/.+#/, '#') );
114                 e.preventDefault();
115
116                 if ( !panel.length )
117                         return;
118
119                 if ( panel.is(':visible') )
120                         screenMeta.close( panel, $(this) );
121                 else
122                         screenMeta.open( panel, $(this) );
123         },
124
125         open: function( panel, link ) {
126
127                 $('.screen-meta-toggle').not( link.parent() ).css('visibility', 'hidden');
128
129                 panel.parent().show();
130                 panel.slideDown( 'fast', function() {
131                         panel.focus();
132                         link.addClass('screen-meta-active').attr('aria-expanded', true);
133                 });
134         },
135
136         close: function( panel, link ) {
137                 panel.slideUp( 'fast', function() {
138                         link.removeClass('screen-meta-active').attr('aria-expanded', false);
139                         $('.screen-meta-toggle').css('visibility', '');
140                         panel.parent().hide();
141                 });
142         }
143 };
144
145 /**
146  * Help tabs.
147  */
148 $('.contextual-help-tabs').delegate('a', 'click focus', function(e) {
149         var link = $(this),
150                 panel;
151
152         e.preventDefault();
153
154         // Don't do anything if the click is for the tab already showing.
155         if ( link.is('.active a') )
156                 return false;
157
158         // Links
159         $('.contextual-help-tabs .active').removeClass('active');
160         link.parent('li').addClass('active');
161
162         panel = $( link.attr('href') );
163
164         // Panels
165         $('.help-tab-content').not( panel ).removeClass('active').hide();
166         panel.addClass('active').show();
167 });
168
169 $(document).ready( function() {
170         var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions,
171                 lastClicked = false,
172                 menu = $('#adminmenu'),
173                 pageInput = $('input.current-page'),
174                 currentPage = pageInput.val();
175
176         // when the menu is folded, make the fly-out submenu header clickable
177         menu.on('click.wp-submenu-head', '.wp-submenu-head', function(e){
178                 $(e.target).parent().siblings('a').get(0).click();
179         });
180
181         $('#collapse-menu').on('click.collapse-menu', function() {
182                 var body = $( document.body ), respWidth;
183
184                 // reset any compensation for submenus near the bottom of the screen
185                 $('#adminmenu div.wp-submenu').css('margin-top', '');
186
187                 if ( window.innerWidth ) {
188                         // window.innerWidth is affected by zooming on phones
189                         respWidth = Math.max( window.innerWidth, document.documentElement.clientWidth );
190                 } else {
191                         // IE < 9 doesn't support @media CSS rules
192                         respWidth = 901;
193                 }
194
195                 if ( respWidth && respWidth < 900 ) {
196                         if ( body.hasClass('auto-fold') ) {
197                                 body.removeClass('auto-fold').removeClass('folded');
198                                 setUserSetting('unfold', 1);
199                                 setUserSetting('mfold', 'o');
200                         } else {
201                                 body.addClass('auto-fold');
202                                 setUserSetting('unfold', 0);
203                         }
204                 } else {
205                         if ( body.hasClass('folded') ) {
206                                 body.removeClass('folded');
207                                 setUserSetting('mfold', 'o');
208                         } else {
209                                 body.addClass('folded');
210                                 setUserSetting('mfold', 'f');
211                         }
212                 }
213         });
214
215         if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // touch screen device
216                 // iOS Safari works with touchstart, the rest work with click
217                 mobileEvent = /Mobile\/.+Safari/.test(navigator.userAgent) ? 'touchstart' : 'click';
218
219                 // close any open submenus when touch/click is not on the menu
220                 $(document.body).on( mobileEvent+'.wp-mobile-hover', function(e) {
221                         if ( menu.data('wp-responsive') ) {
222                                 return;
223                         }
224
225                         if ( ! $(e.target).closest('#adminmenu').length ) {
226                                 menu.find('li.wp-has-submenu.opensub').removeClass('opensub');
227                         }
228                 });
229
230                 menu.find('a.wp-has-submenu').on( mobileEvent+'.wp-mobile-hover', function(e) {
231                         var b, h, o, f, menutop, wintop, maxtop,
232                                 el = $(this),
233                                 parent = el.parent(),
234                                 m = parent.find('.wp-submenu');
235
236                         if ( menu.data('wp-responsive') ) {
237                                 return;
238                         }
239
240                         // Show the sub instead of following the link if:
241                         //      - the submenu is not open
242                         //      - the submenu is not shown inline or the menu is not folded
243                         if ( !parent.hasClass('opensub') && ( !parent.hasClass('wp-menu-open') || parent.width() < 40 ) ) {
244                                 e.preventDefault();
245
246                                 menutop = parent.offset().top;
247                                 wintop = $(window).scrollTop();
248                                 maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar
249
250                                 b = menutop + m.height() + 1; // Bottom offset of the menu
251                                 h = $('#wpwrap').height(); // Height of the entire page
252                                 o = 60 + b - h;
253                                 f = $(window).height() + wintop - 50; // The fold
254
255                                 if ( f < (b - o) ) {
256                                         o = b - f;
257                                 }
258
259                                 if ( o > maxtop ) {
260                                         o = maxtop;
261                                 }
262
263                                 if ( o > 1 ) {
264                                         m.css('margin-top', '-'+o+'px');
265                                 } else {
266                                         m.css('margin-top', '');
267                                 }
268
269                                 menu.find('li.opensub').removeClass('opensub');
270                                 parent.addClass('opensub');
271                         }
272                 });
273         }
274
275         menu.find('li.wp-has-submenu').hoverIntent({
276                 over: function() {
277                         var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop, top = parseInt( m.css('top'), 10 );
278
279                         if ( isNaN(top) || top > -5 ) { // meaning the submenu is visible
280                                 return;
281                         }
282
283                         if ( menu.data('wp-responsive') ) {
284                                 // The menu is in responsive mode, bail
285                                 return;
286                         }
287
288                         menutop = $(this).offset().top;
289                         wintop = $(window).scrollTop();
290                         maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar
291
292                         b = menutop + m.height() + 1; // Bottom offset of the menu
293                         h = $('#wpwrap').height(); // Height of the entire page
294                         o = 60 + b - h;
295                         f = $(window).height() + wintop - 15; // The fold
296
297                         if ( f < (b - o) ) {
298                                 o = b - f;
299                         }
300
301                         if ( o > maxtop ) {
302                                 o = maxtop;
303                         }
304
305                         if ( o > 1 ) {
306                                 m.css('margin-top', '-'+o+'px');
307                         } else {
308                                 m.css('margin-top', '');
309                         }
310
311                         menu.find('li.menu-top').removeClass('opensub');
312                         $(this).addClass('opensub');
313                 },
314                 out: function(){
315                         if ( menu.data('wp-responsive') ) {
316                                 // The menu is in responsive mode, bail
317                                 return;
318                         }
319
320                         $(this).removeClass('opensub').find('.wp-submenu').css('margin-top', '');
321                 },
322                 timeout: 200,
323                 sensitivity: 7,
324                 interval: 90
325         });
326
327         menu.on('focus.adminmenu', '.wp-submenu a', function(e){
328                 if ( menu.data('wp-responsive') ) {
329                         // The menu is in responsive mode, bail
330                         return;
331                 }
332
333                 $(e.target).closest('li.menu-top').addClass('opensub');
334         }).on('blur.adminmenu', '.wp-submenu a', function(e){
335                 if ( menu.data('wp-responsive') ) {
336                         // The menu is in responsive mode, bail
337                         return;
338                 }
339
340                 $(e.target).closest('li.menu-top').removeClass('opensub');
341         });
342
343         // Move .updated and .error alert boxes. Don't move boxes designed to be inline.
344         $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2');
345         $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') );
346
347         // Init screen meta
348         screenMeta.init();
349
350         // check all checkboxes
351         $('tbody').children().children('.check-column').find(':checkbox').click( function(e) {
352                 if ( 'undefined' == e.shiftKey ) { return true; }
353                 if ( e.shiftKey ) {
354                         if ( !lastClicked ) { return true; }
355                         checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' );
356                         first = checks.index( lastClicked );
357                         last = checks.index( this );
358                         checked = $(this).prop('checked');
359                         if ( 0 < first && 0 < last && first != last ) {
360                                 sliced = ( last > first ) ? checks.slice( first, last ) : checks.slice( last, first );
361                                 sliced.prop( 'checked', function() {
362                                         if ( $(this).closest('tr').is(':visible') )
363                                                 return checked;
364
365                                         return false;
366                                 });
367                         }
368                 }
369                 lastClicked = this;
370
371                 // toggle "check all" checkboxes
372                 var unchecked = $(this).closest('tbody').find(':checkbox').filter(':visible').not(':checked');
373                 $(this).closest('table').children('thead, tfoot').find(':checkbox').prop('checked', function() {
374                         return ( 0 === unchecked.length );
375                 });
376
377                 return true;
378         });
379
380         $('thead, tfoot').find('.check-column :checkbox').on( 'click.wp-toggle-checkboxes', function( event ) {
381                 var $this = $(this),
382                         $table = $this.closest( 'table' ),
383                         controlChecked = $this.prop('checked'),
384                         toggle = event.shiftKey || $this.data('wp-toggle');
385
386                 $table.children( 'tbody' ).filter(':visible')
387                         .children().children('.check-column').find(':checkbox')
388                         .prop('checked', function() {
389                                 if ( $(this).is(':hidden') ) {
390                                         return false;
391                                 }
392
393                                 if ( toggle ) {
394                                         return ! $(this).prop( 'checked' );
395                                 } else if ( controlChecked ) {
396                                         return true;
397                                 }
398
399                                 return false;
400                         });
401
402                 $table.children('thead,  tfoot').filter(':visible')
403                         .children().children('.check-column').find(':checkbox')
404                         .prop('checked', function() {
405                                 if ( toggle ) {
406                                         return false;
407                                 } else if ( controlChecked ) {
408                                         return true;
409                                 }
410
411                                 return false;
412                         });
413         });
414
415         // Show row actions on keyboard focus of its parent container element or any other elements contained within
416         $( 'td.post-title, td.title, td.comment, .bookmarks td.column-name, td.blogname, td.username, .dashboard-comment-wrap' ).focusin(function(){
417                 clearTimeout( transitionTimeout );
418                 focusedRowActions = $(this).find( '.row-actions' );
419                 focusedRowActions.addClass( 'visible' );
420         }).focusout(function(){
421                 // Tabbing between post title and .row-actions links needs a brief pause, otherwise
422                 // the .row-actions div gets hidden in transit in some browsers (ahem, Firefox).
423                 transitionTimeout = setTimeout(function(){
424                         focusedRowActions.removeClass( 'visible' );
425                 }, 30);
426         });
427
428         $('#default-password-nag-no').click( function() {
429                 setUserSetting('default_password_nag', 'hide');
430                 $('div.default-password-nag').hide();
431                 return false;
432         });
433
434         // tab in textareas
435         $('#newcontent').bind('keydown.wpevent_InsertTab', function(e) {
436                 var el = e.target, selStart, selEnd, val, scroll, sel;
437
438                 if ( e.keyCode == 27 ) { // escape key
439                         $(el).data('tab-out', true);
440                         return;
441                 }
442
443                 if ( e.keyCode != 9 || e.ctrlKey || e.altKey || e.shiftKey ) // tab key
444                         return;
445
446                 if ( $(el).data('tab-out') ) {
447                         $(el).data('tab-out', false);
448                         return;
449                 }
450
451                 selStart = el.selectionStart;
452                 selEnd = el.selectionEnd;
453                 val = el.value;
454
455                 try {
456                         this.lastKey = 9; // not a standard DOM property, lastKey is to help stop Opera tab event. See blur handler below.
457                 } catch(err) {}
458
459                 if ( document.selection ) {
460                         el.focus();
461                         sel = document.selection.createRange();
462                         sel.text = '\t';
463                 } else if ( selStart >= 0 ) {
464                         scroll = this.scrollTop;
465                         el.value = val.substring(0, selStart).concat('\t', val.substring(selEnd) );
466                         el.selectionStart = el.selectionEnd = selStart + 1;
467                         this.scrollTop = scroll;
468                 }
469
470                 if ( e.stopPropagation )
471                         e.stopPropagation();
472                 if ( e.preventDefault )
473                         e.preventDefault();
474         });
475
476         $('#newcontent').bind('blur.wpevent_InsertTab', function() {
477                 if ( this.lastKey && 9 == this.lastKey )
478                         this.focus();
479         });
480
481         if ( pageInput.length ) {
482                 pageInput.closest('form').submit( function() {
483
484                         // Reset paging var for new filters/searches but not for bulk actions. See #17685.
485                         if ( $('select[name="action"]').val() == -1 && $('select[name="action2"]').val() == -1 && pageInput.val() == currentPage )
486                                 pageInput.val('1');
487                 });
488         }
489
490         $('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function () {
491                 $('select[name^="action"]').val('-1');
492         });
493
494         // Scroll into view when focused
495         $('#contextual-help-link, #show-settings-link').on( 'focus.scroll-into-view', function(e){
496                 if ( e.target.scrollIntoView )
497                         e.target.scrollIntoView(false);
498         });
499
500         // Disable upload buttons until files are selected
501         (function(){
502                 var button, input, form = $('form.wp-upload-form');
503                 if ( ! form.length )
504                         return;
505                 button = form.find('input[type="submit"]');
506                 input = form.find('input[type="file"]');
507
508                 function toggleUploadButton() {
509                         button.prop('disabled', '' === input.map( function() {
510                                 return $(this).val();
511                         }).get().join(''));
512                 }
513                 toggleUploadButton();
514                 input.on('change', toggleUploadButton);
515         })();
516 });
517
518 // Fire a custom jQuery event at the end of window resize
519 ( function() {
520         var timeout;
521
522         function triggerEvent() {
523                 $(document).trigger( 'wp-window-resized' );
524         }
525
526         function fireOnce() {
527                 window.clearTimeout( timeout );
528                 timeout = window.setTimeout( triggerEvent, 200 );
529         }
530
531         $(window).on( 'resize.wp-fire-once', fireOnce );
532 }());
533
534 $(document).ready( function() {
535         var $document = $( document ),
536                 $window = $( window ),
537                 $body = $( document.body ),
538                 $adminMenuWrap = $( '#adminmenuwrap' ),
539                 $collapseMenu = $( '#collapse-menu' ),
540                 $wpwrap = $( '#wpwrap' ),
541                 $adminmenu = $( '#adminmenu' ),
542                 $overlay = $( '#wp-responsive-overlay' ),
543                 $toolbar = $( '#wp-toolbar' ),
544                 $toolbarPopups = $toolbar.find( 'a[aria-haspopup="true"]' ),
545                 $sortables = $('.meta-box-sortables'),
546                 stickyMenuActive = false,
547                 wpResponsiveActive = false;
548
549         window.stickyMenu = {
550                 enable: function() {
551                         if ( ! stickyMenuActive ) {
552                                 $document.on( 'wp-window-resized.sticky-menu', $.proxy( this.update, this ) );
553                                 $collapseMenu.on( 'click.sticky-menu', $.proxy( this.update, this ) );
554                                 this.update();
555                                 stickyMenuActive = true;
556                         }
557                 },
558
559                 disable: function() {
560                         if ( stickyMenuActive ) {
561                                 $window.off( 'resize.sticky-menu' );
562                                 $collapseMenu.off( 'click.sticky-menu' );
563                                 $body.removeClass( 'sticky-menu' );
564                                 stickyMenuActive = false;
565                         }
566                 },
567
568                 update: function() {
569                         // Make the admin menu sticky if the viewport is taller than it
570                         if ( $window.height() > $adminMenuWrap.height() + 32 ) {
571                                 if ( ! $body.hasClass( 'sticky-menu' ) ) {
572                                         $body.addClass( 'sticky-menu' );
573                                 }
574                         } else {
575                                 if ( $body.hasClass( 'sticky-menu' ) ) {
576                                         $body.removeClass( 'sticky-menu' );
577                                 }
578                         }
579                 }
580         };
581
582         window.wpResponsive = {
583                 init: function() {
584                         var self = this,
585                                 scrollStart = 0;
586
587                         // Modify functionality based on custom activate/deactivate event
588                         $document.on( 'wp-responsive-activate.wp-responsive', function() {
589                                 self.activate();
590                         }).on( 'wp-responsive-deactivate.wp-responsive', function() {
591                                 self.deactivate();
592                         });
593
594                         $( '#wp-admin-bar-menu-toggle a' ).attr( 'aria-expanded', 'false' );
595
596                         // Toggle sidebar when toggle is clicked
597                         $( '#wp-admin-bar-menu-toggle' ).on( 'click.wp-responsive', function( event ) {
598                                 event.preventDefault();
599                                 $wpwrap.toggleClass( 'wp-responsive-open' );
600                                 if ( $wpwrap.hasClass( 'wp-responsive-open' ) ) {
601                                         $(this).find('a').attr( 'aria-expanded', 'true' );
602                                         $( '#adminmenu a:first' ).focus();
603                                 } else {
604                                         $(this).find('a').attr( 'aria-expanded', 'false' );
605                                 }
606                         } );
607
608                         // Add menu events
609                         $adminmenu.on( 'touchstart.wp-responsive', 'li.wp-has-submenu > a', function() {
610                                 scrollStart = $window.scrollTop();
611                         }).on( 'touchend.wp-responsive click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
612                                 if ( ! $adminmenu.data('wp-responsive') ||
613                                         ( event.type === 'touchend' && $window.scrollTop() !== scrollStart ) ) {
614
615                                         return;
616                                 }
617
618                                 $( this ).parent( 'li' ).toggleClass( 'selected' );
619                                 event.preventDefault();
620                         });
621
622                         self.trigger();
623                         $document.on( 'wp-window-resized.wp-responsive', $.proxy( this.trigger, this ) );
624
625                         // This needs to run later as UI Sortable may be initialized later on $(document).ready()
626                         $window.on( 'load.wp-responsive', function() {
627                                 var width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $window.width() : window.innerWidth;
628
629                                 if ( width <= 782 ) {
630                                         self.disableSortables();
631                                 }
632                         });
633                 },
634
635                 activate: function() {
636                         window.stickyMenu.disable();
637
638                         if ( ! $body.hasClass( 'auto-fold' ) ) {
639                                 $body.addClass( 'auto-fold' );
640                         }
641
642                         $adminmenu.data( 'wp-responsive', 1 );
643                         this.disableSortables();
644                 },
645
646                 deactivate: function() {
647                         window.stickyMenu.enable();
648                         $adminmenu.removeData('wp-responsive');
649                         this.enableSortables();
650                 },
651
652                 trigger: function() {
653                         var width;
654
655                         if ( window.innerWidth ) {
656                                 // window.innerWidth is affected by zooming on phones
657                                 width = Math.max( window.innerWidth, document.documentElement.clientWidth );
658                         } else {
659                                 // Exclude IE < 9, it doesn't support @media CSS rules
660                                 return;
661                         }
662
663                         if ( width <= 782 ) {
664                                 if ( ! wpResponsiveActive ) {
665                                         $document.trigger( 'wp-responsive-activate' );
666                                         wpResponsiveActive = true;
667                                 }
668                         } else {
669                                 if ( wpResponsiveActive ) {
670                                         $document.trigger( 'wp-responsive-deactivate' );
671                                         wpResponsiveActive = false;
672                                 }
673                         }
674
675                         if ( width <= 480 ) {
676                                 this.enableOverlay();
677                         } else {
678                                 this.disableOverlay();
679                         }
680                 },
681
682                 enableOverlay: function() {
683                         if ( $overlay.length === 0 ) {
684                                 $overlay = $( '<div id="wp-responsive-overlay"></div>' )
685                                         .insertAfter( '#wpcontent' )
686                                         .hide()
687                                         .on( 'click.wp-responsive', function() {
688                                                 $toolbar.find( '.menupop.hover' ).removeClass( 'hover' );
689                                                 $( this ).hide();
690                                         });
691                         }
692
693                         $toolbarPopups.on( 'click.wp-responsive', function() {
694                                 $overlay.show();
695                         });
696                 },
697
698                 disableOverlay: function() {
699                         $toolbarPopups.off( 'click.wp-responsive' );
700                         $overlay.hide();
701                 },
702
703                 disableSortables: function() {
704                         if ( $sortables.length ) {
705                                 try {
706                                         $sortables.sortable('disable');
707                                 } catch(e) {}
708                         }
709                 },
710
711                 enableSortables: function() {
712                         if ( $sortables.length ) {
713                                 try {
714                                         $sortables.sortable('enable');
715                                 } catch(e) {}
716                         }
717                 }
718         };
719
720         window.stickyMenu.enable();
721         window.wpResponsive.init();
722 });
723
724 // make Windows 8 devices playing along nicely
725 (function(){
726         if ( '-ms-user-select' in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/) ) {
727                 var msViewportStyle = document.createElement( 'style' );
728                 msViewportStyle.appendChild(
729                         document.createTextNode( '@-ms-viewport{width:auto!important}' )
730                 );
731                 document.getElementsByTagName( 'head' )[0].appendChild( msViewportStyle );
732         }
733 })();
734
735 }( jQuery, window ));