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