diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/readme.html /home/packages/code/qi/SOURCES/wordpress-3.5/readme.html *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/readme.html 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/readme.html 2012-11-29 18:57:07.000000000 -0600 *************** *** 8,14 ****

WordPress !
Version 3.4.2

Semantic Personal Publishing Platform

--- 8,14 ----

WordPress !
Version 3.5

Semantic Personal Publishing Platform

diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-activate.php /home/packages/code/qi/SOURCES/wordpress-3.5/wp-activate.php *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-activate.php 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-activate.php 2012-11-17 09:11:29.000000000 -0600 *************** *** 1,4 **** --- 1,12 ---- ").appendTo("head")})(jQuery),function(e,t){var n=function(e,t){return this instanceof n?this._init(e,t):new n(e,t)};n.fn=n.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var n="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),n=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":n,this[n](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){var e=new n(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"];for(var r=t.length-1;r>=0;r--)e[t[r]]=this[t[r]];return e},setHSpace:function(e){return this._hSpace=e==="hsv"?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,n,r=/^(rgb|hs(l|v))a?\(/;this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,"");if(e.match(r)&&e.match(/\)$/)){n=e.replace(/(\s|%)/g,"").replace(r,"").replace(/,?\);?$/,"").split(",");if(n.length<3)return this._error();if(n.length===4){this.a(parseFloat(n.pop()));if(this.error)return this}for(var i=n.length-1;i>=0;i--){n[i]=parseInt(n[i],10);if(isNaN(n[i]))return this._error()}return e.match(/^rgb/)?this.fromRgb({r:n[0],g:n[1],b:n[2]}):e.match(/^hsv/)?this.fromHsv({h:n[0],s:n[1],v:n[2]}):this.fromHsl({h:n[0],s:n[1],l:n[2]})}return this.fromHex(e)},fromRgb:function(e,n){return typeof e!="object"||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),n))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var n,r,i,s,o,u,a,f;return typeof e!="object"||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",u=e.h/360,a=e.s/100,f=e.l/100,a===0?n=r=i=f:(s=f<.5?f*(1+a):f+a-f*a,o=2*f-s,n=this.hue2rgb(o,s,u+1/3),r=this.hue2rgb(o,s,u),i=this.hue2rgb(o,s,u-1/3)),this.fromRgb({r:n*255,g:r*255,b:i*255},!0))},fromHsv:function(e){var n,r,i,s,o,u,a,f,l,c,h;if(typeof e!="object"||e.h===t||e.s===t||e.v===t)return this._error();this._hsv=e,this._hSpace="hsv",n=e.h/360,r=e.s/100,i=e.v/100,a=Math.floor(n*6),f=n*6-a,l=i*(1-r),c=i*(1-f*r),h=i*(1-(1-f)*r);switch(a%6){case 0:s=i,o=h,u=l;break;case 1:s=c,o=i,u=l;break;case 2:s=l,o=i,u=h;break;case 3:s=l,o=c,u=i;break;case 4:s=h,o=l,u=i;break;case 5:s=i,o=l,u=c}return this.fromRgb({r:s*255,g:o*255,b:u*255},!0)},fromInt:function(e,n){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),n===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},toString:function(){var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){e=e||"hex",t=parseFloat(t||this._alpha);switch(e){case"rgb":case"rgba":var n=this.toRgb();return t<1?"rgba( "+n.r+", "+n.g+", "+n.b+", "+t+" )":"rgb( "+n.r+", "+n.g+", "+n.b+" )";case"hsl":case"hsla":var r=this.toHsl();return t<1?"hsla( "+r.h+", "+r.s+"%, "+r.l+"%, "+t+" )":"hsl( "+r.h+", "+r.s+"%, "+r.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),s=Math.min(t,n,r),o,u,a=(i+s)/2;if(i===s)o=u=0;else{var f=i-s;u=a>.5?f/(2-i-s):f/(i+s);switch(i){case t:o=(n-r)/f+(nr?(t+.05)/(r+.05):(r+.05)/(t+.05)}throw"getDistanceLuminosityFrom requires a Color object"},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new n(t)},getGrayscaleContrastingColor:function(e){if(!e)return this.getMaxContrastColor();var t=e<5?5:e,n=this.getMaxContrastColor();e=n.getDistanceLuminosityFrom(this);if(e<=t)return n;var r=0===n.toInt()?1:-1;while(e>t)n=n.incrementLightness(r),e=n.getDistanceLuminosityFrom(this);return n},getReadableContrastingColor:function(e,r){if(!e instanceof n)return this;var i=r===t?5:r,s=e.getDistanceLuminosityFrom(this),o=e.getMaxContrastColor(),u=o.getDistanceLuminosityFrom(e);if(u<=i)return o;if(s>=i)return this;var a=0===o.toInt()?-1:1;while(sn.range[1]?n.range[1]:r),s[e]=r,this._spaceFunc("from",n.space,s))}},_spaceFunc:function(e,t,n){var r=t||this._hSpace,i=e+r.charAt(0).toUpperCase()+r.substr(1);return this[i](n)}};var r={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var i in r)r.hasOwnProperty(i)&&(n.fn[i]=n.fn._partial(i));e.Color=n}(typeof exports=="object"&&exports||this); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/link.dev.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/link.dev.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/link.dev.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/link.dev.js 1969-12-31 17:00:00.000000000 -0700 *************** *** 1,67 **** - jQuery(document).ready( function($) { - - var newCat, noSyncChecks = false, syncChecks, catAddAfter; - - $('#link_name').focus(); - // postboxes - postboxes.add_postbox_toggles('link'); - - // category tabs - $('#category-tabs a').click(function(){ - var t = $(this).attr('href'); - $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); - $('.tabs-panel').hide(); - $(t).show(); - if ( '#categories-all' == t ) - deleteUserSetting('cats'); - else - setUserSetting('cats','pop'); - return false; - }); - if ( getUserSetting('cats') ) - $('#category-tabs a[href="#categories-pop"]').click(); - - // Ajax Cat - newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); - $('#link-category-add-submit').click( function() { newCat.focus(); } ); - syncChecks = function() { - if ( noSyncChecks ) - return; - noSyncChecks = true; - var th = $(this), c = th.is(':checked'), id = th.val().toString(); - $('#in-link-category-' + id + ', #in-popular-category-' + id).prop( 'checked', c ); - noSyncChecks = false; - }; - - catAddAfter = function( r, s ) { - $(s.what + ' response_data', r).each( function() { - var t = $($(this).text()); - t.find( 'label' ).each( function() { - var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name = $.trim( th.text() ), o; - $('#' + id).change( syncChecks ); - o = $( '' ).text( name ); - } ); - } ); - }; - - $('#categorychecklist').wpList( { - alt: '', - what: 'link-category', - response: 'category-ajax-response', - addAfter: catAddAfter - } ); - - $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); - $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); - if ( 'pop' == getUserSetting('cats') ) - $('a[href="#categories-pop"]').click(); - - $('#category-add-toggle').click( function() { - $(this).parents('div:first').toggleClass( 'wp-hidden-children' ); - $('#category-tabs a[href="#categories-all"]').click(); - $('#newcategory').focus(); - return false; - } ); - - $('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); - }); --- 0 ---- diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/link.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/link.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/link.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/link.js 2012-08-31 13:20:28.000000000 -0500 *************** *** 1 **** ! jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#link-category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).prop("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");c('#category-tabs a[href="#categories-all"]').click();c("#newcategory").focus();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()}); \ No newline at end of file --- 1,67 ---- ! jQuery(document).ready( function($) { ! ! var newCat, noSyncChecks = false, syncChecks, catAddAfter; ! ! $('#link_name').focus(); ! // postboxes ! postboxes.add_postbox_toggles('link'); ! ! // category tabs ! $('#category-tabs a').click(function(){ ! var t = $(this).attr('href'); ! $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); ! $('.tabs-panel').hide(); ! $(t).show(); ! if ( '#categories-all' == t ) ! deleteUserSetting('cats'); ! else ! setUserSetting('cats','pop'); ! return false; ! }); ! if ( getUserSetting('cats') ) ! $('#category-tabs a[href="#categories-pop"]').click(); ! ! // Ajax Cat ! newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); ! $('#link-category-add-submit').click( function() { newCat.focus(); } ); ! syncChecks = function() { ! if ( noSyncChecks ) ! return; ! noSyncChecks = true; ! var th = $(this), c = th.is(':checked'), id = th.val().toString(); ! $('#in-link-category-' + id + ', #in-popular-category-' + id).prop( 'checked', c ); ! noSyncChecks = false; ! }; ! ! catAddAfter = function( r, s ) { ! $(s.what + ' response_data', r).each( function() { ! var t = $($(this).text()); ! t.find( 'label' ).each( function() { ! var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name = $.trim( th.text() ), o; ! $('#' + id).change( syncChecks ); ! o = $( '' ).text( name ); ! } ); ! } ); ! }; ! ! $('#categorychecklist').wpList( { ! alt: '', ! what: 'link-category', ! response: 'category-ajax-response', ! addAfter: catAddAfter ! } ); ! ! $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); ! $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); ! if ( 'pop' == getUserSetting('cats') ) ! $('a[href="#categories-pop"]').click(); ! ! $('#category-add-toggle').click( function() { ! $(this).parents('div:first').toggleClass( 'wp-hidden-children' ); ! $('#category-tabs a[href="#categories-all"]').click(); ! $('#newcategory').focus(); ! return false; ! } ); ! ! $('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); ! }); diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/link.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/link.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/link.min.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/link.min.js 2012-08-31 13:59:24.000000000 -0500 *************** *** 0 **** --- 1 ---- + jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#link-category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).prop("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");c('#category-tabs a[href="#categories-all"]').click();c("#newcategory").focus();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()}); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media.dev.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media.dev.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media.dev.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media.dev.js 1969-12-31 17:00:00.000000000 -0700 *************** *** 1,94 **** - - var findPosts; - (function($){ - findPosts = { - open : function(af_name, af_val) { - var st = document.documentElement.scrollTop || $(document).scrollTop(); - - if ( af_name && af_val ) { - $('#affected').attr('name', af_name).val(af_val); - } - $('#find-posts').show().draggable({ - handle: '#find-posts-head' - }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-250px'}); - - $('#find-posts-input').focus().keyup(function(e){ - if (e.which == 27) { findPosts.close(); } // close on Escape - }); - - return false; - }, - - close : function() { - $('#find-posts-response').html(''); - $('#find-posts').draggable('destroy').hide(); - }, - - send : function() { - var post = { - ps: $('#find-posts-input').val(), - action: 'find_posts', - _ajax_nonce: $('#_ajax_nonce').val(), - post_type: $('input[name="find-posts-what"]:checked').val() - }; - - $.ajax({ - type : 'POST', - url : ajaxurl, - data : post, - success : function(x) { findPosts.show(x); }, - error : function(r) { findPosts.error(r); } - }); - }, - - show : function(x) { - - if ( typeof(x) == 'string' ) { - this.error({'responseText': x}); - return; - } - - var r = wpAjax.parseAjaxResponse(x); - - if ( r.errors ) { - this.error({'responseText': wpAjax.broken}); - } - r = r.responses[0]; - $('#find-posts-response').html(r.data); - }, - - error : function(r) { - var er = r.statusText; - - if ( r.responseText ) { - er = r.responseText.replace( /<.[^<>]*?>/g, '' ); - } - if ( er ) { - $('#find-posts-response').html(er); - } - } - }; - - $(document).ready(function() { - $('#find-posts-submit').click(function(e) { - if ( '' == $('#find-posts-response').html() ) - e.preventDefault(); - }); - $( '#find-posts .find-box-search :input' ).keypress( function( event ) { - if ( 13 == event.which ) { - findPosts.send(); - return false; - } - } ); - $( '#find-posts-search' ).click( findPosts.send ); - $( '#find-posts-close' ).click( findPosts.close ); - $('#doaction, #doaction2').click(function(e){ - $('select[name^="action"]').each(function(){ - if ( $(this).val() == 'attach' ) { - e.preventDefault(); - findPosts.open(); - } - }); - }); - }); - })(jQuery); --- 0 ---- diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-gallery.dev.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-gallery.dev.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-gallery.dev.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-gallery.dev.js 1969-12-31 17:00:00.000000000 -0700 *************** *** 1,25 **** - jQuery(function($){ - $( 'body' ).bind( 'click.wp-gallery', function(e){ - var target = $( e.target ), id, img_size; - - if ( target.hasClass( 'wp-set-header' ) ) { - ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); - e.preventDefault(); - } else if ( target.hasClass( 'wp-set-background' ) ) { - id = target.data( 'attachment-id' ); - img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); - - jQuery.post(ajaxurl, { - action: 'set-background-image', - attachment_id: id, - size: img_size - }, function(){ - var win = window.dialogArguments || opener || parent || top; - win.tb_remove(); - win.location.reload(); - }); - - e.preventDefault(); - } - }); - }); --- 0 ---- diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-gallery.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-gallery.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-gallery.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-gallery.js 2012-08-22 19:04:18.000000000 -0500 *************** *** 1 **** ! jQuery(function(a){a("body").bind("click.wp-gallery",function(d){var c=a(d.target),f,b;if(c.hasClass("wp-set-header")){(window.dialogArguments||opener||parent||top).location.href=c.data("location");d.preventDefault()}else{if(c.hasClass("wp-set-background")){f=c.data("attachment-id");b=a('input[name="attachments['+f+'][image-size]"]:checked').val();jQuery.post(ajaxurl,{action:"set-background-image",attachment_id:f,size:b},function(){var e=window.dialogArguments||opener||parent||top;e.tb_remove();e.location.reload()});d.preventDefault()}}})}); \ No newline at end of file --- 1,25 ---- ! jQuery(function($){ ! $( 'body' ).bind( 'click.wp-gallery', function(e){ ! var target = $( e.target ), id, img_size; ! ! if ( target.hasClass( 'wp-set-header' ) ) { ! ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); ! e.preventDefault(); ! } else if ( target.hasClass( 'wp-set-background' ) ) { ! id = target.data( 'attachment-id' ); ! img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); ! ! jQuery.post(ajaxurl, { ! action: 'set-background-image', ! attachment_id: id, ! size: img_size ! }, function(){ ! var win = window.dialogArguments || opener || parent || top; ! win.tb_remove(); ! win.location.reload(); ! }); ! ! e.preventDefault(); ! } ! }); ! }); diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-gallery.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-gallery.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-gallery.min.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-gallery.min.js 2012-11-21 16:31:55.000000000 -0600 *************** *** 0 **** --- 1 ---- + jQuery(function(a){a("body").bind("click.wp-gallery",function(d){var c=a(d.target),f,b;if(c.hasClass("wp-set-header")){(window.dialogArguments||opener||parent||top).location.href=c.data("location");d.preventDefault()}else{if(c.hasClass("wp-set-background")){f=c.data("attachment-id");b=a('input[name="attachments['+f+'][image-size]"]:checked').val();jQuery.post(ajaxurl,{action:"set-background-image",attachment_id:f,size:b},function(){var e=window.dialogArguments||opener||parent||top;e.tb_remove();e.location.reload()});d.preventDefault()}}})}); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media.js 2012-11-20 12:50:15.000000000 -0600 *************** *** 1 **** ! var findPosts;(function(a){findPosts={open:function(d,c){var b=document.documentElement.scrollTop||a(document).scrollTop();if(d&&c){a("#affected").attr("name",d).val(c)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).css({top:b+50+"px",left:"50%",marginLeft:"-250px"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").hide()},send:function(){var b={ps:a("#find-posts-input").val(),action:"find_posts",_ajax_nonce:a("#_ajax_nonce").val(),post_type:a('input[name="find-posts-what"]:checked').val()};a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){findPosts.show(c)},error:function(c){findPosts.error(c)}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data)},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#find-posts .find-box-search :input").keypress(function(b){if(13==b.which){findPosts.send();return false}});a("#find-posts-search").click(findPosts.send);a("#find-posts-close").click(findPosts.close);a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})})})(jQuery); \ No newline at end of file --- 1,124 ---- ! ! var findPosts; ! (function($){ ! findPosts = { ! open : function(af_name, af_val) { ! var st = document.documentElement.scrollTop || $(document).scrollTop(), ! overlay = $( '.ui-find-overlay' ); ! ! if ( overlay.length == 0 ) { ! $( 'body' ).append( '
' ); ! findPosts.overlay(); ! } ! ! overlay.show(); ! ! if ( af_name && af_val ) { ! $('#affected').attr('name', af_name).val(af_val); ! } ! $('#find-posts').show().draggable({ ! handle: '#find-posts-head' ! }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-328px'}); ! ! $('#find-posts-input').focus().keyup(function(e){ ! if (e.which == 27) { findPosts.close(); } // close on Escape ! }); ! ! // Pull some results up by default ! findPosts.send(); ! ! return false; ! }, ! ! close : function() { ! $('#find-posts-response').html(''); ! $('#find-posts').draggable('destroy').hide(); ! $( '.ui-find-overlay' ).hide(); ! }, ! ! overlay : function() { ! $( '.ui-find-overlay' ).css( ! { 'z-index': '999', 'width': $( document ).width() + 'px', 'height': $( document ).height() + 'px' } ! ).on('click', function () { ! findPosts.close(); ! }); ! }, ! ! send : function() { ! var post = { ! ps: $('#find-posts-input').val(), ! action: 'find_posts', ! _ajax_nonce: $('#_ajax_nonce').val() ! }, ! spinner = $( '.find-box-search .spinner' ); ! ! spinner.show(); ! ! $.ajax({ ! type : 'POST', ! url : ajaxurl, ! data : post, ! success : function(x) { findPosts.show(x); spinner.hide(); }, ! error : function(r) { findPosts.error(r); spinner.hide(); } ! }); ! }, ! ! show : function(x) { ! ! if ( typeof(x) == 'string' ) { ! this.error({'responseText': x}); ! return; ! } ! ! var r = wpAjax.parseAjaxResponse(x); ! ! if ( r.errors ) { ! this.error({'responseText': wpAjax.broken}); ! } ! r = r.responses[0]; ! $('#find-posts-response').html(r.data); ! ! // Enable whole row to be clicked ! $( '.found-posts td' ).on( 'click', function () { ! $( this ).parent().find( '.found-radio input' ).prop( 'checked', true ); ! }); ! }, ! ! error : function(r) { ! var er = r.statusText; ! ! if ( r.responseText ) { ! er = r.responseText.replace( /<.[^<>]*?>/g, '' ); ! } ! if ( er ) { ! $('#find-posts-response').html(er); ! } ! } ! }; ! ! $(document).ready(function() { ! $('#find-posts-submit').click(function(e) { ! if ( '' == $('#find-posts-response').html() ) ! e.preventDefault(); ! }); ! $( '#find-posts .find-box-search :input' ).keypress( function( event ) { ! if ( 13 == event.which ) { ! findPosts.send(); ! return false; ! } ! } ); ! $( '#find-posts-search' ).click( findPosts.send ); ! $( '#find-posts-close' ).click( findPosts.close ); ! $('#doaction, #doaction2').click(function(e){ ! $('select[name^="action"]').each(function(){ ! if ( $(this).val() == 'attach' ) { ! e.preventDefault(); ! findPosts.open(); ! } ! }); ! }); ! }); ! $(window).resize(function() { ! findPosts.overlay(); ! }); ! })(jQuery); diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media.min.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media.min.js 2012-11-20 12:58:31.000000000 -0600 *************** *** 0 **** --- 1 ---- + var findPosts;(function(a){findPosts={open:function(e,d){var c=document.documentElement.scrollTop||a(document).scrollTop(),b=a(".ui-find-overlay");if(b.length==0){a("body").append('
');findPosts.overlay()}b.show();if(e&&d){a("#affected").attr("name",e).val(d)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).css({top:c+50+"px",left:"50%",marginLeft:"-328px"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});findPosts.send();return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").hide();a(".ui-find-overlay").hide()},overlay:function(){a(".ui-find-overlay").css({"z-index":"999",width:a(document).width()+"px",height:a(document).height()+"px"}).on("click",function(){findPosts.close()})},send:function(){var b={ps:a("#find-posts-input").val(),action:"find_posts",_ajax_nonce:a("#_ajax_nonce").val()},c=a(".find-box-search .spinner");c.show();a.ajax({type:"POST",url:ajaxurl,data:b,success:function(d){findPosts.show(d);c.hide()},error:function(d){findPosts.error(d);c.hide()}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data);a(".found-posts td").on("click",function(){a(this).parent().find(".found-radio input").prop("checked",true)})},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#find-posts .find-box-search :input").keypress(function(b){if(13==b.which){findPosts.send();return false}});a("#find-posts-search").click(findPosts.send);a("#find-posts-close").click(findPosts.close);a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})});a(window).resize(function(){findPosts.overlay()})})(jQuery); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-upload.dev.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-upload.dev.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-upload.dev.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-upload.dev.js 1969-12-31 17:00:00.000000000 -0700 *************** *** 1,88 **** - // send html to the post editor - - var wpActiveEditor; - - function send_to_editor(h) { - var ed, mce = typeof(tinymce) != 'undefined', qt = typeof(QTags) != 'undefined'; - - if ( !wpActiveEditor ) { - if ( mce && tinymce.activeEditor ) { - ed = tinymce.activeEditor; - wpActiveEditor = ed.id; - } else if ( !qt ) { - return false; - } - } else if ( mce ) { - if ( tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen') ) - ed = tinymce.activeEditor; - else - ed = tinymce.get(wpActiveEditor); - } - - if ( ed && !ed.isHidden() ) { - // restore caret position on IE - if ( tinymce.isIE && ed.windowManager.insertimagebookmark ) - ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); - - if ( h.indexOf('[caption') === 0 ) { - if ( ed.wpSetImgCaption ) - h = ed.wpSetImgCaption(h); - } else if ( h.indexOf('[gallery') === 0 ) { - if ( ed.plugins.wpgallery ) - h = ed.plugins.wpgallery._do_gallery(h); - } else if ( h.indexOf('[embed') === 0 ) { - if ( ed.plugins.wordpress ) - h = ed.plugins.wordpress._setEmbed(h); - } - - ed.execCommand('mceInsertContent', false, h); - } else if ( qt ) { - QTags.insertContent(h); - } else { - document.getElementById(wpActiveEditor).value += h; - } - - try{tb_remove();}catch(e){}; - } - - // thickbox settings - var tb_position; - (function($) { - tb_position = function() { - var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0; - - if ( $('body.admin-bar').length ) - adminbar_height = 28; - - if ( tbWindow.size() ) { - tbWindow.width( W - 50 ).height( H - 45 - adminbar_height ); - $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height ); - tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); - if ( typeof document.body.style.maxWidth != 'undefined' ) - tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'}); - }; - - return $('a.thickbox').each( function() { - var href = $(this).attr('href'); - if ( ! href ) return; - href = href.replace(/&width=[0-9]+/g, ''); - href = href.replace(/&height=[0-9]+/g, ''); - $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 - adminbar_height ) ); - }); - }; - - $(window).resize(function(){ tb_position(); }); - - // store caret position in IE - $(document).ready(function($){ - $('a.thickbox').click(function(){ - var ed; - - if ( typeof(tinymce) != 'undefined' && tinymce.isIE && ( ed = tinymce.get(wpActiveEditor) ) && !ed.isHidden() ) { - ed.focus(); - ed.windowManager.insertimagebookmark = ed.selection.getBookmark(); - } - }); - }); - - })(jQuery); --- 0 ---- diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-upload.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-upload.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-admin/js/media-upload.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-admin/js/media-upload.js 2012-12-04 18:59:25.000000000 -0600 *************** *** 1 **** ! var wpActiveEditor;function send_to_editor(c){var b,a=typeof(tinymce)!="undefined",f=typeof(QTags)!="undefined";if(!wpActiveEditor){if(a&&tinymce.activeEditor){b=tinymce.activeEditor;wpActiveEditor=b.id}else{if(!f){return false}}}else{if(a){if(tinymce.activeEditor&&(tinymce.activeEditor.id=="mce_fullscreen"||tinymce.activeEditor.id=="wp_mce_fullscreen")){b=tinymce.activeEditor}else{b=tinymce.get(wpActiveEditor)}}}if(b&&!b.isHidden()){if(tinymce.isIE&&b.windowManager.insertimagebookmark){b.selection.moveToBookmark(b.windowManager.insertimagebookmark)}if(c.indexOf("[caption")===0){if(b.wpSetImgCaption){c=b.wpSetImgCaption(c)}}else{if(c.indexOf("[gallery")===0){if(b.plugins.wpgallery){c=b.plugins.wpgallery._do_gallery(c)}}else{if(c.indexOf("[embed")===0){if(b.plugins.wordpress){c=b.plugins.wordpress._setEmbed(c)}}}}b.execCommand("mceInsertContent",false,c)}else{if(f){QTags.insertContent(c)}else{document.getElementById(wpActiveEditor).value+=c}}try{tb_remove()}catch(d){}}var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720 depth ) { - result = result.add( next ); - next = next.next(); - } - }); - return result; - }, - updateParentMenuItemDBId : function() { - return this.each(function(){ - var item = $(this), - input = item.find('.menu-item-data-parent-id'), - depth = item.menuItemDepth(), - parent = item.prev(); - - if( depth == 0 ) { // Item is on the top level, has no parent - input.val(0); - } else { // Find the parent item, and retrieve its object id. - while( ! parent[0] || ! parent[0].className || -1 == parent[0].className.indexOf('menu-item') || ( parent.menuItemDepth() != depth - 1 ) ) - parent = parent.prev(); - input.val( parent.find('.menu-item-data-db-id').val() ); - } - }); - }, - hideAdvancedMenuItemFields : function() { - return this.each(function(){ - var that = $(this); - $('.hide-column-tog').not(':checked').each(function(){ - that.find('.field-' + $(this).val() ).addClass('hidden-field'); - }); - }); - }, - /** - * Adds selected menu items to the menu. - * - * @param jQuery metabox The metabox jQuery object. - */ - addSelectedToMenu : function(processMethod) { - if ( 0 == $('#menu-to-edit').length ) { - return false; - } - - return this.each(function() { - var t = $(this), menuItems = {}, - checkboxes = t.find('.tabs-panel-active .categorychecklist li input:checked'), - re = new RegExp('menu-item\\[(\[^\\]\]*)'); - - processMethod = processMethod || api.addMenuItemToBottom; - - // If no items are checked, bail. - if ( !checkboxes.length ) - return false; - - // Show the ajax spinner - t.find('img.waiting').show(); - - // Retrieve menu item data - $(checkboxes).each(function(){ - var t = $(this), - listItemDBIDMatch = re.exec( t.attr('name') ), - listItemDBID = 'undefined' == typeof listItemDBIDMatch[1] ? 0 : parseInt(listItemDBIDMatch[1], 10); - if ( this.className && -1 != this.className.indexOf('add-to-top') ) - processMethod = api.addMenuItemToTop; - menuItems[listItemDBID] = t.closest('li').getItemData( 'add-menu-item', listItemDBID ); - }); - - // Add the items - api.addItemToMenu(menuItems, processMethod, function(){ - // Deselect the items and hide the ajax spinner - checkboxes.removeAttr('checked'); - t.find('img.waiting').hide(); - }); - }); - }, - getItemData : function( itemType, id ) { - itemType = itemType || 'menu-item'; - - var itemData = {}, i, - fields = [ - 'menu-item-db-id', - 'menu-item-object-id', - 'menu-item-object', - 'menu-item-parent-id', - 'menu-item-position', - 'menu-item-type', - 'menu-item-title', - 'menu-item-url', - 'menu-item-description', - 'menu-item-attr-title', - 'menu-item-target', - 'menu-item-classes', - 'menu-item-xfn' - ]; - - if( !id && itemType == 'menu-item' ) { - id = this.find('.menu-item-data-db-id').val(); - } - - if( !id ) return itemData; - - this.find('input').each(function() { - var field; - i = fields.length; - while ( i-- ) { - if( itemType == 'menu-item' ) - field = fields[i] + '[' + id + ']'; - else if( itemType == 'add-menu-item' ) - field = 'menu-item[' + id + '][' + fields[i] + ']'; - - if ( - this.name && - field == this.name - ) { - itemData[fields[i]] = this.value; - } - } - }); - - return itemData; - }, - setItemData : function( itemData, itemType, id ) { // Can take a type, such as 'menu-item', or an id. - itemType = itemType || 'menu-item'; - - if( !id && itemType == 'menu-item' ) { - id = $('.menu-item-data-db-id', this).val(); - } - - if( !id ) return this; - - this.find('input').each(function() { - var t = $(this), field; - $.each( itemData, function( attr, val ) { - if( itemType == 'menu-item' ) - field = attr + '[' + id + ']'; - else if( itemType == 'add-menu-item' ) - field = 'menu-item[' + id + '][' + attr + ']'; - - if ( field == t.attr('name') ) { - t.val( val ); - } - }); - }); - return this; - } - }); - }, - - initToggles : function() { - // init postboxes - postboxes.add_postbox_toggles('nav-menus'); - - // adjust columns functions for menus UI - columns.useCheckboxesForHidden(); - columns.checked = function(field) { - $('.field-' + field).removeClass('hidden-field'); - } - columns.unchecked = function(field) { - $('.field-' + field).addClass('hidden-field'); - } - // hide fields - api.menuList.hideAdvancedMenuItemFields(); - }, - - initSortables : function() { - var currentDepth = 0, originalDepth, minDepth, maxDepth, - prev, next, prevBottom, nextThreshold, helperHeight, transport, - menuEdge = api.menuList.offset().left, - body = $('body'), maxChildDepth, - menuMaxDepth = initialMenuMaxDepth(); - - // Use the right edge if RTL. - menuEdge += api.isRTL ? api.menuList.width() : 0; - - api.menuList.sortable({ - handle: '.menu-item-handle', - placeholder: 'sortable-placeholder', - start: function(e, ui) { - var height, width, parent, children, tempHolder; - - // handle placement for rtl orientation - if ( api.isRTL ) - ui.item[0].style.right = 'auto'; - - transport = ui.item.children('.menu-item-transport'); - - // Set depths. currentDepth must be set before children are located. - originalDepth = ui.item.menuItemDepth(); - updateCurrentDepth(ui, originalDepth); - - // Attach child elements to parent - // Skip the placeholder - parent = ( ui.item.next()[0] == ui.placeholder[0] ) ? ui.item.next() : ui.item; - children = parent.childMenuItems(); - transport.append( children ); - - // Update the height of the placeholder to match the moving item. - height = transport.outerHeight(); - // If there are children, account for distance between top of children and parent - height += ( height > 0 ) ? (ui.placeholder.css('margin-top').slice(0, -2) * 1) : 0; - height += ui.helper.outerHeight(); - helperHeight = height; - height -= 2; // Subtract 2 for borders - ui.placeholder.height(height); - - // Update the width of the placeholder to match the moving item. - maxChildDepth = originalDepth; - children.each(function(){ - var depth = $(this).menuItemDepth(); - maxChildDepth = (depth > maxChildDepth) ? depth : maxChildDepth; - }); - width = ui.helper.find('.menu-item-handle').outerWidth(); // Get original width - width += api.depthToPx(maxChildDepth - originalDepth); // Account for children - width -= 2; // Subtract 2 for borders - ui.placeholder.width(width); - - // Update the list of menu items. - tempHolder = ui.placeholder.next(); - tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder - ui.placeholder.detach(); // detach or jQuery UI will think the placeholder is a menu item - $(this).sortable( "refresh" ); // The children aren't sortable. We should let jQ UI know. - ui.item.after( ui.placeholder ); // reattach the placeholder. - tempHolder.css('margin-top', 0); // reset the margin - - // Now that the element is complete, we can update... - updateSharedVars(ui); - }, - stop: function(e, ui) { - var children, depthChange = currentDepth - originalDepth; - - // Return child elements to the list - children = transport.children().insertAfter(ui.item); - - // Update depth classes - if( depthChange != 0 ) { - ui.item.updateDepthClass( currentDepth ); - children.shiftDepthClass( depthChange ); - updateMenuMaxDepth( depthChange ); - } - // Register a change - api.registerChange(); - // Update the item data. - ui.item.updateParentMenuItemDBId(); - - // address sortable's incorrectly-calculated top in opera - ui.item[0].style.top = 0; - - // handle drop placement for rtl orientation - if ( api.isRTL ) { - ui.item[0].style.left = 'auto'; - ui.item[0].style.right = 0; - } - - // The width of the tab bar might have changed. Just in case. - api.refreshMenuTabs( true ); - }, - change: function(e, ui) { - // Make sure the placeholder is inside the menu. - // Otherwise fix it, or we're in trouble. - if( ! ui.placeholder.parent().hasClass('menu') ) - (prev.length) ? prev.after( ui.placeholder ) : api.menuList.prepend( ui.placeholder ); - - updateSharedVars(ui); - }, - sort: function(e, ui) { - var offset = ui.helper.offset(), - edge = api.isRTL ? offset.left + ui.helper.width() : offset.left, - depth = api.negateIfRTL * api.pxToDepth( edge - menuEdge ); - // Check and correct if depth is not within range. - // Also, if the dragged element is dragged upwards over - // an item, shift the placeholder to a child position. - if ( depth > maxDepth || offset.top < prevBottom ) depth = maxDepth; - else if ( depth < minDepth ) depth = minDepth; - - if( depth != currentDepth ) - updateCurrentDepth(ui, depth); - - // If we overlap the next element, manually shift downwards - if( nextThreshold && offset.top + helperHeight > nextThreshold ) { - next.after( ui.placeholder ); - updateSharedVars( ui ); - $(this).sortable( "refreshPositions" ); - } - } - }); - - function updateSharedVars(ui) { - var depth; - - prev = ui.placeholder.prev(); - next = ui.placeholder.next(); - - // Make sure we don't select the moving item. - if( prev[0] == ui.item[0] ) prev = prev.prev(); - if( next[0] == ui.item[0] ) next = next.next(); - - prevBottom = (prev.length) ? prev.offset().top + prev.height() : 0; - nextThreshold = (next.length) ? next.offset().top + next.height() / 3 : 0; - minDepth = (next.length) ? next.menuItemDepth() : 0; - - if( prev.length ) - maxDepth = ( (depth = prev.menuItemDepth() + 1) > api.options.globalMaxDepth ) ? api.options.globalMaxDepth : depth; - else - maxDepth = 0; - } - - function updateCurrentDepth(ui, depth) { - ui.placeholder.updateDepthClass( depth, currentDepth ); - currentDepth = depth; - } - - function initialMenuMaxDepth() { - if( ! body[0].className ) return 0; - var match = body[0].className.match(/menu-max-depth-(\d+)/); - return match && match[1] ? parseInt(match[1]) : 0; - } - - function updateMenuMaxDepth( depthChange ) { - var depth, newDepth = menuMaxDepth; - if ( depthChange === 0 ) { - return; - } else if ( depthChange > 0 ) { - depth = maxChildDepth + depthChange; - if( depth > menuMaxDepth ) - newDepth = depth; - } else if ( depthChange < 0 && maxChildDepth == menuMaxDepth ) { - while( ! $('.menu-item-depth-' + newDepth, api.menuList).length && newDepth > 0 ) - newDepth--; - } - // Update the depth class. - body.removeClass( 'menu-max-depth-' + menuMaxDepth ).addClass( 'menu-max-depth-' + newDepth ); - menuMaxDepth = newDepth; - } - }, - - attachMenuEditListeners : function() { - var that = this; - $('#update-nav-menu').bind('click', function(e) { - if ( e.target && e.target.className ) { - if ( -1 != e.target.className.indexOf('item-edit') ) { - return that.eventOnClickEditLink(e.target); - } else if ( -1 != e.target.className.indexOf('menu-save') ) { - return that.eventOnClickMenuSave(e.target); - } else if ( -1 != e.target.className.indexOf('menu-delete') ) { - return that.eventOnClickMenuDelete(e.target); - } else if ( -1 != e.target.className.indexOf('item-delete') ) { - return that.eventOnClickMenuItemDelete(e.target); - } else if ( -1 != e.target.className.indexOf('item-cancel') ) { - return that.eventOnClickCancelLink(e.target); - } - } - }); - $('#add-custom-links input[type="text"]').keypress(function(e){ - if ( e.keyCode === 13 ) { - e.preventDefault(); - $("#submit-customlinkdiv").click(); - } - }); - }, - - /** - * An interface for managing default values for input elements - * that is both JS and accessibility-friendly. - * - * Input elements that add the class 'input-with-default-title' - * will have their values set to the provided HTML title when empty. - */ - setupInputWithDefaultTitle : function() { - var name = 'input-with-default-title'; - - $('.' + name).each( function(){ - var $t = $(this), title = $t.attr('title'), val = $t.val(); - $t.data( name, title ); - - if( '' == val ) $t.val( title ); - else if ( title == val ) return; - else $t.removeClass( name ); - }).focus( function(){ - var $t = $(this); - if( $t.val() == $t.data(name) ) - $t.val('').removeClass( name ); - }).blur( function(){ - var $t = $(this); - if( '' == $t.val() ) - $t.addClass( name ).val( $t.data(name) ); - }); - }, - - attachThemeLocationsListeners : function() { - var loc = $('#nav-menu-theme-locations'), params = {}; - params['action'] = 'menu-locations-save'; - params['menu-settings-column-nonce'] = $('#menu-settings-column-nonce').val(); - loc.find('input[type="submit"]').click(function() { - loc.find('select').each(function() { - params[this.name] = $(this).val(); - }); - loc.find('.waiting').show(); - $.post( ajaxurl, params, function(r) { - loc.find('.waiting').hide(); - }); - return false; - }); - }, - - attachQuickSearchListeners : function() { - var searchTimer; - - $('.quick-search').keypress(function(e){ - var t = $(this); - - if( 13 == e.which ) { - api.updateQuickSearchResults( t ); - return false; - } - - if( searchTimer ) clearTimeout(searchTimer); - - searchTimer = setTimeout(function(){ - api.updateQuickSearchResults( t ); - }, 400); - }).attr('autocomplete','off'); - }, - - updateQuickSearchResults : function(input) { - var panel, params, - minSearchLength = 2, - q = input.val(); - - if( q.length < minSearchLength ) return; - - panel = input.parents('.tabs-panel'); - params = { - 'action': 'menu-quick-search', - 'response-format': 'markup', - 'menu': $('#menu').val(), - 'menu-settings-column-nonce': $('#menu-settings-column-nonce').val(), - 'q': q, - 'type': input.attr('name') - }; - - $('img.waiting', panel).show(); - - $.post( ajaxurl, params, function(menuMarkup) { - api.processQuickSearchQueryResponse(menuMarkup, params, panel); - }); - }, - - addCustomLink : function( processMethod ) { - var url = $('#custom-menu-item-url').val(), - label = $('#custom-menu-item-name').val(); - - processMethod = processMethod || api.addMenuItemToBottom; - - if ( '' == url || 'http://' == url ) - return false; - - // Show the ajax spinner - $('.customlinkdiv img.waiting').show(); - this.addLinkToMenu( url, label, processMethod, function() { - // Remove the ajax spinner - $('.customlinkdiv img.waiting').hide(); - // Set custom link form back to defaults - $('#custom-menu-item-name').val('').blur(); - $('#custom-menu-item-url').val('http://'); - }); - }, - - addLinkToMenu : function(url, label, processMethod, callback) { - processMethod = processMethod || api.addMenuItemToBottom; - callback = callback || function(){}; - - api.addItemToMenu({ - '-1': { - 'menu-item-type': 'custom', - 'menu-item-url': url, - 'menu-item-title': label - } - }, processMethod, callback); - }, - - addItemToMenu : function(menuItem, processMethod, callback) { - var menu = $('#menu').val(), - nonce = $('#menu-settings-column-nonce').val(); - - processMethod = processMethod || function(){}; - callback = callback || function(){}; - - params = { - 'action': 'add-menu-item', - 'menu': menu, - 'menu-settings-column-nonce': nonce, - 'menu-item': menuItem - }; - - $.post( ajaxurl, params, function(menuMarkup) { - var ins = $('#menu-instructions'); - processMethod(menuMarkup, params); - if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length ) - ins.addClass('menu-instructions-inactive'); - callback(); - }); - }, - - /** - * Process the add menu item request response into menu list item. - * - * @param string menuMarkup The text server response of menu item markup. - * @param object req The request arguments. - */ - addMenuItemToBottom : function( menuMarkup, req ) { - $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList ); - }, - - addMenuItemToTop : function( menuMarkup, req ) { - $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList ); - }, - - attachUnsavedChangesListener : function() { - $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea').change(function(){ - api.registerChange(); - }); - - if ( 0 != $('#menu-to-edit').length ) { - window.onbeforeunload = function(){ - if ( api.menusChanged ) - return navMenuL10n.saveAlert; - }; - } else { - // Make the post boxes read-only, as they can't be used yet - $('#menu-settings-column').find('input,select').prop('disabled', true).end().find('a').attr('href', '#').unbind('click'); - } - }, - - registerChange : function() { - api.menusChanged = true; - }, - - attachTabsPanelListeners : function() { - $('#menu-settings-column').bind('click', function(e) { - var selectAreaMatch, panelId, wrapper, items, - target = $(e.target); - - if ( target.hasClass('nav-tab-link') ) { - panelId = /#(.*)$/.exec(e.target.href); - if ( panelId && panelId[1] ) - panelId = panelId[1] - else - return false; - - wrapper = target.parents('.inside').first(); - - // upon changing tabs, we want to uncheck all checkboxes - $('input', wrapper).removeAttr('checked'); - - $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive'); - $('#' + panelId, wrapper).removeClass('tabs-panel-inactive').addClass('tabs-panel-active'); - - $('.tabs', wrapper).removeClass('tabs'); - target.parent().addClass('tabs'); - - // select the search bar - $('.quick-search', wrapper).focus(); - - return false; - } else if ( target.hasClass('select-all') ) { - selectAreaMatch = /#(.*)$/.exec(e.target.href); - if ( selectAreaMatch && selectAreaMatch[1] ) { - items = $('#' + selectAreaMatch[1] + ' .tabs-panel-active .menu-item-title input'); - if( items.length === items.filter(':checked').length ) - items.removeAttr('checked'); - else - items.prop('checked', true); - return false; - } - } else if ( target.hasClass('submit-add-to-menu') ) { - api.registerChange(); - - if ( e.target.id && 'submit-customlinkdiv' == e.target.id ) - api.addCustomLink( api.addMenuItemToBottom ); - else if ( e.target.id && -1 != e.target.id.indexOf('submit-') ) - $('#' + e.target.id.replace(/submit-/, '')).addSelectedToMenu( api.addMenuItemToBottom ); - return false; - } else if ( target.hasClass('page-numbers') ) { - $.post( ajaxurl, e.target.href.replace(/.*\?/, '').replace(/action=([^&]*)/, '') + '&action=menu-get-metabox', - function( resp ) { - if ( -1 == resp.indexOf('replace-id') ) - return; - - var metaBoxData = $.parseJSON(resp), - toReplace = document.getElementById(metaBoxData['replace-id']), - placeholder = document.createElement('div'), - wrap = document.createElement('div'); - - if ( ! metaBoxData['markup'] || ! toReplace ) - return; - - wrap.innerHTML = metaBoxData['markup'] ? metaBoxData['markup'] : ''; - - toReplace.parentNode.insertBefore( placeholder, toReplace ); - placeholder.parentNode.removeChild( toReplace ); - - placeholder.parentNode.insertBefore( wrap, placeholder ); - - placeholder.parentNode.removeChild( placeholder ); - - } - ); - - return false; - } - }); - }, - - initTabManager : function() { - var fixed = $('.nav-tabs-wrapper'), - fluid = fixed.children('.nav-tabs'), - active = fluid.children('.nav-tab-active'), - tabs = fluid.children('.nav-tab'), - tabsWidth = 0, - fixedRight, fixedLeft, - arrowLeft, arrowRight, resizeTimer, css = {}, - marginFluid = api.isRTL ? 'margin-right' : 'margin-left', - marginFixed = api.isRTL ? 'margin-left' : 'margin-right', - msPerPx = 2; - - /** - * Refreshes the menu tabs. - * Will show and hide arrows where necessary. - * Scrolls to the active tab by default. - * - * @param savePosition {boolean} Optional. Prevents scrolling so - * that the current position is maintained. Default false. - **/ - api.refreshMenuTabs = function( savePosition ) { - var fixedWidth = fixed.width(), - margin = 0, css = {}; - fixedLeft = fixed.offset().left; - fixedRight = fixedLeft + fixedWidth; - - if( !savePosition ) - active.makeTabVisible(); - - // Prevent space from building up next to the last tab if there's more to show - if( tabs.last().isTabVisible() ) { - margin = fixed.width() - tabsWidth; - margin = margin > 0 ? 0 : margin; - css[marginFluid] = margin + 'px'; - fluid.animate( css, 100, "linear" ); - } - - // Show the arrows only when necessary - if( fixedWidth > tabsWidth ) - arrowLeft.add( arrowRight ).hide(); - else - arrowLeft.add( arrowRight ).show(); - } - - $.fn.extend({ - makeTabVisible : function() { - var t = this.eq(0), left, right, css = {}, shift = 0; - - if( ! t.length ) return this; - - left = t.offset().left; - right = left + t.outerWidth(); - - if( right > fixedRight ) - shift = fixedRight - right; - else if ( left < fixedLeft ) - shift = fixedLeft - left; - - if( ! shift ) return this; - - css[marginFluid] = "+=" + api.negateIfRTL * shift + 'px'; - fluid.animate( css, Math.abs( shift ) * msPerPx, "linear" ); - return this; - }, - isTabVisible : function() { - var t = this.eq(0), - left = t.offset().left, - right = left + t.outerWidth(); - return ( right <= fixedRight && left >= fixedLeft ) ? true : false; - } - }); - - // Find the width of all tabs - tabs.each(function(){ - tabsWidth += $(this).outerWidth(true); - }); - - // Set up fixed margin for overflow, unset padding - css['padding'] = 0; - css[marginFixed] = (-1 * tabsWidth) + 'px'; - fluid.css( css ); - - // Build tab navigation - arrowLeft = $(''); - arrowRight = $(''); - // Attach to the document - fixed.wrap('")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var n=this;this.opos=[t.pageX,t.pageY];if(this.options.disabled)return;var r=this.options;this.selectees=e(r.filter,this.element[0]),this._trigger("start",t),e(r.appendTo).append(this.helper),this.helper.css({left:t.clientX,top:t.clientY,width:0,height:0}),r.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var r=e.data(this,"selectable-item");r.startselected=!0,!t.metaKey&&!t.ctrlKey&&(r.$element.removeClass("ui-selected"),r.selected=!1,r.$element.addClass("ui-unselecting"),r.unselecting=!0,n._trigger("unselecting",t,{unselecting:r.element}))}),e(t.target).parents().andSelf().each(function(){var r=e.data(this,"selectable-item");if(r){var i=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected");return r.$element.removeClass(i?"ui-unselecting":"ui-selected").addClass(i?"ui-selecting":"ui-unselecting"),r.unselecting=!i,r.selecting=i,r.selected=i,i?n._trigger("selecting",t,{selecting:r.element}):n._trigger("unselecting",t,{unselecting:r.element}),!1}})},_mouseDrag:function(t){var n=this;this.dragged=!0;if(this.options.disabled)return;var r=this.options,i=this.opos[0],s=this.opos[1],o=t.pageX,u=t.pageY;if(i>o){var a=o;o=i,i=a}if(s>u){var a=u;u=s,s=a}return this.helper.css({left:i,top:s,width:o-i,height:u-s}),this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!a||a.element==n.element[0])return;var f=!1;r.tolerance=="touch"?f=!(a.left>o||a.rightu||a.bottomi&&a.rights&&a.bottom").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.20"})})(jQuery); \ No newline at end of file --- 1,5 ---- ! /*! jQuery UI - v1.9.2 - 2012-11-23 ! * http://jqueryui.com * Includes: jquery.ui.slider.js ! * Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */ ! (function(e,t){var n=5;e.widget("ui.slider",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var t,r,i=this.options,s=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o="",u=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(i.disabled?" ui-slider-disabled ui-disabled":"")),this.range=e([]),i.range&&(i.range===!0&&(i.values||(i.values=[this._valueMin(),this._valueMin()]),i.values.length&&i.values.length!==2&&(i.values=[i.values[0],i.values[0]])),this.range=e("
").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(i.range==="min"||i.range==="max"?" ui-slider-range-"+i.range:""))),r=i.values&&i.values.length||1;for(t=s.length;tn&&(i=n,s=e(this),o=t)}),c.range===!0&&this.values(1)===c.min&&(o+=1,s=e(this.handles[o])),u=this._start(t,o),u===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,s.addClass("ui-state-active").focus(),a=s.offset(),f=!e(t.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=f?{left:0,top:0}:{left:t.pageX-a.left-s.width()/2,top:t.pageY-a.top-s.height()/2-(parseInt(s.css("borderTopWidth"),10)||0)-(parseInt(s.css("borderBottomWidth"),10)||0)+(parseInt(s.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,r),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},n=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,n),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,n,r,i,s;return this.orientation==="horizontal"?(t=this.elementSize.width,n=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,n=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),r=n/t,r>1&&(r=1),r<0&&(r=0),this.orientation==="vertical"&&(r=1-r),i=this._valueMax()-this._valueMin(),s=this._valueMin()+r*i,this._trimAlignValue(s)},_start:function(e,t){var n={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("start",e,n)},_slide:function(e,t,n){var r,i,s;this.options.values&&this.options.values.length?(r=this.values(t?0:1),this.options.values.length===2&&this.options.range===!0&&(t===0&&n>r||t===1&&n1){this.options.values[t]=this._trimAlignValue(n),this._refreshValue(),this._change(null,t);return}if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();r=this.options.values,i=arguments[0];for(s=0;s=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,n=(e-this._valueMin())%t,r=e-n;return Math.abs(n)*2>=t&&(r+=n>0?t:-t),parseFloat(r.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,n,r,i,s,o=this.options.range,u=this.options,a=this,f=this._animateOff?!1:u.animate,l={};this.options.values&&this.options.values.length?this.handles.each(function(r){n=(a.values(r)-a._valueMin())/(a._valueMax()-a._valueMin())*100,l[a.orientation==="horizontal"?"left":"bottom"]=n+"%",e(this).stop(1,1)[f?"animate":"css"](l,u.animate),a.options.range===!0&&(a.orientation==="horizontal"?(r===0&&a.range.stop(1,1)[f?"animate":"css"]({left:n+"%"},u.animate),r===1&&a.range[f?"animate":"css"]({width:n-t+"%"},{queue:!1,duration:u.animate})):(r===0&&a.range.stop(1,1)[f?"animate":"css"]({bottom:n+"%"},u.animate),r===1&&a.range[f?"animate":"css"]({height:n-t+"%"},{queue:!1,duration:u.animate}))),t=n}):(r=this.value(),i=this._valueMin(),s=this._valueMax(),n=s!==i?(r-i)/(s-i)*100:0,l[this.orientation==="horizontal"?"left":"bottom"]=n+"%",this.handle.stop(1,1)[f?"animate":"css"](l,u.animate),o==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[f?"animate":"css"]({width:n+"%"},u.animate),o==="max"&&this.orientation==="horizontal"&&this.range[f?"animate":"css"]({width:100-n+"%"},{queue:!1,duration:u.animate}),o==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[f?"animate":"css"]({height:n+"%"},u.animate),o==="max"&&this.orientation==="vertical"&&this.range[f?"animate":"css"]({height:100-n+"%"},{queue:!1,duration:u.animate}))}})})(jQuery); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/jquery/ui/jquery.ui.sortable.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/jquery/ui/jquery.ui.sortable.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/jquery/ui/jquery.ui.sortable.min.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/jquery/ui/jquery.ui.sortable.min.js 2012-11-25 19:20:40.000000000 -0600 *************** *** 1,5 **** ! /*! jQuery UI - v1.8.20 - 2012-04-30 ! * https://github.com/jquery/jquery-ui * Includes: jquery.ui.sortable.js ! * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ ! (function(a,b){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+jf&&b+ka[this.floating?"width":"height"]?l:f0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.items[i][this.containers[d].floating?"left":"top"];Math.abs(j-h)this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.topthis.containment[3]?h-this.offset.click.topthis.containment[2]?i-this.offset.click.left=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?e.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,n){t==="disabled"?(this.options[t]=n,this.widget().toggleClass("ui-sortable-disabled",!!n)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,n){var r=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(t);var i=null,s=e(t.target).parents().each(function(){if(e.data(this,r.widgetName+"-item")==r)return i=e(this),!1});e.data(t.target,r.widgetName+"-item")==r&&(i=e(t.target));if(!i)return!1;if(this.options.handle&&!n){var o=!1;e(this.options.handle,i).find("*").andSelf().each(function(){this==t.target&&(o=!0)});if(!o)return!1}return this.currentItem=i,this._removeCurrentsFromItems(),!0},_mouseStart:function(t,n,r){var i=this.options;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),i.containment&&this._setContainment(),i.cursor&&(e("body").css("cursor")&&(this._storedCursor=e("body").css("cursor")),e("body").css("cursor",i.cursor)),i.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",i.opacity)),i.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",i.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!r)for(var s=this.containers.length-1;s>=0;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var n=this.options,r=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY=0;i--){var s=this.items[i],o=s.item[0],u=this._intersectsWithPointer(s);if(!u)continue;if(s.instance!==this.currentContainer)continue;if(o!=this.currentItem[0]&&this.placeholder[u==1?"next":"prev"]()[0]!=o&&!e.contains(this.placeholder[0],o)&&(this.options.type=="semi-dynamic"?!e.contains(this.element[0],o):!0)){this.direction=u==1?"down":"up";if(this.options.tolerance!="pointer"&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,n){if(!t)return;e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t);if(this.options.revert){var r=this,i=this.placeholder.offset();this.reverting=!0,e(this.helper).animate({left:i.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:i.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){r._clear(t)})}else this._clear(t,n);return!1},cancel:function(){if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},e(n).each(function(){var n=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[-=_](.+)/);n&&r.push((t.key||n[1]+"[]")+"="+(t.key&&t.expression?n[1]:n[2]))}),!r.length&&t.key&&r.push(t.key+"="),r.join("&")},toArray:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},n.each(function(){r.push(e(t.item||this).attr(t.attribute||"id")||"")}),r},_intersectsWith:function(e){var t=this.positionAbs.left,n=t+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,s=e.left,o=s+e.width,u=e.top,a=u+e.height,f=this.offset.click.top,l=this.offset.click.left,c=r+f>u&&r+fs&&t+le[this.floating?"width":"height"]?c:s0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return e!=0&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor==String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var n=[],r=[],i=this._connectWith();if(i&&t)for(var s=i.length-1;s>=0;s--){var o=e(i[s]);for(var u=o.length-1;u>=0;u--){var a=e.data(o[u],this.widgetName);a&&a!=this&&!a.options.disabled&&r.push([e.isFunction(a.options.items)?a.options.items.call(a.element):e(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a])}}r.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var s=r.length-1;s>=0;s--)r[s][0].each(function(){n.push(this)});return e(n)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var n=0;n=0;s--){var o=e(i[s]);for(var u=o.length-1;u>=0;u--){var a=e.data(o[u],this.widgetName);a&&a!=this&&!a.options.disabled&&(r.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a))}}for(var s=r.length-1;s>=0;s--){var f=r[s][1],l=r[s][0];for(var u=0,c=l.length;u=0;n--){var r=this.items[n];if(r.instance!=this.currentContainer&&this.currentContainer&&r.item[0]!=this.currentItem[0])continue;var i=this.options.toleranceElement?e(this.options.toleranceElement,r.item):r.item;t||(r.width=i.outerWidth(),r.height=i.outerHeight());var s=i.offset();r.left=s.left,r.top=s.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var n=this.containers.length-1;n>=0;n--){var s=this.containers[n].element.offset();this.containers[n].containerCache.left=s.left,this.containers[n].containerCache.top=s.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight()}return this},_createPlaceholder:function(t){t=t||this;var n=t.options;if(!n.placeholder||n.placeholder.constructor==String){var r=n.placeholder;n.placeholder={element:function(){var n=e(document.createElement(t.currentItem[0].nodeName)).addClass(r||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return r||(n.style.visibility="hidden"),n},update:function(e,i){if(r&&!n.forcePlaceholderSize)return;i.height()||i.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),i.width()||i.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10))}}}t.placeholder=e(n.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),n.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var n=null,r=null;for(var i=this.containers.length-1;i>=0;i--){if(e.contains(this.currentItem[0],this.containers[i].element[0]))continue;if(this._intersectsWith(this.containers[i].containerCache)){if(n&&e.contains(this.containers[i].element[0],n.element[0]))continue;n=this.containers[i],r=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0)}if(!n)return;if(this.containers.length===1)this.containers[r]._trigger("over",t,this._uiHash(this)),this.containers[r].containerCache.over=1;else{var s=1e4,o=null,u=this.containers[r].floating?"left":"top",a=this.containers[r].floating?"width":"height",f=this.positionAbs[u]+this.offset.click[u];for(var l=this.items.length-1;l>=0;l--){if(!e.contains(this.containers[r].element[0],this.items[l].item[0]))continue;if(this.items[l].item[0]==this.currentItem[0])continue;var c=this.items[l].item.offset()[u],h=!1;Math.abs(c-f)>Math.abs(c+this.items[l][a]-f)&&(h=!0,c+=this.items[l][a]),Math.abs(c-f)this.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top));if(n.grid){var u=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1];o=this.containment?u-this.offset.click.topthis.containment[3]?u-this.offset.click.topthis.containment[2]?a-this.offset.click.left=0;i--)n||r.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(r.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);this._storedCursor&&e("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!n){this._trigger("beforeStop",t,this._uiHash());for(var i=0;i",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},n=this.element;return e.each(["min","max","step"],function(e,r){var i=n.attr(r);i!==undefined&&i.length&&(t[r]=i)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e)},mousewheel:function(e,t){if(!t)return;if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()},"mousedown .ui-spinner-button":function(t){function r(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n}))}var n;n=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),r.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,r.call(this)});if(this._start(t)===!1)return;this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(!e(t.currentTarget).hasClass("ui-state-active"))return;if(this._start(t)===!1)return!1;this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(e.height()*.5)&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var n=this.options,r=e.ui.keyCode;switch(t.keyCode){case r.UP:return this._repeat(null,1,t),!0;case r.DOWN:return this._repeat(null,-1,t),!0;case r.PAGE_UP:return this._repeat(null,n.page,t),!0;case r.PAGE_DOWN:return this._repeat(null,-n.page,t),!0}return!1},_uiSpinnerHtml:function(){return""},_buttonHtml:function(){return""+""+""+""+""},_start:function(e){return!this.spinning&&this._trigger("start",e)===!1?!1:(this.counter||(this.counter=1),this.spinning=!0,!0)},_repeat:function(e,t,n){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,n)},e),this._spin(t*this.options.step,n)},_spin:function(e,t){var n=this.value()||0;this.counter||(this.counter=1),n=this._adjustValue(n+e*this._increment(this.counter));if(!this.spinning||this._trigger("spin",t,{value:n})!==!1)this._value(n),this.counter++},_increment:function(t){var n=this.options.incremental;return n?e.isFunction(n)?n(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return this.options.min!==null&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=e.toString(),n=t.indexOf(".");return n===-1?0:t.length-n-1},_adjustValue:function(e){var t,n,r=this.options;return t=r.min!==null?r.min:0,n=e-t,n=Math.round(n/r.step)*r.step,e=t+n,e=parseFloat(e.toFixed(this._precision())),r.max!==null&&e>r.max?r.max:r.min!==null&&e",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.20"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a1&&e.href.replace(r,"")===location.href.replace(r,"").replace(/\s/g,"%20")}var n=0,r=/#.*$/;e.widget("ui.tabs",{version:"1.9.2",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var t=this,n=this.options,r=n.active,i=location.hash.substring(1);this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",n.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs();if(r===null){i&&this.tabs.each(function(t,n){if(e(n).attr("aria-controls")===i)return r=t,!1}),r===null&&(r=this.tabs.index(this.tabs.filter(".ui-tabs-active")));if(r===null||r===-1)r=this.tabs.length?0:!1}r!==!1&&(r=this.tabs.index(this.tabs.eq(r)),r===-1&&(r=n.collapsible?!1:0)),n.active=r,!n.collapsible&&n.active===!1&&this.anchors.length&&(n.active=0),e.isArray(n.disabled)&&(n.disabled=e.unique(n.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.options.active!==!1&&this.anchors.length?this.active=this._findActive(this.options.active):this.active=e(),this._refresh(),this.active.length&&this.load(n.active)},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var n=e(this.document[0].activeElement).closest("li"),r=this.tabs.index(n),i=!0;if(this._handlePageNav(t))return;switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:r++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:i=!1,r--;break;case e.ui.keyCode.END:r=this.anchors.length-1;break;case e.ui.keyCode.HOME:r=0;break;case e.ui.keyCode.SPACE:t.preventDefault(),clearTimeout(this.activating),this._activate(r);return;case e.ui.keyCode.ENTER:t.preventDefault(),clearTimeout(this.activating),this._activate(r===this.options.active?!1:r);return;default:return}t.preventDefault(),clearTimeout(this.activating),r=this._focusNextTab(r,i),t.ctrlKey||(n.attr("aria-selected","false"),this.tabs.eq(r).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",r)},this.delay))},_panelKeydown:function(t){if(this._handlePageNav(t))return;t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){if(t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP)return this._activate(this._focusNextTab(this.options.active-1,!1)),!0;if(t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN)return this._activate(this._focusNextTab(this.options.active+1,!0)),!0},_findNextTab:function(t,n){function i(){return t>r&&(t=0),t<0&&(t=r),t}var r=this.tabs.length-1;while(e.inArray(i(),this.options.disabled)!==-1)t=n?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){if(e==="active"){this._activate(t);return}if(e==="disabled"){this._setupDisabled(t);return}this._super(e,t),e==="collapsible"&&(this.element.toggleClass("ui-tabs-collapsible",t),!t&&this.options.active===!1&&this._activate(0)),e==="event"&&this._setupEvents(t),e==="heightStyle"&&this._setupHeightStyle(t)},_tabId:function(e){return e.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,n=this.tablist.children(":has(a[href])");t.disabled=e.map(n.filter(".ui-state-disabled"),function(e){return n.index(e)}),this._processTabs(),t.active===!1||!this.anchors.length?(t.active=!1,this.active=e()):this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(n,r){var i,o,u,a=e(r).uniqueId().attr("id"),f=e(r).closest("li"),l=f.attr("aria-controls");s(r)?(i=r.hash,o=t.element.find(t._sanitizeSelector(i))):(u=t._tabId(f),i="#"+u,o=t.element.find(i),o.length||(o=t._createPanel(u),o.insertAfter(t.panels[n-1]||t.tablist)),o.attr("aria-live","polite")),o.length&&(t.panels=t.panels.add(o)),l&&f.data("ui-tabs-aria-controls",l),f.attr({"aria-controls":i.substring(1),"aria-labelledby":a}),o.attr("aria-labelledby",a)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("
    ").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var n=0,r;r=this.tabs[n];n++)t===!0||e.inArray(n,t)!==-1?e(r).addClass("ui-state-disabled").attr("aria-disabled","true"):e(r).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var n={click:function(e){e.preventDefault()}};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,n),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var n,r,i=this.element.parent();t==="fill"?(e.support.minHeight||(r=i.css("overflow"),i.css("overflow","hidden")),n=i.height(),this.element.siblings(":visible").each(function(){var t=e(this),r=t.css("position");if(r==="absolute"||r==="fixed")return;n-=t.outerHeight(!0)}),r&&i.css("overflow",r),this.element.children().not(this.panels).each(function(){n-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,n-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):t==="auto"&&(n=0,this.panels.each(function(){n=Math.max(n,e(this).height("").height())}).height(n))},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i.closest("li"),o=s[0]===r[0],u=o&&n.collapsible,a=u?e():this._getPanelForTab(s),f=r.length?this._getPanelForTab(r):e(),l={oldTab:r,oldPanel:f,newTab:u?e():s,newPanel:a};t.preventDefault();if(s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||o&&!n.collapsible||this._trigger("beforeActivate",t,l)===!1)return;n.active=u?!1:this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),!f.length&&!a.length&&e.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,l)},_toggle:function(t,n){function o(){r.running=!1,r._trigger("activate",t,n)}function u(){n.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),i.length&&r.options.show?r._show(i,r.options.show,o):(i.show(),o())}var r=this,i=n.newPanel,s=n.oldPanel;this.running=!0,s.length&&this.options.hide?this._hide(s,this.options.hide,function(){n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),u()}):(n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s.hide(),u()),s.attr({"aria-expanded":"false","aria-hidden":"true"}),n.oldTab.attr("aria-selected","false"),i.length&&s.length?n.oldTab.attr("tabIndex",-1):i.length&&this.tabs.filter(function(){return e(this).attr("tabIndex")===0}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}),n.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(t){var n,r=this._findActive(t);if(r[0]===this.active[0])return;r.length||(r=this.active),n=r.find(".ui-tabs-anchor")[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop})},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return typeof e=="string"&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeData("href.tabs").removeData("load.tabs").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),n=t.data("ui-tabs-aria-controls");n?t.attr("aria-controls",n):t.removeAttr("aria-controls")}),this.panels.show(),this.options.heightStyle!=="content"&&this.panels.css("height","")},enable:function(n){var r=this.options.disabled;if(r===!1)return;n===t?r=!1:(n=this._getIndex(n),e.isArray(r)?r=e.map(r,function(e){return e!==n?e:null}):r=e.map(this.tabs,function(e,t){return t!==n?t:null})),this._setupDisabled(r)},disable:function(n){var r=this.options.disabled;if(r===!0)return;if(n===t)r=!0;else{n=this._getIndex(n);if(e.inArray(n,r)!==-1)return;e.isArray(r)?r=e.merge([n],r).sort():r=[n]}this._setupDisabled(r)},load:function(t,n){t=this._getIndex(t);var r=this,i=this.tabs.eq(t),o=i.find(".ui-tabs-anchor"),u=this._getPanelForTab(i),a={tab:i,panel:u};if(s(o[0]))return;this.xhr=e.ajax(this._ajaxSettings(o,n,a)),this.xhr&&this.xhr.statusText!=="canceled"&&(i.addClass("ui-tabs-loading"),u.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){u.html(e),r._trigger("load",n,a)},1)}).complete(function(e,t){setTimeout(function(){t==="abort"&&r.panels.stop(!1,!0),i.removeClass("ui-tabs-loading"),u.removeAttr("aria-busy"),e===r.xhr&&delete r.xhr},1)}))},_ajaxSettings:function(t,n,r){var i=this;return{url:t.attr("href"),beforeSend:function(t,s){return i._trigger("beforeLoad",n,e.extend({jqXHR:t,ajaxSettings:s},r))}}},_getPanelForTab:function(t){var n=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+n))}}),e.uiBackCompat!==!1&&(e.ui.tabs.prototype._ui=function(e,t){return{tab:e,panel:t,index:this.anchors.index(e)}},e.widget("ui.tabs",e.ui.tabs,{url:function(e,t){this.anchors.eq(e).attr("href",t)}}),e.widget("ui.tabs",e.ui.tabs,{options:{ajaxOptions:null,cache:!1},_create:function(){this._super();var t=this;this._on({tabsbeforeload:function(n,r){if(e.data(r.tab[0],"cache.tabs")){n.preventDefault();return}r.jqXHR.success(function(){t.options.cache&&e.data(r.tab[0],"cache.tabs",!0)})}})},_ajaxSettings:function(t,n,r){var i=this.options.ajaxOptions;return e.extend({},i,{error:function(e,t){try{i.error(e,t,r.tab.closest("li").index(),r.tab[0])}catch(n){}}},this._superApply(arguments))},_setOption:function(e,t){e==="cache"&&t===!1&&this.anchors.removeData("cache.tabs"),this._super(e,t)},_destroy:function(){this.anchors.removeData("cache.tabs"),this._super()},url:function(e){this.anchors.eq(e).removeData("cache.tabs"),this._superApply(arguments)}}),e.widget("ui.tabs",e.ui.tabs,{abort:function(){this.xhr&&this.xhr.abort()}}),e.widget("ui.tabs",e.ui.tabs,{options:{spinner:"Loading…"},_create:function(){this._super(),this._on({tabsbeforeload:function(e,t){if(e.target!==this.element[0]||!this.options.spinner)return;var n=t.tab.find("span"),r=n.html();n.html(this.options.spinner),t.jqXHR.complete(function(){n.html(r)})}})}}),e.widget("ui.tabs",e.ui.tabs,{options:{enable:null,disable:null},enable:function(t){var n=this.options,r;if(t&&n.disabled===!0||e.isArray(n.disabled)&&e.inArray(t,n.disabled)!==-1)r=!0;this._superApply(arguments),r&&this._trigger("enable",null,this._ui(this.anchors[t],this.panels[t]))},disable:function(t){var n=this.options,r;if(t&&n.disabled===!1||e.isArray(n.disabled)&&e.inArray(t,n.disabled)===-1)r=!0;this._superApply(arguments),r&&this._trigger("disable",null,this._ui(this.anchors[t],this.panels[t]))}}),e.widget("ui.tabs",e.ui.tabs,{options:{add:null,remove:null,tabTemplate:"
  • #{label}
  • "},add:function(n,r,i){i===t&&(i=this.anchors.length);var s,o,u=this.options,a=e(u.tabTemplate.replace(/#\{href\}/g,n).replace(/#\{label\}/g,r)),f=n.indexOf("#")?this._tabId(a):n.replace("#","");return a.addClass("ui-state-default ui-corner-top").data("ui-tabs-destroy",!0),a.attr("aria-controls",f),s=i>=this.tabs.length,o=this.element.find("#"+f),o.length||(o=this._createPanel(f),s?i>0?o.insertAfter(this.panels.eq(-1)):o.appendTo(this.element):o.insertBefore(this.panels[i])),o.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").hide(),s?a.appendTo(this.tablist):a.insertBefore(this.tabs[i]),u.disabled=e.map(u.disabled,function(e){return e>=i?++e:e}),this.refresh(),this.tabs.length===1&&u.active===!1&&this.option("active",0),this._trigger("add",null,this._ui(this.anchors[i],this.panels[i])),this},remove:function(t){t=this._getIndex(t);var n=this.options,r=this.tabs.eq(t).remove(),i=this._getPanelForTab(r).remove();return r.hasClass("ui-tabs-active")&&this.anchors.length>2&&this._activate(t+(t+1=t?--e:e}),this.refresh(),this._trigger("remove",null,this._ui(r.find("a")[0],i[0])),this}}),e.widget("ui.tabs",e.ui.tabs,{length:function(){return this.anchors.length}}),e.widget("ui.tabs",e.ui.tabs,{options:{idPrefix:"ui-tabs-"},_tabId:function(t){var n=t.is("li")?t.find("a[href]"):t;return n=n[0],e(n).closest("li").attr("aria-controls")||n.title&&n.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF\-]/g,"")||this.options.idPrefix+i()}}),e.widget("ui.tabs",e.ui.tabs,{options:{panelTemplate:"
    "},_createPanel:function(t){return e(this.options.panelTemplate).attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)}}),e.widget("ui.tabs",e.ui.tabs,{_create:function(){var e=this.options;e.active===null&&e.selected!==t&&(e.active=e.selected===-1?!1:e.selected),this._super(),e.selected=e.active,e.selected===!1&&(e.selected=-1)},_setOption:function(e,t){if(e!=="selected")return this._super(e,t);var n=this.options;this._super("active",t===-1?!1:t),n.selected=n.active,n.selected===!1&&(n.selected=-1)},_eventHandler:function(){this._superApply(arguments),this.options.selected=this.options.active,this.options.selected===!1&&(this.options.selected=-1)}}),e.widget("ui.tabs",e.ui.tabs,{options:{show:null,select:null},_create:function(){this._super(),this.options.active!==!1&&this._trigger("show",null,this._ui(this.active.find(".ui-tabs-anchor")[0],this._getPanelForTab(this.active)[0]))},_trigger:function(e,t,n){var r,i,s=this._superApply(arguments);return s?(e==="beforeActivate"?(r=n.newTab.length?n.newTab:n.oldTab,i=n.newPanel.length?n.newPanel:n.oldPanel,s=this._super("select",t,{tab:r.find(".ui-tabs-anchor")[0],panel:i[0],index:r.closest("li").index()})):e==="activate"&&n.newTab.length&&(s=this._super("show",t,{tab:n.newTab.find(".ui-tabs-anchor")[0],panel:n.newPanel[0],index:n.newTab.closest("li").index()})),s):!1}}),e.widget("ui.tabs",e.ui.tabs,{select:function(e){e=this._getIndex(e);if(e===-1){if(!this.options.collapsible||this.options.selected===-1)return;e=this.options.selected}this.anchors.eq(e).trigger(this.options.event+this.eventNamespace)}}),function(){var t=0;e.widget("ui.tabs",e.ui.tabs,{options:{cookie:null},_create:function(){var e=this.options,t;e.active==null&&e.cookie&&(t=parseInt(this._cookie(),10),t===-1&&(t=!1),e.active=t),this._super()},_cookie:function(n){var r=[this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+ ++t)];return arguments.length&&(r.push(n===!1?-1:n),r.push(this.options.cookie)),e.cookie.apply(null,r)},_refresh:function(){this._super(),this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_eventHandler:function(){this._superApply(arguments),this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_destroy:function(){this._super(),this.options.cookie&&this._cookie(null,this.options.cookie)}})}(),e.widget("ui.tabs",e.ui.tabs,{_trigger:function(t,n,r){var i=e.extend({},r);return t==="load"&&(i.panel=i.panel[0],i.tab=i.tab.find(".ui-tabs-anchor")[0]),this._super(t,n,i)}}),e.widget("ui.tabs",e.ui.tabs,{options:{fx:null},_getFx:function(){var t,n,r=this.options.fx;return r&&(e.isArray(r)?(t=r[0],n=r[1]):t=n=r),r?{show:n,hide:t}:null},_toggle:function(e,t){function o(){n.running=!1,n._trigger("activate",e,t)}function u(){t.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),r.length&&s.show?r.animate(s.show,s.show.duration,function(){o()}):(r.show(),o())}var n=this,r=t.newPanel,i=t.oldPanel,s=this._getFx();if(!s)return this._super(e,t);n.running=!0,i.length&&s.hide?i.animate(s.hide,s.hide.duration,function(){t.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),u()}):(t.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),i.hide(),u())}}))})(jQuery); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js 2012-11-25 19:20:40.000000000 -0600 *************** *** 0 **** --- 1,5 ---- + /*! jQuery UI - v1.9.2 - 2012-11-23 + * http://jqueryui.com + * Includes: jquery.ui.tooltip.js + * Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */ + (function(e){function n(t,n){var r=(t.attr("aria-describedby")||"").split(/\s+/);r.push(n),t.data("ui-tooltip-id",n).attr("aria-describedby",e.trim(r.join(" ")))}function r(t){var n=t.data("ui-tooltip-id"),r=(t.attr("aria-describedby")||"").split(/\s+/),i=e.inArray(n,r);i!==-1&&r.splice(i,1),t.removeData("ui-tooltip-id"),r=e.trim(r.join(" ")),r?t.attr("aria-describedby",r):t.removeAttr("aria-describedby")}var t=0;e.widget("ui.tooltip",{version:"1.9.2",options:{content:function(){return e(this).attr("title")},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,n){var r=this;if(t==="disabled"){this[n?"_disable":"_enable"](),this.options[t]=n;return}this._super(t,n),t==="content"&&e.each(this.tooltips,function(e,t){r._updateContent(t)})},_disable:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r[0],t.close(i,!0)}),this.element.find(this.options.items).andSelf().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).andSelf().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var n=this,r=e(t?t.target:this.element).closest(this.options.items);if(!r.length||r.data("ui-tooltip-id"))return;r.attr("title")&&r.data("ui-tooltip-title",r.attr("title")),r.data("ui-tooltip-open",!0),t&&t.type==="mouseover"&&r.parents().each(function(){var t=e(this),r;t.data("ui-tooltip-open")&&(r=e.Event("blur"),r.target=r.currentTarget=this,n.close(r,!0)),t.attr("title")&&(t.uniqueId(),n.parents[this.id]={element:this,title:t.attr("title")},t.attr("title",""))}),this._updateContent(r,t)},_updateContent:function(e,t){var n,r=this.options.content,i=this,s=t?t.type:null;if(typeof r=="string")return this._open(t,e,r);n=r.call(e[0],function(n){if(!e.data("ui-tooltip-open"))return;i._delay(function(){t&&(t.type=s),this._open(t,e,n)})}),n&&this._open(t,e,n)},_open:function(t,r,i){function f(e){a.of=e;if(s.is(":hidden"))return;s.position(a)}var s,o,u,a=e.extend({},this.options.position);if(!i)return;s=this._find(r);if(s.length){s.find(".ui-tooltip-content").html(i);return}r.is("[title]")&&(t&&t.type==="mouseover"?r.attr("title",""):r.removeAttr("title")),s=this._tooltip(r),n(r,s.attr("id")),s.find(".ui-tooltip-content").html(i),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:f}),f(t)):s.position(e.extend({of:r},this.options.position)),s.hide(),this._show(s,this.options.show),this.options.show&&this.options.show.delay&&(u=setInterval(function(){s.is(":visible")&&(f(a.of),clearInterval(u))},e.fx.interval)),this._trigger("open",t,{tooltip:s}),o={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var n=e.Event(t);n.currentTarget=r[0],this.close(n,!0)}},remove:function(){this._removeTooltip(s)}};if(!t||t.type==="mouseover")o.mouseleave="close";if(!t||t.type==="focusin")o.focusout="close";this._on(!0,r,o)},close:function(t){var n=this,i=e(t?t.currentTarget:this.element),s=this._find(i);if(this.closing)return;i.data("ui-tooltip-title")&&i.attr("title",i.data("ui-tooltip-title")),r(i),s.stop(!0),this._hide(s,this.options.hide,function(){n._removeTooltip(e(this))}),i.removeData("ui-tooltip-open"),this._off(i,"mouseleave focusout keyup"),i[0]!==this.element[0]&&this._off(i,"remove"),this._off(this.document,"mousemove"),t&&t.type==="mouseleave"&&e.each(this.parents,function(t,r){e(r.element).attr("title",r.title),delete n.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:s}),this.closing=!1},_tooltip:function(n){var r="ui-tooltip-"+t++,i=e("
    ").attr({id:r,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("
    ").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),e.fn.bgiframe&&i.bgiframe(),this.tooltips[r]=n,i},_find:function(t){var n=t.data("ui-tooltip-id");return n?e("#"+n):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r[0],t.close(i,!0),e("#"+n).remove(),r.data("ui-tooltip-title")&&(r.attr("title",r.data("ui-tooltip-title")),r.removeData("ui-tooltip-title"))})}})})(jQuery); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/jquery/ui/jquery.ui.widget.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/jquery/ui/jquery.ui.widget.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/jquery/ui/jquery.ui.widget.min.js 2012-12-17 14:37:12.000000000 -0600 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/jquery/ui/jquery.ui.widget.min.js 2012-11-25 19:20:40.000000000 -0600 *************** *** 1,5 **** ! /*! jQuery UI - v1.8.20 - 2012-04-30 ! * https://github.com/jquery/jquery-ui * Includes: jquery.ui.widget.js ! * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ ! (function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}})(jQuery); \ No newline at end of file --- 1,5 ---- ! /*! jQuery UI - v1.9.2 - 2012-11-23 ! * http://jqueryui.com * Includes: jquery.ui.widget.js ! * Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */ ! (function(e,t){var n=0,r=Array.prototype.slice,i=e.cleanData;e.cleanData=function(t){for(var n=0,r;(r=t[n])!=null;n++)try{e(r).triggerHandler("remove")}catch(s){}i(t)},e.widget=function(t,n,r){var i,s,o,u,a=t.split(".")[0];t=t.split(".")[1],i=a+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[a]=e[a]||{},s=e[a][t],o=e[a][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,i){e.isFunction(i)&&(r[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},r=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=r,s=i.apply(this,arguments),this._super=t,this._superApply=n,s}}())}),o.prototype=e.widget.extend(u,{widgetEventPrefix:s?u.widgetEventPrefix:t},r,{constructor:o,namespace:a,widgetName:t,widgetBaseClass:i,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o)},e.widget.extend=function(n){var i=r.call(arguments,1),s=0,o=i.length,u,a;for(;s",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetName,this),e.data(r,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n=="string"){i={},s=n.split("."),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u'); + }); + }, + + // ### toText( content ) + // Scans an HTML `content` string and replaces any view instances with + // their respective text representations. + toText: function( content ) { + return content.replace( /<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g, function( match, id ) { + var instance = instances[ id ], + view; + + if ( instance ) + view = wp.mce.view.get( instance.options.viewType ); + + return instance && view ? view.text( instance ) : ''; + }); + }, + + // ### Remove internal TinyMCE attributes. + removeInternalAttrs: function( attrs ) { + var result = {}; + _.each( attrs, function( value, attr ) { + if ( -1 === attr.indexOf('data-mce') ) + result[ attr ] = value; + }); + return result; + }, + + // ### Parse an attribute string and removes internal TinyMCE attributes. + attrs: function( content ) { + return wp.mce.view.removeInternalAttrs( wp.html.attrs( content ) ); + }, + + // ### instance( scope ) + // + // Accepts a MCE view wrapper `node` (i.e. a node with the + // `wp-view-wrap` class). + instance: function( node ) { + var id = $( node ).data('wp-view'); + + if ( id ) + return instances[ id ]; + }, + + // ### Select a view. + // + // Accepts a MCE view wrapper `node` (i.e. a node with the + // `wp-view-wrap` class). + select: function( node ) { + var $node = $(node); + + // Bail if node is already selected. + if ( $node.hasClass('selected') ) + return; + + $node.addClass('selected'); + $( node.firstChild ).trigger('select'); + }, + + // ### Deselect a view. + // + // Accepts a MCE view wrapper `node` (i.e. a node with the + // `wp-view-wrap` class). + deselect: function( node ) { + var $node = $(node); + + // Bail if node is already selected. + if ( ! $node.hasClass('selected') ) + return; + + $node.removeClass('selected'); + $( node.firstChild ).trigger('deselect'); + } + }; + + }(jQuery)); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/mce-view.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/mce-view.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/mce-view.min.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/mce-view.min.js 2012-11-21 16:31:55.000000000 -0600 *************** *** 0 **** --- 1 ---- + window.wp=window.wp||{};(function(b){var a={},c={};wp.mce=wp.mce||{};wp.mce.view={defaults:{pattern:{view:Backbone.View,text:function(d){return d.options.original},toView:function(e){if(!this.pattern){return}this.pattern.lastIndex=0;var d=this.pattern.exec(e);if(!d){return}return{index:d.index,content:d[0],options:{original:d[0],results:d}}}},shortcode:{view:Backbone.View,text:function(d){return d.options.shortcode.string()},toView:function(e){var d=wp.shortcode.next(this.shortcode,e);if(!d){return}return{index:d.index,content:d.content,options:{shortcode:d.shortcode}}}}},add:function(i,e){var g,d,h,f;if(e.extend){g=wp.mce.view.get(e.extend)}else{if(e.shortcode){g=wp.mce.view.defaults.shortcode}else{g=wp.mce.view.defaults.pattern}}_.defaults(e,g);e.id=i;f={remove:function(){delete c[this.el.id];this.$el.parent().remove();if(d){d.apply(this,arguments)}return this}};if(_.isFunction(e.view)){h=e.view}else{h=g.view;d=e.view.remove;_.defaults(f,e.view)}if(!d&&!h._mceview){d=h.prototype.remove}e.view=h.extend(f,{_mceview:true});a[i]=e},get:function(d){return a[d]},remove:function(d){delete a[d]},toViews:function(e){var d=[{content:e}],f;_.each(a,function(h,g){f=d.slice();d=[];_.each(f,function(k){var j=k.content,i;if(k.processed){d.push(k);return}while(j&&(i=h.toView(j))){if(i.index){d.push({content:j.substring(0,i.index)})}d.push({content:wp.mce.view.toView(g,i.options),processed:true});j=j.slice(i.index+i.content.length)}if(j){d.push({content:j})}})});return _.pluck(d,"content").join("")},toView:function(e,g){var f=wp.mce.view.get(e),d,h;if(!f){return""}d=new f.view(_.extend(g||{},{viewType:e}));h=d.el.id=d.el.id||_.uniqueId("__wpmce-");c[h]=d;d.$wrapper=b();return wp.html.string({tag:"span"===d.tagName?"span":"div",attrs:{"class":"wp-view-wrap wp-view-type-"+e,"data-wp-view":h,contenteditable:false}})},render:function(d){b(".wp-view-wrap",d).each(function(){var f=b(this),e=wp.mce.view.instance(this);if(!e){return}e.$wrapper=f;e.render();e.$el.detach();f.empty().append(e.el).append('')})},toText:function(d){return d.replace(/<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g,function(g,h){var e=c[h],f;if(e){f=wp.mce.view.get(e.options.viewType)}return e&&f?f.text(e):""})},removeInternalAttrs:function(e){var d={};_.each(e,function(g,f){if(-1===f.indexOf("data-mce")){d[f]=g}});return d},attrs:function(d){return wp.mce.view.removeInternalAttrs(wp.html.attrs(d))},instance:function(d){var e=b(d).data("wp-view");if(e){return c[e]}},select:function(e){var d=b(e);if(d.hasClass("selected")){return}d.addClass("selected");b(e.firstChild).trigger("select")},deselect:function(e){var d=b(e);if(!d.hasClass("selected")){return}d.removeClass("selected");b(e.firstChild).trigger("deselect")}}}(jQuery)); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/media-editor.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/media-editor.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/media-editor.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/media-editor.js 2012-12-06 19:13:04.000000000 -0600 *************** *** 0 **** --- 1,646 ---- + // WordPress, TinyMCE, and Media + // ----------------------------- + (function($){ + // Stores the editors' `wp.media.controller.Frame` instances. + var workflows = {}; + + wp.media.string = { + // Joins the `props` and `attachment` objects, + // outputting the proper object format based on the + // attachment's type. + props: function( props, attachment ) { + var link, linkUrl, size, sizes, fallbacks; + + // Final fallbacks run after all processing has been completed. + fallbacks = function( props ) { + // Generate alt fallbacks and strip tags. + if ( 'image' === props.type && ! props.alt ) { + props.alt = props.caption || props.title || ''; + props.alt = props.alt.replace( /<\/?[^>]+>/g, '' ); + } + + return props; + }; + + props = props ? _.clone( props ) : {}; + + if ( attachment && attachment.type ) + props.type = attachment.type; + + if ( 'image' === props.type ) { + props = _.defaults( props || {}, { + align: getUserSetting( 'align', 'none' ), + size: getUserSetting( 'imgsize', 'medium' ), + url: '', + classes: [] + }); + } + + // All attachment-specific settings follow. + if ( ! attachment ) + return fallbacks( props ); + + props.title = props.title || attachment.title; + + link = props.link || getUserSetting( 'urlbutton', 'post' ); + if ( 'file' === link ) + linkUrl = attachment.url; + else if ( 'post' === link ) + linkUrl = attachment.link; + else if ( 'custom' === link ) + linkUrl = props.linkUrl; + props.linkUrl = linkUrl || ''; + + // Format properties for images. + if ( 'image' === attachment.type ) { + props.classes.push( 'wp-image-' + attachment.id ); + + sizes = attachment.sizes; + size = sizes && sizes[ props.size ] ? sizes[ props.size ] : attachment; + + _.extend( props, _.pick( attachment, 'align', 'caption', 'alt' ), { + width: size.width, + height: size.height, + src: size.url, + captionId: 'attachment_' + attachment.id + }); + + // Format properties for non-images. + } else { + props.title = props.title || attachment.filename; + props.rel = props.rel || 'attachment wp-att-' + attachment.id; + } + + return fallbacks( props ); + }, + + link: function( props, attachment ) { + var options; + + props = wp.media.string.props( props, attachment ); + + options = { + tag: 'a', + content: props.title, + attrs: { + href: props.linkUrl + } + }; + + if ( props.rel ) + options.attrs.rel = props.rel; + + return wp.html.string( options ); + }, + + image: function( props, attachment ) { + var img = {}, + options, classes, shortcode, html; + + props = wp.media.string.props( props, attachment ); + classes = props.classes || []; + + img.src = props.url; + _.extend( img, _.pick( props, 'width', 'height', 'alt' ) ); + + // Only assign the align class to the image if we're not printing + // a caption, since the alignment is sent to the shortcode. + if ( props.align && ! props.caption ) + classes.push( 'align' + props.align ); + + if ( props.size ) + classes.push( 'size-' + props.size ); + + img['class'] = _.compact( classes ).join(' '); + + // Generate `img` tag options. + options = { + tag: 'img', + attrs: img, + single: true + }; + + // Generate the `a` element options, if they exist. + if ( props.linkUrl ) { + options = { + tag: 'a', + attrs: { + href: props.linkUrl + }, + content: options + }; + } + + html = wp.html.string( options ); + + // Generate the caption shortcode. + if ( props.caption ) { + shortcode = {}; + + if ( img.width ) + shortcode.width = img.width; + + if ( props.captionId ) + shortcode.id = props.captionId; + + if ( props.align ) + shortcode.align = 'align' + props.align; + + html = wp.shortcode.string({ + tag: 'caption', + attrs: shortcode, + content: html + ' ' + props.caption + }); + } + + return html; + } + }; + + wp.media.gallery = (function() { + var galleries = {}; + + return { + defaults: { + order: 'ASC', + id: wp.media.view.settings.post.id, + itemtag: 'dl', + icontag: 'dt', + captiontag: 'dd', + columns: 3, + size: 'thumbnail', + orderby: 'menu_order ID' + }, + + attachments: function( shortcode ) { + var shortcodeString = shortcode.string(), + result = galleries[ shortcodeString ], + attrs, args, query, others; + + delete galleries[ shortcodeString ]; + + if ( result ) + return result; + + // Fill the default shortcode attributes. + attrs = _.defaults( shortcode.attrs.named, wp.media.gallery.defaults ); + args = _.pick( attrs, 'orderby', 'order' ); + + args.type = 'image'; + args.perPage = -1; + + // Mark the `orderby` override attribute. + if ( 'rand' === attrs.orderby ) + attrs._orderbyRandom = true; + + // Map the `orderby` attribute to the corresponding model property. + if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) + args.orderby = 'menuOrder'; + + // Map the `ids` param to the correct query args. + if ( attrs.ids ) { + args.post__in = attrs.ids.split(','); + args.orderby = 'post__in'; + } else if ( attrs.include ) { + args.post__in = attrs.include.split(','); + } + + if ( attrs.exclude ) + args.post__not_in = attrs.exclude.split(','); + + if ( ! args.post__in ) + args.uploadedTo = attrs.id; + + // Collect the attributes that were not included in `args`. + others = _.omit( attrs, 'id', 'ids', 'include', 'exclude', 'orderby', 'order' ); + + query = wp.media.query( args ); + query.gallery = new Backbone.Model( others ); + return query; + }, + + shortcode: function( attachments ) { + var props = attachments.props.toJSON(), + attrs = _.pick( props, 'orderby', 'order' ), + shortcode, clone; + + if ( attachments.gallery ) + _.extend( attrs, attachments.gallery.toJSON() ); + + // Convert all gallery shortcodes to use the `ids` property. + // Ignore `post__in` and `post__not_in`; the attachments in + // the collection will already reflect those properties. + attrs.ids = attachments.pluck('id'); + + // Copy the `uploadedTo` post ID. + if ( props.uploadedTo ) + attrs.id = props.uploadedTo; + + // Check if the gallery is randomly ordered. + if ( attrs._orderbyRandom ) + attrs.orderby = 'rand'; + delete attrs._orderbyRandom; + + // If the `ids` attribute is set and `orderby` attribute + // is the default value, clear it for cleaner output. + if ( attrs.ids && 'post__in' === attrs.orderby ) + delete attrs.orderby; + + // Remove default attributes from the shortcode. + _.each( wp.media.gallery.defaults, function( value, key ) { + if ( value === attrs[ key ] ) + delete attrs[ key ]; + }); + + shortcode = new wp.shortcode({ + tag: 'gallery', + attrs: attrs, + type: 'single' + }); + + // Use a cloned version of the gallery. + clone = new wp.media.model.Attachments( attachments.models, { + props: props + }); + clone.gallery = attachments.gallery; + galleries[ shortcode.string() ] = clone; + + return shortcode; + }, + + edit: function( content ) { + var shortcode = wp.shortcode.next( 'gallery', content ), + defaultPostId = wp.media.gallery.defaults.id, + attachments, selection; + + // Bail if we didn't match the shortcode or all of the content. + if ( ! shortcode || shortcode.content !== content ) + return; + + // Ignore the rest of the match object. + shortcode = shortcode.shortcode; + + if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) ) + shortcode.set( 'id', defaultPostId ); + + attachments = wp.media.gallery.attachments( shortcode ); + + selection = new wp.media.model.Selection( attachments.models, { + props: attachments.props.toJSON(), + multiple: true + }); + + selection.gallery = attachments.gallery; + + // Fetch the query's attachments, and then break ties from the + // query to allow for sorting. + selection.more().done( function() { + // Break ties with the query. + selection.props.set({ query: false }); + selection.unmirror(); + selection.props.unset('orderby'); + }); + + // Destroy the previous gallery frame. + if ( this.frame ) + this.frame.dispose(); + + // Store the current gallery frame. + this.frame = wp.media({ + frame: 'post', + state: 'gallery-edit', + title: wp.media.view.l10n.editGalleryTitle, + editing: true, + multiple: true, + selection: selection + }).open(); + + return this.frame; + } + }; + }()); + + wp.media.featuredImage = { + get: function() { + return wp.media.view.settings.post.featuredImageId; + }, + + set: function( id ) { + var settings = wp.media.view.settings; + + settings.post.featuredImageId = id; + + wp.media.post( 'set-post-thumbnail', { + json: true, + post_id: settings.post.id, + thumbnail_id: settings.post.featuredImageId, + _wpnonce: settings.post.nonce + }).done( function( html ) { + $( '.inside', '#postimagediv' ).html( html ); + }); + }, + + frame: function() { + if ( this._frame ) + return this._frame; + + this._frame = wp.media({ + state: 'featured-image', + states: [ new wp.media.controller.FeaturedImage() ] + }); + + this._frame.on( 'toolbar:create:featured-image', function( toolbar ) { + this.createSelectToolbar( toolbar, { + text: wp.media.view.l10n.setFeaturedImage + }); + }, this._frame ); + + this._frame.state('featured-image').on( 'select', this.select ); + return this._frame; + }, + + select: function() { + var settings = wp.media.view.settings, + selection = this.get('selection').single(); + + if ( ! settings.post.featuredImageId ) + return; + + wp.media.featuredImage.set( selection ? selection.id : -1 ); + }, + + init: function() { + // Open the content media manager to the 'featured image' tab when + // the post thumbnail is clicked. + $('#postimagediv').on( 'click', '#set-post-thumbnail', function( event ) { + event.preventDefault(); + // Stop propagation to prevent thickbox from activating. + event.stopPropagation(); + + wp.media.featuredImage.frame().open(); + + // Update the featured image id when the 'remove' link is clicked. + }).on( 'click', '#remove-post-thumbnail', function() { + wp.media.view.settings.post.featuredImageId = -1; + }); + } + }; + + $( wp.media.featuredImage.init ); + + wp.media.editor = { + insert: function( h ) { + var mce = typeof(tinymce) != 'undefined', + qt = typeof(QTags) != 'undefined', + wpActiveEditor = window.wpActiveEditor, + ed; + + // Delegate to the global `send_to_editor` if it exists. + // This attempts to play nice with any themes/plugins that have + // overridden the insert functionality. + if ( window.send_to_editor ) + return window.send_to_editor.apply( this, arguments ); + + if ( ! wpActiveEditor ) { + if ( mce && tinymce.activeEditor ) { + ed = tinymce.activeEditor; + wpActiveEditor = window.wpActiveEditor = ed.id; + } else if ( !qt ) { + return false; + } + } else if ( mce ) { + if ( tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen') ) + ed = tinymce.activeEditor; + else + ed = tinymce.get(wpActiveEditor); + } + + if ( ed && !ed.isHidden() ) { + // restore caret position on IE + if ( tinymce.isIE && ed.windowManager.insertimagebookmark ) + ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); + + if ( h.indexOf('[caption') !== -1 ) { + if ( ed.wpSetImgCaption ) + h = ed.wpSetImgCaption(h); + } else if ( h.indexOf('[gallery') !== -1 ) { + if ( ed.plugins.wpgallery ) + h = ed.plugins.wpgallery._do_gallery(h); + } else if ( h.indexOf('[embed') === 0 ) { + if ( ed.plugins.wordpress ) + h = ed.plugins.wordpress._setEmbed(h); + } + + ed.execCommand('mceInsertContent', false, h); + } else if ( qt ) { + QTags.insertContent(h); + } else { + document.getElementById(wpActiveEditor).value += h; + } + + // If the old thickbox remove function exists, call it in case + // a theme/plugin overloaded it. + if ( window.tb_remove ) + try { window.tb_remove(); } catch( e ) {} + }, + + add: function( id, options ) { + var workflow = this.get( id ); + + if ( workflow ) + return workflow; + + workflow = workflows[ id ] = wp.media( _.defaults( options || {}, { + frame: 'post', + state: 'insert', + title: wp.media.view.l10n.addMedia, + multiple: true + } ) ); + + workflow.on( 'insert', function( selection ) { + var state = workflow.state(); + + selection = selection || state.get('selection'); + + if ( ! selection ) + return; + + $.when.apply( $, selection.map( function( attachment ) { + var display = state.display( attachment ).toJSON(); + return this.send.attachment( display, attachment.toJSON() ); + }, this ) ).done( function() { + wp.media.editor.insert( _.toArray( arguments ).join("\n\n") ); + }); + }, this ); + + workflow.state('gallery-edit').on( 'update', function( selection ) { + this.insert( wp.media.gallery.shortcode( selection ).string() ); + }, this ); + + workflow.state('embed').on( 'select', function() { + var state = workflow.state(), + type = state.get('type'), + embed = state.props.toJSON(); + + embed.url = embed.url || ''; + + if ( 'link' === type ) { + _.defaults( embed, { + title: embed.url, + linkUrl: embed.url + }); + + this.send.link( embed ).done( function( resp ) { + wp.media.editor.insert( resp ); + }); + + } else if ( 'image' === type ) { + _.defaults( embed, { + title: embed.url, + linkUrl: '', + align: 'none', + link: 'none' + }); + + if ( 'none' === embed.link ) + embed.linkUrl = ''; + else if ( 'file' === embed.link ) + embed.linkUrl = embed.url; + + this.insert( wp.media.string.image( embed ) ); + } + }, this ); + + workflow.state('featured-image').on( 'select', wp.media.featuredImage.select ); + workflow.setState( workflow.options.state ); + return workflow; + }, + + id: function( id ) { + if ( id ) + return id; + + // If an empty `id` is provided, default to `wpActiveEditor`. + id = wpActiveEditor; + + // If that doesn't work, fall back to `tinymce.activeEditor.id`. + if ( ! id && typeof tinymce !== 'undefined' && tinymce.activeEditor ) + id = tinymce.activeEditor.id; + + // Last but not least, fall back to the empty string. + id = id || ''; + return id; + }, + + get: function( id ) { + id = this.id( id ); + return workflows[ id ]; + }, + + remove: function( id ) { + id = this.id( id ); + delete workflows[ id ]; + }, + + send: { + attachment: function( props, attachment ) { + var caption = attachment.caption, + options, html; + + // If captions are disabled, clear the caption. + if ( ! wp.media.view.settings.captions ) + delete attachment.caption; + + props = wp.media.string.props( props, attachment ); + + options = { + id: attachment.id, + post_content: attachment.description, + post_excerpt: caption + }; + + if ( props.linkUrl ) + options.url = props.linkUrl; + + if ( 'image' === attachment.type ) { + html = wp.media.string.image( props ); + + _.each({ + align: 'align', + size: 'image-size', + alt: 'image_alt' + }, function( option, prop ) { + if ( props[ prop ] ) + options[ option ] = props[ prop ]; + }); + + } else { + html = wp.media.string.link( props ); + options.post_title = props.title; + } + + return wp.media.post( 'send-attachment-to-editor', { + nonce: wp.media.view.settings.nonce.sendToEditor, + attachment: options, + html: html, + post_id: wp.media.view.settings.post.id + }); + }, + + link: function( embed ) { + return wp.media.post( 'send-link-to-editor', { + nonce: wp.media.view.settings.nonce.sendToEditor, + src: embed.linkUrl, + title: embed.title, + html: wp.media.string.link( embed ), + post_id: wp.media.view.settings.post.id + }); + } + }, + + open: function( id ) { + var workflow, editor; + + id = this.id( id ); + + // Save a bookmark of the caret position in IE. + if ( typeof tinymce !== 'undefined' ) { + editor = tinymce.get( id ); + + if ( tinymce.isIE && editor && ! editor.isHidden() ) { + editor.focus(); + editor.windowManager.insertimagebookmark = editor.selection.getBookmark(); + } + } + + workflow = this.get( id ); + + // Initialize the editor's workflow if we haven't yet. + if ( ! workflow ) + workflow = this.add( id ); + + return workflow.open(); + }, + + init: function() { + $(document.body).on( 'click', '.insert-media', function( event ) { + var $this = $(this), + editor = $this.data('editor'); + + event.preventDefault(); + + // Remove focus from the `.insert-media` button. + // Prevents Opera from showing the outline of the button + // above the modal. + // + // See: http://core.trac.wordpress.org/ticket/22445 + $this.blur(); + + wp.media.editor.open( editor ); + }); + } + }; + + _.bindAll( wp.media.editor, 'open' ); + $( wp.media.editor.init ); + }(jQuery)); diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/media-editor.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/media-editor.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/media-editor.min.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/media-editor.min.js 2012-12-06 19:15:44.000000000 -0600 *************** *** 0 **** --- 1 ---- + (function(b){var a={};wp.media.string={props:function(f,i){var h,c,e,g,d;d=function(j){if("image"===j.type&&!j.alt){j.alt=j.caption||j.title||"";j.alt=j.alt.replace(/<\/?[^>]+>/g,"")}return j};f=f?_.clone(f):{};if(i&&i.type){f.type=i.type}if("image"===f.type){f=_.defaults(f||{},{align:getUserSetting("align","none"),size:getUserSetting("imgsize","medium"),url:"",classes:[]})}if(!i){return d(f)}f.title=f.title||i.title;h=f.link||getUserSetting("urlbutton","post");if("file"===h){c=i.url}else{if("post"===h){c=i.link}else{if("custom"===h){c=f.linkUrl}}}f.linkUrl=c||"";if("image"===i.type){f.classes.push("wp-image-"+i.id);g=i.sizes;e=g&&g[f.size]?g[f.size]:i;_.extend(f,_.pick(i,"align","caption","alt"),{width:e.width,height:e.height,src:e.url,captionId:"attachment_"+i.id})}else{f.title=f.title||i.filename;f.rel=f.rel||"attachment wp-att-"+i.id}return d(f)},link:function(d,e){var c;d=wp.media.string.props(d,e);c={tag:"a",content:d.title,attrs:{href:d.linkUrl}};if(d.rel){c.attrs.rel=d.rel}return wp.html.string(c)},image:function(g,i){var c={},d,f,h,e;g=wp.media.string.props(g,i);f=g.classes||[];c.src=g.url;_.extend(c,_.pick(g,"width","height","alt"));if(g.align&&!g.caption){f.push("align"+g.align)}if(g.size){f.push("size-"+g.size)}c["class"]=_.compact(f).join(" ");d={tag:"img",attrs:c,single:true};if(g.linkUrl){d={tag:"a",attrs:{href:g.linkUrl},content:d}}e=wp.html.string(d);if(g.caption){h={};if(c.width){h.width=c.width}if(g.captionId){h.id=g.captionId}if(g.align){h.align="align"+g.align}e=wp.shortcode.string({tag:"caption",attrs:h,content:e+" "+g.caption})}return e}};wp.media.gallery=(function(){var c={};return{defaults:{order:"ASC",id:wp.media.view.settings.post.id,itemtag:"dl",icontag:"dt",captiontag:"dd",columns:3,size:"thumbnail",orderby:"menu_order ID"},attachments:function(h){var j=h.string(),d=c[j],f,e,i,g;delete c[j];if(d){return d}f=_.defaults(h.attrs.named,wp.media.gallery.defaults);e=_.pick(f,"orderby","order");e.type="image";e.perPage=-1;if("rand"===f.orderby){f._orderbyRandom=true}if(!f.orderby||/^menu_order(?: ID)?$/i.test(f.orderby)){e.orderby="menuOrder"}if(f.ids){e.post__in=f.ids.split(",");e.orderby="post__in"}else{if(f.include){e.post__in=f.include.split(",")}}if(f.exclude){e.post__not_in=f.exclude.split(",")}if(!e.post__in){e.uploadedTo=f.id}g=_.omit(f,"id","ids","include","exclude","orderby","order");i=wp.media.query(e);i.gallery=new Backbone.Model(g);return i},shortcode:function(d){var f=d.props.toJSON(),e=_.pick(f,"orderby","order"),g,h;if(d.gallery){_.extend(e,d.gallery.toJSON())}e.ids=d.pluck("id");if(f.uploadedTo){e.id=f.uploadedTo}if(e._orderbyRandom){e.orderby="rand"}delete e._orderbyRandom;if(e.ids&&"post__in"===e.orderby){delete e.orderby}_.each(wp.media.gallery.defaults,function(j,i){if(j===e[i]){delete e[i]}});g=new wp.shortcode({tag:"gallery",attrs:e,type:"single"});h=new wp.media.model.Attachments(d.models,{props:f});h.gallery=d.gallery;c[g.string()]=h;return g},edit:function(g){var f=wp.shortcode.next("gallery",g),h=wp.media.gallery.defaults.id,d,e;if(!f||f.content!==g){return}f=f.shortcode;if(_.isUndefined(f.get("id"))&&!_.isUndefined(h)){f.set("id",h)}d=wp.media.gallery.attachments(f);e=new wp.media.model.Selection(d.models,{props:d.props.toJSON(),multiple:true});e.gallery=d.gallery;e.more().done(function(){e.props.set({query:false});e.unmirror();e.props.unset("orderby")});if(this.frame){this.frame.dispose()}this.frame=wp.media({frame:"post",state:"gallery-edit",title:wp.media.view.l10n.editGalleryTitle,editing:true,multiple:true,selection:e}).open();return this.frame}}}());wp.media.featuredImage={get:function(){return wp.media.view.settings.post.featuredImageId},set:function(d){var c=wp.media.view.settings;c.post.featuredImageId=d;wp.media.post("set-post-thumbnail",{json:true,post_id:c.post.id,thumbnail_id:c.post.featuredImageId,_wpnonce:c.post.nonce}).done(function(e){b(".inside","#postimagediv").html(e)})},frame:function(){if(this._frame){return this._frame}this._frame=wp.media({state:"featured-image",states:[new wp.media.controller.FeaturedImage()]});this._frame.on("toolbar:create:featured-image",function(c){this.createSelectToolbar(c,{text:wp.media.view.l10n.setFeaturedImage})},this._frame);this._frame.state("featured-image").on("select",this.select);return this._frame},select:function(){var d=wp.media.view.settings,c=this.get("selection").single();if(!d.post.featuredImageId){return}wp.media.featuredImage.set(c?c.id:-1)},init:function(){b("#postimagediv").on("click","#set-post-thumbnail",function(c){c.preventDefault();c.stopPropagation();wp.media.featuredImage.frame().open()}).on("click","#remove-post-thumbnail",function(){wp.media.view.settings.post.featuredImageId=-1})}};b(wp.media.featuredImage.init);wp.media.editor={insert:function(g){var d=typeof(tinymce)!="undefined",j=typeof(QTags)!="undefined",c=window.wpActiveEditor,f;if(window.send_to_editor){return window.send_to_editor.apply(this,arguments)}if(!c){if(d&&tinymce.activeEditor){f=tinymce.activeEditor;c=window.wpActiveEditor=f.id}else{if(!j){return false}}}else{if(d){if(tinymce.activeEditor&&(tinymce.activeEditor.id=="mce_fullscreen"||tinymce.activeEditor.id=="wp_mce_fullscreen")){f=tinymce.activeEditor}else{f=tinymce.get(c)}}}if(f&&!f.isHidden()){if(tinymce.isIE&&f.windowManager.insertimagebookmark){f.selection.moveToBookmark(f.windowManager.insertimagebookmark)}if(g.indexOf("[caption")!==-1){if(f.wpSetImgCaption){g=f.wpSetImgCaption(g)}}else{if(g.indexOf("[gallery")!==-1){if(f.plugins.wpgallery){g=f.plugins.wpgallery._do_gallery(g)}}else{if(g.indexOf("[embed")===0){if(f.plugins.wordpress){g=f.plugins.wordpress._setEmbed(g)}}}}f.execCommand("mceInsertContent",false,g)}else{if(j){QTags.insertContent(g)}else{document.getElementById(c).value+=g}}if(window.tb_remove){try{window.tb_remove()}catch(i){}}},add:function(e,c){var d=this.get(e);if(d){return d}d=a[e]=wp.media(_.defaults(c||{},{frame:"post",state:"insert",title:wp.media.view.l10n.addMedia,multiple:true}));d.on("insert",function(f){var g=d.state();f=f||g.get("selection");if(!f){return}b.when.apply(b,f.map(function(i){var h=g.display(i).toJSON();return this.send.attachment(h,i.toJSON())},this)).done(function(){wp.media.editor.insert(_.toArray(arguments).join("\n\n"))})},this);d.state("gallery-edit").on("update",function(f){this.insert(wp.media.gallery.shortcode(f).string())},this);d.state("embed").on("select",function(){var g=d.state(),f=g.get("type"),h=g.props.toJSON();h.url=h.url||"";if("link"===f){_.defaults(h,{title:h.url,linkUrl:h.url});this.send.link(h).done(function(i){wp.media.editor.insert(i)})}else{if("image"===f){_.defaults(h,{title:h.url,linkUrl:"",align:"none",link:"none"});if("none"===h.link){h.linkUrl=""}else{if("file"===h.link){h.linkUrl=h.url}}this.insert(wp.media.string.image(h))}}},this);d.state("featured-image").on("select",wp.media.featuredImage.select);d.setState(d.options.state);return d},id:function(c){if(c){return c}c=wpActiveEditor;if(!c&&typeof tinymce!=="undefined"&&tinymce.activeEditor){c=tinymce.activeEditor.id}c=c||"";return c},get:function(c){c=this.id(c);return a[c]},remove:function(c){c=this.id(c);delete a[c]},send:{attachment:function(f,g){var c=g.caption,d,e;if(!wp.media.view.settings.captions){delete g.caption}f=wp.media.string.props(f,g);d={id:g.id,post_content:g.description,post_excerpt:c};if(f.linkUrl){d.url=f.linkUrl}if("image"===g.type){e=wp.media.string.image(f);_.each({align:"align",size:"image-size",alt:"image_alt"},function(h,i){if(f[i]){d[h]=f[i]}})}else{e=wp.media.string.link(f);d.post_title=f.title}return wp.media.post("send-attachment-to-editor",{nonce:wp.media.view.settings.nonce.sendToEditor,attachment:d,html:e,post_id:wp.media.view.settings.post.id})},link:function(c){return wp.media.post("send-link-to-editor",{nonce:wp.media.view.settings.nonce.sendToEditor,src:c.linkUrl,title:c.title,html:wp.media.string.link(c),post_id:wp.media.view.settings.post.id})}},open:function(e){var d,c;e=this.id(e);if(typeof tinymce!=="undefined"){c=tinymce.get(e);if(tinymce.isIE&&c&&!c.isHidden()){c.focus();c.windowManager.insertimagebookmark=c.selection.getBookmark()}}d=this.get(e);if(!d){d=this.add(e)}return d.open()},init:function(){b(document.body).on("click",".insert-media",function(d){var e=b(this),c=e.data("editor");d.preventDefault();e.blur();wp.media.editor.open(c)})}};_.bindAll(wp.media.editor,"open");b(wp.media.editor.init)}(jQuery)); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/media-models.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/media-models.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/media-models.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/media-models.js 2012-12-05 23:06:49.000000000 -0600 *************** *** 0 **** --- 1,908 ---- + window.wp = window.wp || {}; + + (function($){ + var Attachment, Attachments, Query, compare, l10n, media; + + /** + * wp.media( attributes ) + * + * Handles the default media experience. Automatically creates + * and opens a media frame, and returns the result. + * Does nothing if the controllers do not exist. + * + * @param {object} attributes The properties passed to the main media controller. + * @return {object} A media workflow. + */ + media = wp.media = function( attributes ) { + var MediaFrame = media.view.MediaFrame, + frame; + + if ( ! MediaFrame ) + return; + + attributes = _.defaults( attributes || {}, { + frame: 'select' + }); + + if ( 'select' === attributes.frame && MediaFrame.Select ) + frame = new MediaFrame.Select( attributes ); + else if ( 'post' === attributes.frame && MediaFrame.Post ) + frame = new MediaFrame.Post( attributes ); + + delete attributes.frame; + + return frame; + }; + + _.extend( media, { model: {}, view: {}, controller: {}, frames: {} }); + + // Link any localized strings. + l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n; + + // Link any settings. + media.model.settings = l10n.settings || {}; + delete l10n.settings; + + /** + * ======================================================================== + * UTILITIES + * ======================================================================== + */ + + /** + * A basic comparator. + * + * @param {mixed} a The primary parameter to compare. + * @param {mixed} b The primary parameter to compare. + * @param {string} ac The fallback parameter to compare, a's cid. + * @param {string} bc The fallback parameter to compare, b's cid. + * @return {number} -1: a should come before b. + * 0: a and b are of the same rank. + * 1: b should come before a. + */ + compare = function( a, b, ac, bc ) { + if ( _.isEqual( a, b ) ) + return ac === bc ? 0 : (ac > bc ? -1 : 1); + else + return a > b ? -1 : 1; + }; + + _.extend( media, { + /** + * media.template( id ) + * + * Fetches a template by id. + * + * @param {string} id A string that corresponds to a DOM element with an id prefixed with "tmpl-". + * For example, "attachment" maps to "tmpl-attachment". + * @return {function} A function that lazily-compiles the template requested. + */ + template: _.memoize( function( id ) { + var compiled, + options = { + evaluate: /<#([\s\S]+?)#>/g, + interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, + escape: /\{\{([^\}]+?)\}\}(?!\})/g, + variable: 'data' + }; + + return function( data ) { + compiled = compiled || _.template( $( '#tmpl-' + id ).html(), null, options ); + return compiled( data ); + }; + }), + + /** + * media.post( [action], [data] ) + * + * Sends a POST request to WordPress. + * + * @param {string} action The slug of the action to fire in WordPress. + * @param {object} data The data to populate $_POST with. + * @return {$.promise} A jQuery promise that represents the request. + */ + post: function( action, data ) { + return media.ajax({ + data: _.isObject( action ) ? action : _.extend( data || {}, { action: action }) + }); + }, + + /** + * media.ajax( [action], [options] ) + * + * Sends a POST request to WordPress. + * + * @param {string} action The slug of the action to fire in WordPress. + * @param {object} options The options passed to jQuery.ajax. + * @return {$.promise} A jQuery promise that represents the request. + */ + ajax: function( action, options ) { + if ( _.isObject( action ) ) { + options = action; + } else { + options = options || {}; + options.data = _.extend( options.data || {}, { action: action }); + } + + options = _.defaults( options || {}, { + type: 'POST', + url: media.model.settings.ajaxurl, + context: this + }); + + return $.Deferred( function( deferred ) { + // Transfer success/error callbacks. + if ( options.success ) + deferred.done( options.success ); + if ( options.error ) + deferred.fail( options.error ); + + delete options.success; + delete options.error; + + // Use with PHP's wp_send_json_success() and wp_send_json_error() + $.ajax( options ).done( function( response ) { + // Treat a response of `1` as successful for backwards + // compatibility with existing handlers. + if ( response === '1' || response === 1 ) + response = { success: true }; + + if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) + deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] ); + else + deferred.rejectWith( this, [response] ); + }).fail( function() { + deferred.rejectWith( this, arguments ); + }); + }).promise(); + }, + + // Scales a set of dimensions to fit within bounding dimensions. + fit: function( dimensions ) { + var width = dimensions.width, + height = dimensions.height, + maxWidth = dimensions.maxWidth, + maxHeight = dimensions.maxHeight, + constraint; + + // Compare ratios between the two values to determine which + // max to constrain by. If a max value doesn't exist, then the + // opposite side is the constraint. + if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) { + constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height'; + } else if ( _.isUndefined( maxHeight ) ) { + constraint = 'width'; + } else if ( _.isUndefined( maxWidth ) && height > maxHeight ) { + constraint = 'height'; + } + + // If the value of the constrained side is larger than the max, + // then scale the values. Otherwise return the originals; they fit. + if ( 'width' === constraint && width > maxWidth ) { + return { + width : maxWidth, + height: Math.round( maxWidth * height / width ) + }; + } else if ( 'height' === constraint && height > maxHeight ) { + return { + width : Math.round( maxHeight * width / height ), + height: maxHeight + }; + } else { + return { + width : width, + height: height + }; + } + }, + + // Truncates a string by injecting an ellipsis into the middle. + // Useful for filenames. + truncate: function( string, length, replacement ) { + length = length || 30; + replacement = replacement || '…'; + + if ( string.length <= length ) + return string; + + return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 ); + } + }); + + + /** + * ======================================================================== + * MODELS + * ======================================================================== + */ + + /** + * wp.media.attachment + */ + media.attachment = function( id ) { + return Attachment.get( id ); + }; + + /** + * wp.media.model.Attachment + */ + Attachment = media.model.Attachment = Backbone.Model.extend({ + sync: function( method, model, options ) { + // If the attachment does not yet have an `id`, return an instantly + // rejected promise. Otherwise, all of our requests will fail. + if ( _.isUndefined( this.id ) ) + return $.Deferred().rejectWith( this ).promise(); + + // Overload the `read` request so Attachment.fetch() functions correctly. + if ( 'read' === method ) { + options = options || {}; + options.context = this; + options.data = _.extend( options.data || {}, { + action: 'get-attachment', + id: this.id + }); + return media.ajax( options ); + + // Overload the `update` request so properties can be saved. + } else if ( 'update' === method ) { + // If we do not have the necessary nonce, fail immeditately. + if ( ! this.get('nonces') || ! this.get('nonces').update ) + return $.Deferred().rejectWith( this ).promise(); + + options = options || {}; + options.context = this; + + // Set the action and ID. + options.data = _.extend( options.data || {}, { + action: 'save-attachment', + id: this.id, + nonce: this.get('nonces').update, + post_id: media.model.settings.post.id + }); + + // Record the values of the changed attributes. + if ( options.changes ) { + _.each( options.changes, function( value, key ) { + options.changes[ key ] = this.get( key ); + }, this ); + + options.data.changes = options.changes; + delete options.changes; + } + + return media.ajax( options ); + + // Overload the `delete` request so attachments can be removed. + // This will permanently delete an attachment. + } else if ( 'delete' === method ) { + options = options || {}; + + if ( ! options.wait ) + this.destroyed = true; + + options.context = this; + options.data = _.extend( options.data || {}, { + action: 'delete-post', + id: this.id, + _wpnonce: this.get('nonces')['delete'] + }); + + return media.ajax( options ).done( function() { + this.destroyed = true; + }).fail( function() { + this.destroyed = false; + }); + } + }, + + parse: function( resp, xhr ) { + if ( ! resp ) + return resp; + + // Convert date strings into Date objects. + resp.date = new Date( resp.date ); + resp.modified = new Date( resp.modified ); + return resp; + }, + + saveCompat: function( data, options ) { + var model = this; + + // If we do not have the necessary nonce, fail immeditately. + if ( ! this.get('nonces') || ! this.get('nonces').update ) + return $.Deferred().rejectWith( this ).promise(); + + return media.post( 'save-attachment-compat', _.defaults({ + id: this.id, + nonce: this.get('nonces').update, + post_id: media.model.settings.post.id + }, data ) ).done( function( resp, status, xhr ) { + model.set( model.parse( resp, xhr ), options ); + }); + } + }, { + create: function( attrs ) { + return Attachments.all.push( attrs ); + }, + + get: _.memoize( function( id, attachment ) { + return Attachments.all.push( attachment || { id: id } ); + }) + }); + + /** + * wp.media.model.Attachments + */ + Attachments = media.model.Attachments = Backbone.Collection.extend({ + model: Attachment, + + initialize: function( models, options ) { + options = options || {}; + + this.props = new Backbone.Model(); + this.filters = options.filters || {}; + + // Bind default `change` events to the `props` model. + this.props.on( 'change', this._changeFilteredProps, this ); + + this.props.on( 'change:order', this._changeOrder, this ); + this.props.on( 'change:orderby', this._changeOrderby, this ); + this.props.on( 'change:query', this._changeQuery, this ); + + // Set the `props` model and fill the default property values. + this.props.set( _.defaults( options.props || {} ) ); + + // Observe another `Attachments` collection if one is provided. + if ( options.observe ) + this.observe( options.observe ); + }, + + // Automatically sort the collection when the order changes. + _changeOrder: function( model, order ) { + if ( this.comparator ) + this.sort(); + }, + + // Set the default comparator only when the `orderby` property is set. + _changeOrderby: function( model, orderby ) { + // If a different comparator is defined, bail. + if ( this.comparator && this.comparator !== Attachments.comparator ) + return; + + if ( orderby && 'post__in' !== orderby ) + this.comparator = Attachments.comparator; + else + delete this.comparator; + }, + + // If the `query` property is set to true, query the server using + // the `props` values, and sync the results to this collection. + _changeQuery: function( model, query ) { + if ( query ) { + this.props.on( 'change', this._requery, this ); + this._requery(); + } else { + this.props.off( 'change', this._requery, this ); + } + }, + + _changeFilteredProps: function( model, options ) { + // If this is a query, updating the collection will be handled by + // `this._requery()`. + if ( this.props.get('query') ) + return; + + var changed = _.chain( options.changes ).map( function( t, prop ) { + var filter = Attachments.filters[ prop ], + term = model.get( prop ); + + if ( ! filter ) + return; + + if ( term && ! this.filters[ prop ] ) + this.filters[ prop ] = filter; + else if ( ! term && this.filters[ prop ] === filter ) + delete this.filters[ prop ]; + else + return; + + // Record the change. + return true; + }, this ).any().value(); + + if ( ! changed ) + return; + + // If no `Attachments` model is provided to source the searches + // from, then automatically generate a source from the existing + // models. + if ( ! this._source ) + this._source = new Attachments( this.models ); + + this.reset( this._source.filter( this.validator, this ) ); + }, + + validateDestroyed: false, + + validator: function( attachment ) { + if ( ! this.validateDestroyed && attachment.destroyed ) + return false; + return _.all( this.filters, function( filter, key ) { + return !! filter.call( this, attachment ); + }, this ); + }, + + validate: function( attachment, options ) { + var valid = this.validator( attachment ), + hasAttachment = !! this.getByCid( attachment.cid ); + + if ( ! valid && hasAttachment ) + this.remove( attachment, options ); + else if ( valid && ! hasAttachment ) + this.add( attachment, options ); + + return this; + }, + + validateAll: function( attachments, options ) { + options = options || {}; + + _.each( attachments.models, function( attachment ) { + this.validate( attachment, { silent: true }); + }, this ); + + if ( ! options.silent ) + this.trigger( 'reset', this, options ); + + return this; + }, + + observe: function( attachments ) { + this.observers = this.observers || []; + this.observers.push( attachments ); + + attachments.on( 'add change remove', this._validateHandler, this ); + attachments.on( 'reset', this._validateAllHandler, this ); + + this.validateAll( attachments ); + return this; + }, + + unobserve: function( attachments ) { + if ( attachments ) { + attachments.off( null, null, this ); + this.observers = _.without( this.observers, attachments ); + + } else { + _.each( this.observers, function( attachments ) { + attachments.off( null, null, this ); + }, this ); + delete this.observers; + } + + return this; + }, + + _validateHandler: function( attachment, attachments, options ) { + // If we're not mirroring this `attachments` collection, + // only retain the `silent` option. + options = attachments === this.mirroring ? options : { + silent: options && options.silent + }; + + return this.validate( attachment, options ); + }, + + _validateAllHandler: function( attachments, options ) { + return this.validateAll( attachments, options ); + }, + + mirror: function( attachments ) { + if ( this.mirroring && this.mirroring === attachments ) + return this; + + this.unmirror(); + this.mirroring = attachments; + + // Clear the collection silently. A `reset` event will be fired + // when `observe()` calls `validateAll()`. + this.reset( [], { silent: true } ); + this.observe( attachments ); + + return this; + }, + + unmirror: function() { + if ( ! this.mirroring ) + return; + + this.unobserve( this.mirroring ); + delete this.mirroring; + }, + + more: function( options ) { + var deferred = $.Deferred(), + mirroring = this.mirroring, + attachments = this; + + if ( ! mirroring || ! mirroring.more ) + return deferred.resolveWith( this ).promise(); + + // If we're mirroring another collection, forward `more` to + // the mirrored collection. Account for a race condition by + // checking if we're still mirroring that collection when + // the request resolves. + mirroring.more( options ).done( function() { + if ( this === attachments.mirroring ) + deferred.resolveWith( this ); + }); + + return deferred.promise(); + }, + + hasMore: function() { + return this.mirroring ? this.mirroring.hasMore() : false; + }, + + parse: function( resp, xhr ) { + return _.map( resp, function( attrs ) { + var attachment = Attachment.get( attrs.id ); + return attachment.set( attachment.parse( attrs, xhr ) ); + }); + }, + + _requery: function() { + if ( this.props.get('query') ) + this.mirror( Query.get( this.props.toJSON() ) ); + }, + + // If this collection is sorted by `menuOrder`, recalculates and saves + // the menu order to the database. + saveMenuOrder: function() { + if ( 'menuOrder' !== this.props.get('orderby') ) + return; + + // Removes any uploading attachments, updates each attachment's + // menu order, and returns an object with an { id: menuOrder } + // mapping to pass to the request. + var attachments = this.chain().filter( function( attachment ) { + return ! _.isUndefined( attachment.id ); + }).map( function( attachment, index ) { + // Indices start at 1. + index = index + 1; + attachment.set( 'menuOrder', index ); + return [ attachment.id, index ]; + }).object().value(); + + if ( _.isEmpty( attachments ) ) + return; + + return media.post( 'save-attachment-order', { + nonce: media.model.settings.post.nonce, + post_id: media.model.settings.post.id, + attachments: attachments + }); + } + }, { + comparator: function( a, b, options ) { + var key = this.props.get('orderby'), + order = this.props.get('order') || 'DESC', + ac = a.cid, + bc = b.cid; + + a = a.get( key ); + b = b.get( key ); + + if ( 'date' === key || 'modified' === key ) { + a = a || new Date(); + b = b || new Date(); + } + + // If `options.ties` is set, don't enforce the `cid` tiebreaker. + if ( options && options.ties ) + ac = bc = null; + + return ( 'DESC' === order ) ? compare( a, b, ac, bc ) : compare( b, a, bc, ac ); + }, + + filters: { + // Note that this client-side searching is *not* equivalent + // to our server-side searching. + search: function( attachment ) { + if ( ! this.props.get('search') ) + return true; + + return _.any(['title','filename','description','caption','name'], function( key ) { + var value = attachment.get( key ); + return value && -1 !== value.search( this.props.get('search') ); + }, this ); + }, + + type: function( attachment ) { + var type = this.props.get('type'); + return ! type || -1 !== type.indexOf( attachment.get('type') ); + }, + + uploadedTo: function( attachment ) { + var uploadedTo = this.props.get('uploadedTo'); + if ( _.isUndefined( uploadedTo ) ) + return true; + + return uploadedTo === attachment.get('uploadedTo'); + } + } + }); + + Attachments.all = new Attachments(); + + /** + * wp.media.query + */ + media.query = function( props ) { + return new Attachments( null, { + props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } ) + }); + }; + + /** + * wp.media.model.Query + * + * A set of attachments that corresponds to a set of consecutively paged + * queries on the server. + * + * Note: Do NOT change this.args after the query has been initialized. + * Things will break. + */ + Query = media.model.Query = Attachments.extend({ + initialize: function( models, options ) { + var allowed; + + options = options || {}; + Attachments.prototype.initialize.apply( this, arguments ); + + this.args = options.args; + this._hasMore = true; + this.created = new Date(); + + this.filters.order = function( attachment ) { + var orderby = this.props.get('orderby'), + order = this.props.get('order'); + + if ( ! this.comparator ) + return true; + + // We want any items that can be placed before the last + // item in the set. If we add any items after the last + // item, then we can't guarantee the set is complete. + if ( this.length ) { + return 1 !== this.comparator( attachment, this.last(), { ties: true }); + + // Handle the case where there are no items yet and + // we're sorting for recent items. In that case, we want + // changes that occurred after we created the query. + } else if ( 'DESC' === order && ( 'date' === orderby || 'modified' === orderby ) ) { + return attachment.get( orderby ) >= this.created; + + // If we're sorting by menu order and we have no items, + // accept any items that have the default menu order (0). + } else if ( 'ASC' === order && 'menuOrder' === orderby ) { + return attachment.get( orderby ) === 0; + } + + // Otherwise, we don't want any items yet. + return false; + }; + + // Observe the central `wp.Uploader.queue` collection to watch for + // new matches for the query. + // + // Only observe when a limited number of query args are set. There + // are no filters for other properties, so observing will result in + // false positives in those queries. + allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent' ]; + if ( wp.Uploader && _( this.args ).chain().keys().difference( allowed ).isEmpty().value() ) + this.observe( wp.Uploader.queue ); + }, + + hasMore: function() { + return this._hasMore; + }, + + more: function( options ) { + var query = this; + + if ( this._more && 'pending' === this._more.state() ) + return this._more; + + if ( ! this.hasMore() ) + return $.Deferred().resolveWith( this ).promise(); + + options = options || {}; + options.add = true; + + return this._more = this.fetch( options ).done( function( resp ) { + if ( _.isEmpty( resp ) || -1 === this.args.posts_per_page || resp.length < this.args.posts_per_page ) + query._hasMore = false; + }); + }, + + sync: function( method, model, options ) { + var fallback; + + // Overload the read method so Attachment.fetch() functions correctly. + if ( 'read' === method ) { + options = options || {}; + options.context = this; + options.data = _.extend( options.data || {}, { + action: 'query-attachments', + post_id: media.model.settings.post.id + }); + + // Clone the args so manipulation is non-destructive. + args = _.clone( this.args ); + + // Determine which page to query. + if ( -1 !== args.posts_per_page ) + args.paged = Math.floor( this.length / args.posts_per_page ) + 1; + + options.data.query = args; + return media.ajax( options ); + + // Otherwise, fall back to Backbone.sync() + } else { + fallback = Attachments.prototype.sync ? Attachments.prototype : Backbone; + return fallback.sync.apply( this, arguments ); + } + } + }, { + defaultProps: { + orderby: 'date', + order: 'DESC' + }, + + defaultArgs: { + posts_per_page: 40 + }, + + orderby: { + allowed: [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ], + valuemap: { + 'id': 'ID', + 'uploadedTo': 'parent', + 'menuOrder': 'menu_order ID' + } + }, + + propmap: { + 'search': 's', + 'type': 'post_mime_type', + 'perPage': 'posts_per_page', + 'menuOrder': 'menu_order', + 'uploadedTo': 'post_parent' + }, + + // Caches query objects so queries can be easily reused. + get: (function(){ + var queries = []; + + return function( props, options ) { + var args = {}, + orderby = Query.orderby, + defaults = Query.defaultProps, + query; + + // Remove the `query` property. This isn't linked to a query, + // this *is* the query. + delete props.query; + + // Fill default args. + _.defaults( props, defaults ); + + // Normalize the order. + props.order = props.order.toUpperCase(); + if ( 'DESC' !== props.order && 'ASC' !== props.order ) + props.order = defaults.order.toUpperCase(); + + // Ensure we have a valid orderby value. + if ( ! _.contains( orderby.allowed, props.orderby ) ) + props.orderby = defaults.orderby; + + // Generate the query `args` object. + // Correct any differing property names. + _.each( props, function( value, prop ) { + if ( _.isNull( value ) ) + return; + + args[ Query.propmap[ prop ] || prop ] = value; + }); + + // Fill any other default query args. + _.defaults( args, Query.defaultArgs ); + + // `props.orderby` does not always map directly to `args.orderby`. + // Substitute exceptions specified in orderby.keymap. + args.orderby = orderby.valuemap[ props.orderby ] || props.orderby; + + // Search the query cache for matches. + query = _.find( queries, function( query ) { + return _.isEqual( query.args, args ); + }); + + // Otherwise, create a new query and add it to the cache. + if ( ! query ) { + query = new Query( [], _.extend( options || {}, { + props: props, + args: args + } ) ); + queries.push( query ); + } + + return query; + }; + }()) + }); + + /** + * wp.media.model.Selection + * + * Used to manage a selection of attachments in the views. + */ + media.model.Selection = Attachments.extend({ + initialize: function( models, options ) { + Attachments.prototype.initialize.apply( this, arguments ); + this.multiple = options && options.multiple; + + // Refresh the `single` model whenever the selection changes. + // Binds `single` instead of using the context argument to ensure + // it receives no parameters. + this.on( 'add remove reset', _.bind( this.single, this, false ) ); + }, + + // Override the selection's add method. + // If the workflow does not support multiple + // selected attachments, reset the selection. + add: function( models, options ) { + if ( ! this.multiple ) + this.remove( this.models ); + + return Attachments.prototype.add.call( this, models, options ); + }, + + single: function( model ) { + var previous = this._single; + + // If a `model` is provided, use it as the single model. + if ( model ) + this._single = model; + + // If the single model isn't in the selection, remove it. + if ( this._single && ! this.getByCid( this._single.cid ) ) + delete this._single; + + this._single = this._single || this.last(); + + // If single has changed, fire an event. + if ( this._single !== previous ) { + if ( previous ) { + previous.trigger( 'selection:unsingle', previous, this ); + + // If the model was already removed, trigger the collection + // event manually. + if ( ! this.getByCid( previous.cid ) ) + this.trigger( 'selection:unsingle', previous, this ); + } + if ( this._single ) + this._single.trigger( 'selection:single', this._single, this ); + } + + // Return the single model, or the last model as a fallback. + return this._single; + } + }); + + // Clean up. Prevents mobile browsers caching + $(window).on('unload', function(){ + window.wp = null; + }); + + }(jQuery)); \ No newline at end of file diff -crBPN --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=advanced-cache.php --exclude=wp-cache-config.php --exclude=wordpress.sql --exclude=wp-config.php --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.5.pl /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/media-models.min.js /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/media-models.min.js *** /home/packages/code/qi/SOURCES/wordpress-3.4.2/wp-includes/js/media-models.min.js 1969-12-31 17:00:00.000000000 -0700 --- /home/packages/code/qi/SOURCES/wordpress-3.5/wp-includes/js/media-models.min.js 2012-12-05 23:26:39.000000000 -0600 *************** *** 0 **** --- 1 ---- + window.wp=window.wp||{};(function(f){var d,c,a,e,b,g;g=wp.media=function(h){var i=g.view.MediaFrame,j;if(!i){return}h=_.defaults(h||{},{frame:"select"});if("select"===h.frame&&i.Select){j=new i.Select(h)}else{if("post"===h.frame&&i.Post){j=new i.Post(h)}}delete h.frame;return j};_.extend(g,{model:{},view:{},controller:{},frames:{}});b=g.model.l10n=typeof _wpMediaModelsL10n==="undefined"?{}:_wpMediaModelsL10n;g.model.settings=b.settings||{};delete b.settings;e=function(i,h,j,k){if(_.isEqual(i,h)){return j===k?0:(j>k?-1:1)}else{return i>h?-1:1}};_.extend(g,{template:_.memoize(function(j){var i,h={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(k){i=i||_.template(f("#tmpl-"+j).html(),null,h);return i(k)}}),post:function(i,h){return g.ajax({data:_.isObject(i)?i:_.extend(h||{},{action:i})})},ajax:function(i,h){if(_.isObject(i)){h=i}else{h=h||{};h.data=_.extend(h.data||{},{action:i})}h=_.defaults(h||{},{type:"POST",url:g.model.settings.ajaxurl,context:this});return f.Deferred(function(j){if(h.success){j.done(h.success)}if(h.error){j.fail(h.error)}delete h.success;delete h.error;f.ajax(h).done(function(k){if(k==="1"||k===1){k={success:true}}if(_.isObject(k)&&!_.isUndefined(k.success)){j[k.success?"resolveWith":"rejectWith"](this,[k.data])}else{j.rejectWith(this,[k])}}).fail(function(){j.rejectWith(this,arguments)})}).promise()},fit:function(l){var i=l.width,h=l.height,k=l.maxWidth,j=l.maxHeight,m;if(!_.isUndefined(k)&&!_.isUndefined(j)){m=(i/h>k/j)?"width":"height"}else{if(_.isUndefined(j)){m="width"}else{if(_.isUndefined(k)&&h>j){m="height"}}}if("width"===m&&i>k){return{width:k,height:Math.round(k*h/i)}}else{if("height"===m&&h>j){return{width:Math.round(j*i/h),height:j}}else{return{width:i,height:h}}}},truncate:function(h,j,i){j=j||30;i=i||"…";if(h.length<=j){return h}return h.substr(0,j/2)+i+h.substr(-1*j/2)}});g.attachment=function(h){return d.get(h)};d=g.model.Attachment=Backbone.Model.extend({sync:function(j,i,h){if(_.isUndefined(this.id)){return f.Deferred().rejectWith(this).promise()}if("read"===j){h=h||{};h.context=this;h.data=_.extend(h.data||{},{action:"get-attachment",id:this.id});return g.ajax(h)}else{if("update"===j){if(!this.get("nonces")||!this.get("nonces").update){return f.Deferred().rejectWith(this).promise()}h=h||{};h.context=this;h.data=_.extend(h.data||{},{action:"save-attachment",id:this.id,nonce:this.get("nonces").update,post_id:g.model.settings.post.id});if(h.changes){_.each(h.changes,function(l,k){h.changes[k]=this.get(k)},this);h.data.changes=h.changes;delete h.changes}return g.ajax(h)}else{if("delete"===j){h=h||{};if(!h.wait){this.destroyed=true}h.context=this;h.data=_.extend(h.data||{},{action:"delete-post",id:this.id,_wpnonce:this.get("nonces")["delete"]});return g.ajax(h).done(function(){this.destroyed=true}).fail(function(){this.destroyed=false})}}}},parse:function(i,h){if(!i){return i}i.date=new Date(i.date);i.modified=new Date(i.modified);return i},saveCompat:function(j,i){var h=this;if(!this.get("nonces")||!this.get("nonces").update){return f.Deferred().rejectWith(this).promise()}return g.post("save-attachment-compat",_.defaults({id:this.id,nonce:this.get("nonces").update,post_id:g.model.settings.post.id},j)).done(function(m,k,l){h.set(h.parse(m,l),i)})}},{create:function(h){return c.all.push(h)},get:_.memoize(function(i,h){return c.all.push(h||{id:i})})});c=g.model.Attachments=Backbone.Collection.extend({model:d,initialize:function(i,h){h=h||{};this.props=new Backbone.Model();this.filters=h.filters||{};this.props.on("change",this._changeFilteredProps,this);this.props.on("change:order",this._changeOrder,this);this.props.on("change:orderby",this._changeOrderby,this);this.props.on("change:query",this._changeQuery,this);this.props.set(_.defaults(h.props||{}));if(h.observe){this.observe(h.observe)}},_changeOrder:function(i,h){if(this.comparator){this.sort()}},_changeOrderby:function(h,i){if(this.comparator&&this.comparator!==c.comparator){return}if(i&&"post__in"!==i){this.comparator=c.comparator}else{delete this.comparator}},_changeQuery:function(h,i){if(i){this.props.on("change",this._requery,this);this._requery()}else{this.props.off("change",this._requery,this)}},_changeFilteredProps:function(i,h){if(this.props.get("query")){return}var j=_.chain(h.changes).map(function(l,n){var m=c.filters[n],k=i.get(n);if(!m){return}if(k&&!this.filters[n]){this.filters[n]=m}else{if(!k&&this.filters[n]===m){delete this.filters[n]}else{return}}return true},this).any().value();if(!j){return}if(!this._source){this._source=new c(this.models)}this.reset(this._source.filter(this.validator,this))},validateDestroyed:false,validator:function(h){if(!this.validateDestroyed&&h.destroyed){return false}return _.all(this.filters,function(j,i){return !!j.call(this,h)},this)},validate:function(k,i){var j=this.validator(k),h=!!this.getByCid(k.cid);if(!j&&h){this.remove(k,i)}else{if(j&&!h){this.add(k,i)}}return this},validateAll:function(h,i){i=i||{};_.each(h.models,function(j){this.validate(j,{silent:true})},this);if(!i.silent){this.trigger("reset",this,i)}return this},observe:function(h){this.observers=this.observers||[];this.observers.push(h);h.on("add change remove",this._validateHandler,this);h.on("reset",this._validateAllHandler,this);this.validateAll(h);return this},unobserve:function(h){if(h){h.off(null,null,this);this.observers=_.without(this.observers,h)}else{_.each(this.observers,function(i){i.off(null,null,this)},this);delete this.observers}return this},_validateHandler:function(j,h,i){i=h===this.mirroring?i:{silent:i&&i.silent};return this.validate(j,i)},_validateAllHandler:function(h,i){return this.validateAll(h,i)},mirror:function(h){if(this.mirroring&&this.mirroring===h){return this}this.unmirror();this.mirroring=h;this.reset([],{silent:true});this.observe(h);return this},unmirror:function(){if(!this.mirroring){return}this.unobserve(this.mirroring);delete this.mirroring},more:function(j){var i=f.Deferred(),k=this.mirroring,h=this;if(!k||!k.more){return i.resolveWith(this).promise()}k.more(j).done(function(){if(this===h.mirroring){i.resolveWith(this)}});return i.promise()},hasMore:function(){return this.mirroring?this.mirroring.hasMore():false},parse:function(i,h){return _.map(i,function(j){var k=d.get(j.id);return k.set(k.parse(j,h))})},_requery:function(){if(this.props.get("query")){this.mirror(a.get(this.props.toJSON()))}},saveMenuOrder:function(){if("menuOrder"!==this.props.get("orderby")){return}var h=this.chain().filter(function(i){return !_.isUndefined(i.id)}).map(function(j,i){i=i+1;j.set("menuOrder",i);return[j.id,i]}).object().value();if(_.isEmpty(h)){return}return g.post("save-attachment-order",{nonce:g.model.settings.post.nonce,post_id:g.model.settings.post.id,attachments:h})}},{comparator:function(j,i,k){var l=this.props.get("orderby"),h=this.props.get("order")||"DESC",m=j.cid,n=i.cid;j=j.get(l);i=i.get(l);if("date"===l||"modified"===l){j=j||new Date();i=i||new Date()}if(k&&k.ties){m=n=null}return("DESC"===h)?e(j,i,m,n):e(i,j,n,m)},filters:{search:function(h){if(!this.props.get("search")){return true}return _.any(["title","filename","description","caption","name"],function(i){var j=h.get(i);return j&&-1!==j.search(this.props.get("search"))},this)},type:function(i){var h=this.props.get("type");return !h||-1!==h.indexOf(i.get("type"))},uploadedTo:function(i){var h=this.props.get("uploadedTo");if(_.isUndefined(h)){return true}return h===i.get("uploadedTo")}}});c.all=new c();g.query=function(h){return new c(null,{props:_.extend(_.defaults(h||{},{orderby:"date"}),{query:true})})};a=g.model.Query=c.extend({initialize:function(j,h){var i;h=h||{};c.prototype.initialize.apply(this,arguments);this.args=h.args;this._hasMore=true;this.created=new Date();this.filters.order=function(m){var l=this.props.get("orderby"),k=this.props.get("order");if(!this.comparator){return true}if(this.length){return 1!==this.comparator(m,this.last(),{ties:true})}else{if("DESC"===k&&("date"===l||"modified"===l)){return m.get(l)>=this.created}else{if("ASC"===k&&"menuOrder"===l){return m.get(l)===0}}}return false};i=["s","order","orderby","posts_per_page","post_mime_type","post_parent"];if(wp.Uploader&&_(this.args).chain().keys().difference(i).isEmpty().value()){this.observe(wp.Uploader.queue)}},hasMore:function(){return this._hasMore},more:function(h){var i=this;if(this._more&&"pending"===this._more.state()){return this._more}if(!this.hasMore()){return f.Deferred().resolveWith(this).promise()}h=h||{};h.add=true;return this._more=this.fetch(h).done(function(j){if(_.isEmpty(j)||-1===this.args.posts_per_page||j.length If `options.silent` is true, no DOM modifications will be made. + // + // `options.add` – *boolean, `false`* + // > Use `Views.add()` as a shortcut for setting `options.add` to true. + // + // > By default, the provided `views` will replace + // any existing views associated with the selector. If `options.add` + // is true, the provided `views` will be added to the existing views. + // + // `options.at` – *integer, `undefined`* + // > When adding, to insert `views` at a specific index, use + // `options.at`. By default, `views` are added to the end of the array. + set: function( selector, views, options ) { + var existing, next; + + if ( ! _.isString( selector ) ) { + options = views; + views = selector; + selector = ''; + } + + options = options || {}; + views = _.isArray( views ) ? views : [ views ]; + existing = this.get( selector ); + next = views; + + if ( existing ) { + if ( options.add ) { + if ( _.isUndefined( options.at ) ) { + next = existing.concat( views ); + } else { + next = existing; + next.splice.apply( next, [ options.at, 0 ].concat( views ) ); + } + } else { + _.each( next, function( view ) { + view.__detach = true; + }); + + _.each( existing, function( view ) { + if ( view.__detach ) + view.$el.detach(); + else + view.dispose(); + }); + + _.each( next, function( view ) { + delete view.__detach; + }); + } + } + + this._views[ selector ] = next; + + _.each( views, function( subview ) { + var constructor = subview.Views || media.Views, + subviews = subview.views = subview.views || new constructor( subview ); + subviews.parent = this.view; + subviews.selector = selector; + }, this ); + + if ( ! options.silent ) + this._attach( selector, views, _.extend({ ready: this._isReady() }, options ) ); + + return this; + }, + + // ### Add subview(s) to existing subviews + // + // An alias to `Views.set()`, which defaults `options.add` to true. + // + // Adds any number of `views` to a `selector`. + // + // When no `selector` is provided, the root selector (the empty string) + // is used. `views` accepts a `Backbone.View` instance or an array of + // `Backbone.View` instances. + // + // Use `Views.set()` when setting `options.add` to `false`. + // + // Accepts an `options` object. By default, provided `views` will be + // inserted at the end of the array of existing views. To insert + // `views` at a specific index, use `options.at`. If `options.silent` + // is true, no DOM modifications will be made. + // + // For more information on the `options` object, see `Views.set()`. + add: function( selector, views, options ) { + if ( ! _.isString( selector ) ) { + options = views; + views = selector; + selector = ''; + } + + return this.set( selector, views, _.extend({ add: true }, options ) ); + }, + + // ### Stop tracking subviews + // + // Stops tracking `views` registered to a `selector`. If no `views` are + // set, then all of the `selector`'s subviews will be unregistered and + // disposed. + // + // Accepts an `options` object. If `options.silent` is set, `dispose` + // will *not* be triggered on the unregistered views. + unset: function( selector, views, options ) { + var existing; + + if ( ! _.isString( selector ) ) { + options = views; + views = selector; + selector = ''; + } + + views = views || []; + + if ( existing = this.get( selector ) ) { + views = _.isArray( views ) ? views : [ views ]; + this._views[ selector ] = views.length ? _.difference( existing, views ) : []; + } + + if ( ! options || ! options.silent ) + _.invoke( views, 'dispose' ); + + return this; + }, + + // ### Detach all subviews + // + // Detaches all subviews from the DOM. + // + // Helps to preserve all subview events when re-rendering the master + // view. Used in conjunction with `Views.render()`. + detach: function() { + $( _.pluck( this.all(), 'el' ) ).detach(); + return this; + }, + + // ### Render all subviews + // + // Renders all subviews. Used in conjunction with `Views.detach()`. + render: function() { + var options = { + ready: this._isReady() + }; + + _.each( this._views, function( views, selector ) { + this._attach( selector, views, options ); + }, this ); + + this.rendered = true; + return this; + }, + + // ### Dispose all subviews + // + // Triggers the `dispose()` method on all subviews. Detaches the master + // view from its parent. Resets the internals of the views manager. + // + // Accepts an `options` object. If `options.silent` is set, `unset` + // will *not* be triggered on the master view's parent. + dispose: function( options ) { + if ( ! options || ! options.silent ) { + if ( this.parent && this.parent.views ) + this.parent.views.unset( this.selector, this.view, { silent: true }); + delete this.parent; + delete this.selector; + } + + _.invoke( this.all(), 'dispose' ); + this._views = []; + return this; + }, + + // ### Replace a selector's subviews + // + // By default, sets the `$target` selector's html to the subview `els`. + // + // Can be overridden in subclasses. + replace: function( $target, els ) { + $target.html( els ); + return this; + }, + + // ### Insert subviews into a selector + // + // By default, appends the subview `els` to the end of the `$target` + // selector. If `options.at` is set, inserts the subview `els` at the + // provided index. + // + // Can be overridden in subclasses. + insert: function( $target, els, options ) { + var at = options && options.at, + $children; + + if ( _.isNumber( at ) && ($children = $target.children()).length > at ) + $children.eq( at ).before( els ); + else + $target.append( els ); + + return this; + }, + + // ### Trigger the ready event + // + // **Only use this method if you know what you're doing.** + // For performance reasons, this method does not check if the view is + // actually attached to the DOM. It's taking your word for it. + // + // Fires the ready event on the current view and all attached subviews. + ready: function() { + this.view.trigger('ready'); + + // Find all attached subviews, and call ready on them. + _.chain( this.all() ).map( function( view ) { + return view.views; + }).flatten().where({ attached: true }).invoke('ready'); + }, + + // #### Internal. Attaches a series of views to a selector. + // + // Checks to see if a matching selector exists, renders the views, + // performs the proper DOM operation, and then checks if the view is + // attached to the document. + _attach: function( selector, views, options ) { + var $selector = selector ? this.view.$( selector ) : this.view.$el, + managers; + + // Check if we found a location to attach the views. + if ( ! $selector.length ) + return this; + + managers = _.chain( views ).pluck('views').flatten().value(); + + // Render the views if necessary. + _.each( managers, function( manager ) { + if ( manager.rendered ) + return; + + manager.view.render(); + manager.rendered = true; + }, this ); + + // Insert or replace the views. + this[ options.add ? 'insert' : 'replace' ]( $selector, _.pluck( views, 'el' ), options ); + + // Set attached and trigger ready if the current view is already + // attached to the DOM. + _.each( managers, function( manager ) { + manager.attached = true; + + if ( options.ready ) + manager.ready(); + }, this ); + + return this; + }, + + // #### Internal. Checks if the current view is in the DOM. + _isReady: function() { + var node = this.view.el; + while ( node ) { + if ( node === document.body ) + return true; + node = node.parentNode; + } + + return false; + } + }); + + // wp.media.View + // ------------- + // + // The base view class. + media.View = Backbone.View.extend({ + // The constructor for the `Views` manager. + Views: media.Views, + + constructor: function( options ) { + this.views = new this.Views( this, this.views ); + this.on( 'ready', this.ready, this ); + + if ( options && options.controller ) + this.controller = options.controller; + + Backbone.View.apply( this, arguments ); + }, + + dispose: function() { + // Undelegating events, removing events from the model, and + // removing events from the controller mirror the code for + // `Backbone.View.dispose` in Backbone master. + this.undelegateEvents(); + + if ( this.model && this.model.off ) + this.model.off( null, null, this ); + + if ( this.collection && this.collection.off ) + this.collection.off( null, null, this ); + + // Unbind controller events. + if ( this.controller && this.controller.off ) + this.controller.off( null, null, this ); + + // Recursively dispose child views. + if ( this.views ) + this.views.dispose(); + + return this; + }, + + remove: function() { + this.dispose(); + return Backbone.View.prototype.remove.apply( this, arguments ); + }, + + render: function() { + var options; + + if ( this.prepare ) + options = this.prepare(); + + this.views.detach(); + + if ( this.template ) { + options = options || {}; + this.trigger( 'prepare', options ); + this.$el.html( this.template( options ) ); + } + + this.views.render(); + return this; + }, + + prepare: function() { + return this.options; + }, + + ready: function() {} + }); + + /** + * wp.media.view.Frame + */ + media.view.Frame = media.View.extend({ + initialize: function() { + this._createRegions(); + this._createStates(); + }, + + _createRegions: function() { + // Clone the regions array. + this.regions = this.regions ? this.regions.slice() : []; + + // Initialize regions. + _.each( this.regions, function( region ) { + this[ region ] = new media.controller.Region({ + view: this, + id: region, + selector: '.media-frame-' + region + }); + }, this ); + }, + + _createStates: function() { + // Create the default `states` collection. + this.states = new Backbone.Collection( null, { + model: media.controller.State + }); + + // Ensure states have a reference to the frame. + this.states.on( 'add', function( model ) { + model.frame = this; + model.trigger('ready'); + }, this ); + + if ( this.options.states ) + this.states.add( this.options.states ); + }, + + reset: function() { + this.states.invoke( 'trigger', 'reset' ); + return this; + } + }); + + // Make the `Frame` a `StateMachine`. + _.extend( media.view.Frame.prototype, media.controller.StateMachine.prototype ); + + /** + * wp.media.view.MediaFrame + */ + media.view.MediaFrame = media.view.Frame.extend({ + className: 'media-frame', + template: media.template('media-frame'), + regions: ['menu','title','content','toolbar','router'], + + initialize: function() { + media.view.Frame.prototype.initialize.apply( this, arguments ); + + _.defaults( this.options, { + title: '', + modal: true, + uploader: true + }); + + // Ensure core UI is enabled. + this.$el.addClass('wp-core-ui'); + + // Initialize modal container view. + if ( this.options.modal ) { + this.modal = new media.view.Modal({ + controller: this, + title: this.options.title + }); + + this.modal.content( this ); + } + + // Force the uploader off if the upload limit has been exceeded or + // if the browser isn't supported. + if ( wp.Uploader.limitExceeded || ! wp.Uploader.browser.supported ) + this.options.uploader = false; + + // Initialize window-wide uploader. + if ( this.options.uploader ) { + this.uploader = new media.view.UploaderWindow({ + controller: this, + uploader: { + dropzone: this.modal ? this.modal.$el : this.$el, + container: this.$el + } + }); + this.views.set( '.media-frame-uploader', this.uploader ); + } + + this.on( 'attach', _.bind( this.views.ready, this.views ), this ); + + // Bind default title creation. + this.on( 'title:create:default', this.createTitle, this ); + this.title.mode('default'); + + // Bind default menu. + this.on( 'menu:create:default', this.createMenu, this ); + }, + + render: function() { + // Activate the default state if no active state exists. + if ( ! this.state() && this.options.state ) + this.setState( this.options.state ); + + return media.view.Frame.prototype.render.apply( this, arguments ); + }, + + createTitle: function( title ) { + title.view = new media.View({ + controller: this, + tagName: 'h1' + }); + }, + + createMenu: function( menu ) { + menu.view = new media.view.Menu({ + controller: this + }); + }, + + createToolbar: function( toolbar ) { + toolbar.view = new media.view.Toolbar({ + controller: this + }); + }, + + createRouter: function( router ) { + router.view = new media.view.Router({ + controller: this + }); + }, + + createIframeStates: function( options ) { + var settings = media.view.settings, + tabs = settings.tabs, + tabUrl = settings.tabUrl, + $postId; + + if ( ! tabs || ! tabUrl ) + return; + + // Add the post ID to the tab URL if it exists. + $postId = $('#post_ID'); + if ( $postId.length ) + tabUrl += '&post_id=' + $postId.val(); + + // Generate the tab states. + _.each( tabs, function( title, id ) { + var frame = this.state( 'iframe:' + id ).set( _.defaults({ + tab: id, + src: tabUrl + '&tab=' + id, + title: title, + content: 'iframe', + menu: 'default' + }, options ) ); + }, this ); + + this.on( 'content:create:iframe', this.iframeContent, this ); + this.on( 'menu:render:default', this.iframeMenu, this ); + this.on( 'open', this.hijackThickbox, this ); + this.on( 'close', this.restoreThickbox, this ); + }, + + iframeContent: function( content ) { + this.$el.addClass('hide-toolbar'); + content.view = new media.view.Iframe({ + controller: this + }); + }, + + iframeMenu: function( view ) { + var views = {}; + + if ( ! view ) + return; + + _.each( media.view.settings.tabs, function( title, id ) { + views[ 'iframe:' + id ] = { + text: this.state( 'iframe:' + id ).get('title'), + priority: 200 + }; + }, this ); + + view.set( views ); + }, + + hijackThickbox: function() { + var frame = this; + + if ( ! window.tb_remove || this._tb_remove ) + return; + + this._tb_remove = window.tb_remove; + window.tb_remove = function() { + frame.close(); + frame.reset(); + frame.setState( frame.options.state ); + frame._tb_remove.call( window ); + }; + }, + + restoreThickbox: function() { + if ( ! this._tb_remove ) + return; + + window.tb_remove = this._tb_remove; + delete this._tb_remove; + } + }); + + // Map some of the modal's methods to the frame. + _.each(['open','close','attach','detach','escape'], function( method ) { + media.view.MediaFrame.prototype[ method ] = function( view ) { + if ( this.modal ) + this.modal[ method ].apply( this.modal, arguments ); + return this; + }; + }); + + /** + * wp.media.view.MediaFrame.Select + */ + media.view.MediaFrame.Select = media.view.MediaFrame.extend({ + initialize: function() { + media.view.MediaFrame.prototype.initialize.apply( this, arguments ); + + _.defaults( this.options, { + selection: [], + library: {}, + multiple: false, + state: 'library' + }); + + this.createSelection(); + this.createStates(); + this.bindHandlers(); + }, + + createSelection: function() { + var controller = this, + selection = this.options.selection; + + if ( ! (selection instanceof media.model.Selection) ) { + this.options.selection = new media.model.Selection( selection, { + multiple: this.options.multiple + }); + } + + this._selection = { + attachments: new Attachments(), + difference: [] + }; + }, + + createStates: function() { + var options = this.options; + + if ( this.options.states ) + return; + + // Add the default states. + this.states.add([ + // Main states. + new media.controller.Library({ + library: media.query( options.library ), + multiple: options.multiple, + title: options.title, + priority: 20 + }) + ]); + }, + + bindHandlers: function() { + this.on( 'router:create:browse', this.createRouter, this ); + this.on( 'router:render:browse', this.browseRouter, this ); + this.on( 'content:create:browse', this.browseContent, this ); + this.on( 'content:render:upload', this.uploadContent, this ); + this.on( 'toolbar:create:select', this.createSelectToolbar, this ); + }, + + // Routers + browseRouter: function( view ) { + view.set({ + upload: { + text: l10n.uploadFilesTitle, + priority: 20 + }, + browse: { + text: l10n.mediaLibraryTitle, + priority: 40 + } + }); + }, + + // Content + browseContent: function( content ) { + var state = this.state(); + + this.$el.removeClass('hide-toolbar'); + + // Browse our library of attachments. + content.view = new media.view.AttachmentsBrowser({ + controller: this, + collection: state.get('library'), + selection: state.get('selection'), + model: state, + sortable: state.get('sortable'), + search: state.get('searchable'), + filters: state.get('filterable'), + display: state.get('displaySettings'), + dragInfo: state.get('dragInfo'), + + AttachmentView: state.get('AttachmentView') + }); + }, + + uploadContent: function() { + this.$el.removeClass('hide-toolbar'); + this.content.set( new media.view.UploaderInline({ + controller: this + }) ); + }, + + // Toolbars + createSelectToolbar: function( toolbar, options ) { + options = options || this.options.button || {}; + options.controller = this; + + toolbar.view = new media.view.Toolbar.Select( options ); + } + }); + + /** + * wp.media.view.MediaFrame.Post + */ + media.view.MediaFrame.Post = media.view.MediaFrame.Select.extend({ + initialize: function() { + _.defaults( this.options, { + multiple: true, + editing: false, + state: 'insert' + }); + + media.view.MediaFrame.Select.prototype.initialize.apply( this, arguments ); + this.createIframeStates(); + }, + + createStates: function() { + var options = this.options; + + // Add the default states. + this.states.add([ + // Main states. + new media.controller.Library({ + id: 'insert', + title: l10n.insertMediaTitle, + priority: 20, + toolbar: 'main-insert', + filterable: 'all', + library: media.query( options.library ), + multiple: options.multiple ? 'reset' : false, + editable: true, + + // If the user isn't allowed to edit fields, + // can they still edit it locally? + allowLocalEdits: true, + + // Show the attachment display settings. + displaySettings: true, + // Update user settings when users adjust the + // attachment display settings. + displayUserSettings: true + }), + + new media.controller.Library({ + id: 'gallery', + title: l10n.createGalleryTitle, + priority: 40, + toolbar: 'main-gallery', + filterable: 'uploaded', + multiple: 'add', + editable: false, + + library: media.query( _.defaults({ + type: 'image' + }, options.library ) ) + }), + + // Embed states. + new media.controller.Embed(), + + // Gallery states. + new media.controller.GalleryEdit({ + library: options.selection, + editing: options.editing, + menu: 'gallery' + }), + + new media.controller.GalleryAdd() + ]); + + + if ( media.view.settings.post.featuredImageId ) { + this.states.add( new media.controller.FeaturedImage() ); + } + }, + + bindHandlers: function() { + media.view.MediaFrame.Select.prototype.bindHandlers.apply( this, arguments ); + this.on( 'menu:create:gallery', this.createMenu, this ); + this.on( 'toolbar:create:main-insert', this.createToolbar, this ); + this.on( 'toolbar:create:main-gallery', this.createToolbar, this ); + this.on( 'toolbar:create:featured-image', this.featuredImageToolbar, this ); + this.on( 'toolbar:create:main-embed', this.mainEmbedToolbar, this ); + + var handlers = { + menu: { + 'default': 'mainMenu', + 'gallery': 'galleryMenu' + }, + + content: { + 'embed': 'embedContent', + 'edit-selection': 'editSelectionContent' + }, + + toolbar: { + 'main-insert': 'mainInsertToolbar', + 'main-gallery': 'mainGalleryToolbar', + 'gallery-edit': 'galleryEditToolbar', + 'gallery-add': 'galleryAddToolbar' + } + }; + + _.each( handlers, function( regionHandlers, region ) { + _.each( regionHandlers, function( callback, handler ) { + this.on( region + ':render:' + handler, this[ callback ], this ); + }, this ); + }, this ); + }, + + // Menus + mainMenu: function( view ) { + view.set({ + 'library-separator': new media.View({ + className: 'separator', + priority: 100 + }) + }); + }, + + galleryMenu: function( view ) { + var lastState = this.lastState(), + previous = lastState && lastState.id, + frame = this; + + view.set({ + cancel: { + text: l10n.cancelGalleryTitle, + priority: 20, + click: function() { + if ( previous ) + frame.setState( previous ); + else + frame.close(); + } + }, + separateCancel: new media.View({ + className: 'separator', + priority: 40 + }) + }); + }, + + // Content + embedContent: function() { + var view = new media.view.Embed({ + controller: this, + model: this.state() + }).render(); + + this.content.set( view ); + view.url.focus(); + }, + + editSelectionContent: function() { + var state = this.state(), + selection = state.get('selection'), + view; + + view = new media.view.AttachmentsBrowser({ + controller: this, + collection: selection, + selection: selection, + model: state, + sortable: true, + search: false, + dragInfo: true, + + AttachmentView: media.view.Attachment.EditSelection + }).render(); + + view.toolbar.set( 'backToLibrary', { + text: l10n.returnToLibrary, + priority: -100, + + click: function() { + this.controller.content.mode('browse'); + } + }); + + // Browse our library of attachments. + this.content.set( view ); + }, + + // Toolbars + selectionStatusToolbar: function( view ) { + var editable = this.state().get('editable'); + + view.set( 'selection', new media.view.Selection({ + controller: this, + collection: this.state().get('selection'), + priority: -40, + + // If the selection is editable, pass the callback to + // switch the content mode. + editable: editable && function() { + this.controller.content.mode('edit-selection'); + } + }).render() ); + }, + + mainInsertToolbar: function( view ) { + var controller = this; + + this.selectionStatusToolbar( view ); + + view.set( 'insert', { + style: 'primary', + priority: 80, + text: l10n.insertIntoPost, + requires: { selection: true }, + + click: function() { + var state = controller.state(), + selection = state.get('selection'); + + controller.close(); + state.trigger( 'insert', selection ).reset(); + } + }); + }, + + mainGalleryToolbar: function( view ) { + var controller = this; + + this.selectionStatusToolbar( view ); + + view.set( 'gallery', { + style: 'primary', + text: l10n.createNewGallery, + priority: 60, + requires: { selection: true }, + + click: function() { + var selection = controller.state().get('selection'), + edit = controller.state('gallery-edit'), + models = selection.where({ type: 'image' }); + + edit.set( 'library', new media.model.Selection( models, { + props: selection.props.toJSON(), + multiple: true + }) ); + + this.controller.setState('gallery-edit'); + } + }); + }, + + featuredImageToolbar: function( toolbar ) { + this.createSelectToolbar( toolbar, { + text: l10n.setFeaturedImage, + state: this.options.state || 'upload' + }); + }, + + mainEmbedToolbar: function( toolbar ) { + toolbar.view = new media.view.Toolbar.Embed({ + controller: this + }); + }, + + galleryEditToolbar: function() { + var editing = this.state().get('editing'); + this.toolbar.set( new media.view.Toolbar({ + controller: this, + items: { + insert: { + style: 'primary', + text: editing ? l10n.updateGallery : l10n.insertGallery, + priority: 80, + requires: { library: true }, + + click: function() { + var controller = this.controller, + state = controller.state(); + + controller.close(); + state.trigger( 'update', state.get('library') ); + + controller.reset(); + // @todo: Make the state activated dynamic (instead of hardcoded). + controller.setState('upload'); + } + } + } + }) ); + }, + + galleryAddToolbar: function() { + this.toolbar.set( new media.view.Toolbar({ + controller: this, + items: { + insert: { + style: 'primary', + text: l10n.addToGallery, + priority: 80, + requires: { selection: true }, + + click: function() { + var controller = this.controller, + state = controller.state(), + edit = controller.state('gallery-edit'); + + edit.get('library').add( state.get('selection').models ); + state.trigger('reset'); + controller.setState('gallery-edit'); + } + } + } + }) ); + } + }); + + /** + * wp.media.view.Modal + */ + media.view.Modal = media.View.extend({ + tagName: 'div', + template: media.template('media-modal'), + + attributes: { + tabindex: 0 + }, + + events: { + 'click .media-modal-backdrop, .media-modal-close': 'escapeHandler', + 'keydown': 'keydown' + }, + + initialize: function() { + _.defaults( this.options, { + container: document.body, + title: '', + propagate: true, + freeze: true + }); + }, + + prepare: function() { + return { + title: this.options.title + }; + }, + + attach: function() { + if ( this.views.attached ) + return this; + + if ( ! this.views.rendered ) + this.render(); + + this.$el.appendTo( this.options.container ); + + // Manually mark the view as attached and trigger ready. + this.views.attached = true; + this.views.ready(); + + return this.propagate('attach'); + }, + + detach: function() { + if ( this.$el.is(':visible') ) + this.close(); + + this.$el.detach(); + this.views.attached = false; + return this.propagate('detach'); + }, + + open: function() { + var $el = this.$el, + options = this.options; + + if ( $el.is(':visible') ) + return this; + + if ( ! this.views.attached ) + this.attach(); + + // If the `freeze` option is set, record the window's scroll position. + if ( options.freeze ) { + this._freeze = { + scrollTop: $( window ).scrollTop() + }; + } + + $el.show().focus(); + return this.propagate('open'); + }, + + close: function( options ) { + var freeze = this._freeze; + + if ( ! this.views.attached || ! this.$el.is(':visible') ) + return this; + + this.$el.hide(); + this.propagate('close'); + + // If the `freeze` option is set, restore the container's scroll position. + if ( freeze ) { + $( window ).scrollTop( freeze.scrollTop ); + } + + if ( options && options.escape ) + this.propagate('escape'); + + return this; + }, + + escape: function() { + return this.close({ escape: true }); + }, + + escapeHandler: function( event ) { + event.preventDefault(); + this.escape(); + }, + + content: function( content ) { + this.views.set( '.media-modal-content', content ); + return this; + }, + + // Triggers a modal event and if the `propagate` option is set, + // forwards events to the modal's controller. + propagate: function( id ) { + this.trigger( id ); + + if ( this.options.propagate ) + this.controller.trigger( id ); + + return this; + }, + + keydown: function( event ) { + // Close the modal when escape is pressed. + if ( 27 === event.which ) { + event.preventDefault(); + this.escape(); + return; + } + } + }); + + // wp.media.view.FocusManager + // ---------------------------- + media.view.FocusManager = media.View.extend({ + events: { + keydown: 'recordTab', + focusin: 'updateIndex' + }, + + focus: function() { + if ( _.isUndefined( this.index ) ) + return; + + // Update our collection of `$tabbables`. + this.$tabbables = this.$(':tabbable'); + + // If tab is saved, focus it. + this.$tabbables.eq( this.index ).focus(); + }, + + recordTab: function( event ) { + // Look for the tab key. + if ( 9 !== event.keyCode ) + return; + + // First try to update the index. + if ( _.isUndefined( this.index ) ) + this.updateIndex( event ); + + // If we still don't have an index, bail. + if ( _.isUndefined( this.index ) ) + return; + + var index = this.index + ( event.shiftKey ? -1 : 1 ); + + if ( index >= 0 && index < this.$tabbables.length ) + this.index = index; + else + delete this.index; + }, + + updateIndex: function( event ) { + this.$tabbables = this.$(':tabbable'); + + var index = this.$tabbables.index( event.target ); + + if ( -1 === index ) + delete this.index; + else + this.index = index; + } + }); + + // wp.media.view.UploaderWindow + // ---------------------------- + media.view.UploaderWindow = media.View.extend({ + tagName: 'div', + className: 'uploader-window', + template: media.template('uploader-window'), + + initialize: function() { + var uploader; + + this.$browser = $('').hide().appendTo('body'); + + uploader = this.options.uploader = _.defaults( this.options.uploader || {}, { + dropzone: this.$el, + browser: this.$browser, + params: {} + }); + + // Ensure the dropzone is a jQuery collection. + if ( uploader.dropzone && ! (uploader.dropzone instanceof $) ) + uploader.dropzone = $( uploader.dropzone ); + + this.controller.on( 'activate', this.refresh, this ); + }, + + refresh: function() { + if ( this.uploader ) + this.uploader.refresh(); + }, + + ready: function() { + var postId = media.view.settings.post.id, + dropzone; + + // If the uploader already exists, bail. + if ( this.uploader ) + return; + + if ( postId ) + this.options.uploader.params.post_id = postId; + + this.uploader = new wp.Uploader( this.options.uploader ); + + dropzone = this.uploader.dropzone; + dropzone.on( 'dropzone:enter', _.bind( this.show, this ) ); + dropzone.on( 'dropzone:leave', _.bind( this.hide, this ) ); + }, + + show: function() { + var $el = this.$el.show(); + + // Ensure that the animation is triggered by waiting until + // the transparent element is painted into the DOM. + _.defer( function() { + $el.css({ opacity: 1 }); + }); + }, + + hide: function() { + var $el = this.$el.css({ opacity: 0 }); + + media.transition( $el ).done( function() { + // Transition end events are subject to race conditions. + // Make sure that the value is set as intended. + if ( '0' === $el.css('opacity') ) + $el.hide(); + }); + } + }); + + media.view.UploaderInline = media.View.extend({ + tagName: 'div', + className: 'uploader-inline', + template: media.template('uploader-inline'), + + initialize: function() { + _.defaults( this.options, { + message: '', + status: true + }); + + if ( ! this.options.$browser && this.controller.uploader ) + this.options.$browser = this.controller.uploader.$browser; + + if ( _.isUndefined( this.options.postId ) ) + this.options.postId = media.view.settings.post.id; + + if ( this.options.status ) { + this.views.set( '.upload-inline-status', new media.view.UploaderStatus({ + controller: this.controller + }) ); + } + }, + + dispose: function() { + if ( this.disposing ) + return media.View.prototype.dispose.apply( this, arguments ); + + // Run remove on `dispose`, so we can be sure to refresh the + // uploader with a view-less DOM. Track whether we're disposing + // so we don't trigger an infinite loop. + this.disposing = true; + return this.remove(); + }, + + remove: function() { + var result = media.View.prototype.remove.apply( this, arguments ); + + _.defer( _.bind( this.refresh, this ) ); + return result; + }, + + refresh: function() { + var uploader = this.controller.uploader; + + if ( uploader ) + uploader.refresh(); + }, + + ready: function() { + var $browser = this.options.$browser, + $placeholder; + + if ( this.controller.uploader ) { + $placeholder = this.$('.browser'); + + // Check if we've already replaced the placeholder. + if ( $placeholder[0] === $browser[0] ) + return; + + $browser.detach().text( $placeholder.text() ); + $browser[0].className = $placeholder[0].className; + $placeholder.replaceWith( $browser.show() ); + } + + this.refresh(); + return this; + } + }); + + /** + * wp.media.view.UploaderStatus + */ + media.view.UploaderStatus = media.View.extend({ + className: 'media-uploader-status', + template: media.template('uploader-status'), + + events: { + 'click .upload-dismiss-errors': 'dismiss' + }, + + initialize: function() { + this.queue = wp.Uploader.queue; + this.queue.on( 'add remove reset', this.visibility, this ); + this.queue.on( 'add remove reset change:percent', this.progress, this ); + this.queue.on( 'add remove reset change:uploading', this.info, this ); + + this.errors = wp.Uploader.errors; + this.errors.reset(); + this.errors.on( 'add remove reset', this.visibility, this ); + this.errors.on( 'add', this.error, this ); + }, + + dispose: function() { + wp.Uploader.queue.off( null, null, this ); + media.View.prototype.dispose.apply( this, arguments ); + return this; + }, + + visibility: function() { + this.$el.toggleClass( 'uploading', !! this.queue.length ); + this.$el.toggleClass( 'errors', !! this.errors.length ); + this.$el.toggle( !! this.queue.length || !! this.errors.length ); + }, + + ready: function() { + _.each({ + '$bar': '.media-progress-bar div', + '$index': '.upload-index', + '$total': '.upload-total', + '$filename': '.upload-filename' + }, function( selector, key ) { + this[ key ] = this.$( selector ); + }, this ); + + this.visibility(); + this.progress(); + this.info(); + }, + + progress: function() { + var queue = this.queue, + $bar = this.$bar, + memo = 0; + + if ( ! $bar || ! queue.length ) + return; + + $bar.width( ( queue.reduce( function( memo, attachment ) { + if ( ! attachment.get('uploading') ) + return memo + 100; + + var percent = attachment.get('percent'); + return memo + ( _.isNumber( percent ) ? percent : 100 ); + }, 0 ) / queue.length ) + '%' ); + }, + + info: function() { + var queue = this.queue, + index = 0, active; + + if ( ! queue.length ) + return; + + active = this.queue.find( function( attachment, i ) { + index = i; + return attachment.get('uploading'); + }); + + this.$index.text( index + 1 ); + this.$total.text( queue.length ); + this.$filename.html( active ? this.filename( active.get('filename') ) : '' ); + }, + + filename: function( filename ) { + return media.truncate( _.escape( filename ), 24 ); + }, + + error: function( error ) { + this.views.add( '.upload-errors', new media.view.UploaderStatusError({ + filename: this.filename( error.get('file').name ), + message: error.get('message') + }), { at: 0 }); + }, + + dismiss: function( event ) { + var errors = this.views.get('.upload-errors'); + + event.preventDefault(); + + if ( errors ) + _.invoke( errors, 'remove' ); + wp.Uploader.errors.reset(); + } + }); + + media.view.UploaderStatusError = media.View.extend({ + className: 'upload-error', + template: media.template('uploader-status-error') + }); + + /** + * wp.media.view.Toolbar + */ + media.view.Toolbar = media.View.extend({ + tagName: 'div', + className: 'media-toolbar', + + initialize: function() { + var state = this.controller.state(), + selection = this.selection = state.get('selection'), + library = this.library = state.get('library'); + + this._views = {}; + + // The toolbar is composed of two `PriorityList` views. + this.primary = new media.view.PriorityList(); + this.secondary = new media.view.PriorityList(); + this.primary.$el.addClass('media-toolbar-primary'); + this.secondary.$el.addClass('media-toolbar-secondary'); + + this.views.set([ this.secondary, this.primary ]); + + if ( this.options.items ) + this.set( this.options.items, { silent: true }); + + if ( ! this.options.silent ) + this.render(); + + if ( selection ) + selection.on( 'add remove reset', this.refresh, this ); + if ( library ) + library.on( 'add remove reset', this.refresh, this ); + }, + + dispose: function() { + if ( this.selection ) + this.selection.off( null, null, this ); + if ( this.library ) + this.library.off( null, null, this ); + return media.View.prototype.dispose.apply( this, arguments ); + }, + + ready: function() { + this.refresh(); + }, + + set: function( id, view, options ) { + var list; + options = options || {}; + + // Accept an object with an `id` : `view` mapping. + if ( _.isObject( id ) ) { + _.each( id, function( view, id ) { + this.set( id, view, { silent: true }); + }, this ); + + } else { + if ( ! ( view instanceof Backbone.View ) ) { + view.classes = [ 'media-button-' + id ].concat( view.classes || [] ); + view = new media.view.Button( view ).render(); + } + + view.controller = view.controller || this.controller; + + this._views[ id ] = view; + + list = view.options.priority < 0 ? 'secondary' : 'primary'; + this[ list ].set( id, view, options ); + } + + if ( ! options.silent ) + this.refresh(); + + return this; + }, + + get: function( id ) { + return this._views[ id ]; + }, + + unset: function( id, options ) { + delete this._views[ id ]; + this.primary.unset( id, options ); + this.secondary.unset( id, options ); + + if ( ! options || ! options.silent ) + this.refresh(); + return this; + }, + + refresh: function() { + var state = this.controller.state(), + library = state.get('library'), + selection = state.get('selection'); + + _.each( this._views, function( button ) { + if ( ! button.model || ! button.options || ! button.options.requires ) + return; + + var requires = button.options.requires, + disabled = false; + + if ( requires.selection && selection && ! selection.length ) + disabled = true; + else if ( requires.library && library && ! library.length ) + disabled = true; + + button.model.set( 'disabled', disabled ); + }); + } + }); + + // wp.media.view.Toolbar.Select + // ---------------------------- + media.view.Toolbar.Select = media.view.Toolbar.extend({ + initialize: function() { + var options = this.options, + controller = options.controller, + selection = controller.state().get('selection'); + + _.bindAll( this, 'clickSelect' ); + + _.defaults( options, { + event: 'select', + state: false, + reset: true, + close: true, + text: l10n.select, + + // Does the button rely on the selection? + requires: { + selection: true + } + }); + + options.items = _.defaults( options.items || {}, { + select: { + style: 'primary', + text: options.text, + priority: 80, + click: this.clickSelect, + requires: options.requires + } + }); + + media.view.Toolbar.prototype.initialize.apply( this, arguments ); + }, + + clickSelect: function() { + var options = this.options, + controller = this.controller; + + if ( options.close ) + controller.close(); + + if ( options.event ) + controller.state().trigger( options.event ); + + if ( options.reset ) + controller.reset(); + + if ( options.state ) + controller.setState( options.state ); + } + }); + + // wp.media.view.Toolbar.Embed + // --------------------------- + media.view.Toolbar.Embed = media.view.Toolbar.Select.extend({ + initialize: function() { + _.defaults( this.options, { + text: l10n.insertIntoPost, + requires: false + }); + + media.view.Toolbar.Select.prototype.initialize.apply( this, arguments ); + }, + + refresh: function() { + var url = this.controller.state().props.get('url'); + this.get('select').model.set( 'disabled', ! url || url === 'http://' ); + + media.view.Toolbar.Select.prototype.refresh.apply( this, arguments ); + } + }); + + /** + * wp.media.view.Button + */ + media.view.Button = media.View.extend({ + tagName: 'a', + className: 'media-button', + attributes: { href: '#' }, + + events: { + 'click': 'click' + }, + + defaults: { + text: '', + style: '', + size: 'large', + disabled: false + }, + + initialize: function() { + // Create a model with the provided `defaults`. + this.model = new Backbone.Model( this.defaults ); + + // If any of the `options` have a key from `defaults`, apply its + // value to the `model` and remove it from the `options object. + _.each( this.defaults, function( def, key ) { + var value = this.options[ key ]; + if ( _.isUndefined( value ) ) + return; + + this.model.set( key, value ); + delete this.options[ key ]; + }, this ); + + this.model.on( 'change', this.render, this ); + }, + + render: function() { + var classes = [ 'button', this.className ], + model = this.model.toJSON(); + + if ( model.style ) + classes.push( 'button-' + model.style ); + + if ( model.size ) + classes.push( 'button-' + model.size ); + + classes = _.uniq( classes.concat( this.options.classes ) ); + this.el.className = classes.join(' '); + + this.$el.attr( 'disabled', model.disabled ); + this.$el.text( this.model.get('text') ); + + return this; + }, + + click: function( event ) { + if ( '#' === this.attributes.href ) + event.preventDefault(); + + if ( this.options.click && ! this.model.get('disabled') ) + this.options.click.apply( this, arguments ); + } + }); + + /** + * wp.media.view.ButtonGroup + */ + media.view.ButtonGroup = media.View.extend({ + tagName: 'div', + className: 'button-group button-large media-button-group', + + initialize: function() { + this.buttons = _.map( this.options.buttons || [], function( button ) { + if ( button instanceof Backbone.View ) + return button; + else + return new media.view.Button( button ).render(); + }); + + delete this.options.buttons; + + if ( this.options.classes ) + this.$el.addClass( this.options.classes ); + }, + + render: function() { + this.$el.html( $( _.pluck( this.buttons, 'el' ) ).detach() ); + return this; + } + }); + + /** + * wp.media.view.PriorityList + */ + + media.view.PriorityList = media.View.extend({ + tagName: 'div', + + initialize: function() { + this._views = {}; + + this.set( _.extend( {}, this._views, this.options.views ), { silent: true }); + delete this.options.views; + + if ( ! this.options.silent ) + this.render(); + }, + + set: function( id, view, options ) { + var priority, views, index; + + options = options || {}; + + // Accept an object with an `id` : `view` mapping. + if ( _.isObject( id ) ) { + _.each( id, function( view, id ) { + this.set( id, view ); + }, this ); + return this; + } + + if ( ! (view instanceof Backbone.View) ) + view = this.toView( view, id, options ); + + view.controller = view.controller || this.controller; + + this.unset( id ); + + priority = view.options.priority || 10; + views = this.views.get() || []; + + _.find( views, function( existing, i ) { + if ( existing.options.priority > priority ) { + index = i; + return true; + } + }); + + this._views[ id ] = view; + this.views.add( view, { + at: _.isNumber( index ) ? index : views.length || 0 + }); + + return this; + }, + + get: function( id ) { + return this._views[ id ]; + }, + + unset: function( id ) { + var view = this.get( id ); + + if ( view ) + view.remove(); + + delete this._views[ id ]; + return this; + }, + + toView: function( options ) { + return new media.View( options ); + } + }); + + /** + * wp.media.view.MenuItem + */ + media.view.MenuItem = media.View.extend({ + tagName: 'a', + className: 'media-menu-item', + + attributes: { + href: '#' + }, + + events: { + 'click': '_click' + }, + + _click: function( event ) { + var clickOverride = this.options.click; + + if ( event ) + event.preventDefault(); + + if ( clickOverride ) + clickOverride.call( this ); + else + this.click(); + }, + + click: function() { + var state = this.options.state; + if ( state ) + this.controller.setState( state ); + }, + + render: function() { + var options = this.options; + + if ( options.text ) + this.$el.text( options.text ); + else if ( options.html ) + this.$el.html( options.html ); + + return this; + } + }); + + /** + * wp.media.view.Menu + */ + media.view.Menu = media.view.PriorityList.extend({ + tagName: 'div', + className: 'media-menu', + property: 'state', + ItemView: media.view.MenuItem, + region: 'menu', + + toView: function( options, id ) { + options = options || {}; + options[ this.property ] = options[ this.property ] || id; + return new this.ItemView( options ).render(); + }, + + ready: function() { + media.view.PriorityList.prototype.ready.apply( this, arguments ); + this.visibility(); + }, + + set: function() { + media.view.PriorityList.prototype.set.apply( this, arguments ); + this.visibility(); + }, + + unset: function() { + media.view.PriorityList.prototype.unset.apply( this, arguments ); + this.visibility(); + }, + + visibility: function() { + var region = this.region, + view = this.controller[ region ].get(), + views = this.views.get(), + hide = ! views || views.length < 2; + + if ( this === view ) + this.controller.$el.toggleClass( 'hide-' + region, hide ); + }, + + select: function( id ) { + var view = this.get( id ); + + if ( ! view ) + return; + + this.deselect(); + view.$el.addClass('active'); + }, + + deselect: function() { + this.$el.children().removeClass('active'); + } + }); + + /** + * wp.media.view.RouterItem + */ + media.view.RouterItem = media.view.MenuItem.extend({ + click: function() { + var contentMode = this.options.contentMode; + if ( contentMode ) + this.controller.content.mode( contentMode ); + } + }); + + /** + * wp.media.view.Router + */ + media.view.Router = media.view.Menu.extend({ + tagName: 'div', + className: 'media-router', + property: 'contentMode', + ItemView: media.view.RouterItem, + region: 'router', + + initialize: function() { + this.controller.on( 'content:render', this.update, this ); + media.view.Menu.prototype.initialize.apply( this, arguments ); + }, + + update: function() { + var mode = this.controller.content.mode(); + if ( mode ) + this.select( mode ); + } + }); + + + /** + * wp.media.view.Sidebar + */ + media.view.Sidebar = media.view.PriorityList.extend({ + className: 'media-sidebar' + }); + + /** + * wp.media.view.Attachment + */ + media.view.Attachment = media.View.extend({ + tagName: 'li', + className: 'attachment', + template: media.template('attachment'), + + events: { + 'click .attachment-preview': 'toggleSelectionHandler', + 'change [data-setting]': 'updateSetting', + 'change [data-setting] input': 'updateSetting', + 'change [data-setting] select': 'updateSetting', + 'change [data-setting] textarea': 'updateSetting', + 'click .close': 'removeFromLibrary', + 'click .check': 'removeFromSelection', + 'click a': 'preventDefault' + }, + + buttons: {}, + + initialize: function() { + var selection = this.options.selection; + + this.model.on( 'change:sizes change:uploading change:caption change:title', this.render, this ); + this.model.on( 'change:percent', this.progress, this ); + + // Update the selection. + this.model.on( 'add', this.select, this ); + this.model.on( 'remove', this.deselect, this ); + if ( selection ) + selection.on( 'reset', this.updateSelect, this ); + + // Update the model's details view. + this.model.on( 'selection:single selection:unsingle', this.details, this ); + this.details( this.model, this.controller.state().get('selection') ); + }, + + dispose: function() { + var selection = this.options.selection; + + // Make sure all settings are saved before removing the view. + this.updateAll(); + + if ( selection ) + selection.off( null, null, this ); + + media.View.prototype.dispose.apply( this, arguments ); + return this; + }, + + render: function() { + var options = _.defaults( this.model.toJSON(), { + orientation: 'landscape', + uploading: false, + type: '', + subtype: '', + icon: '', + filename: '', + caption: '', + title: '', + dateFormatted: '', + width: '', + height: '', + compat: false, + alt: '', + description: '' + }); + + options.buttons = this.buttons; + options.describe = this.controller.state().get('describe'); + + if ( 'image' === options.type ) + options.size = this.imageSize(); + + options.can = {}; + if ( options.nonces ) { + options.can.remove = !! options.nonces['delete']; + options.can.save = !! options.nonces.update; + } + + if ( this.controller.state().get('allowLocalEdits') ) + options.allowLocalEdits = true; + + this.views.detach(); + this.$el.html( this.template( options ) ); + + this.$el.toggleClass( 'uploading', options.uploading ); + if ( options.uploading ) + this.$bar = this.$('.media-progress-bar div'); + else + delete this.$bar; + + // Check if the model is selected. + this.updateSelect(); + + // Update the save status. + this.updateSave(); + + this.views.render(); + + return this; + }, + + progress: function() { + if ( this.$bar && this.$bar.length ) + this.$bar.width( this.model.get('percent') + '%' ); + }, + + toggleSelectionHandler: function( event ) { + var method; + + if ( event.shiftKey ) + method = 'between'; + else if ( event.ctrlKey || event.metaKey ) + method = 'toggle'; + + this.toggleSelection({ + method: method + }); + }, + + toggleSelection: function( options ) { + var collection = this.collection, + selection = this.options.selection, + model = this.model, + method = options && options.method, + single, between, models, singleIndex, modelIndex; + + if ( ! selection ) + return; + + single = selection.single(); + method = _.isUndefined( method ) ? selection.multiple : method; + + // If the `method` is set to `between`, select all models that + // exist between the current and the selected model. + if ( 'between' === method && single && selection.multiple ) { + // If the models are the same, short-circuit. + if ( single === model ) + return; + + singleIndex = collection.indexOf( single ); + modelIndex = collection.indexOf( this.model ); + + if ( singleIndex < modelIndex ) + models = collection.models.slice( singleIndex, modelIndex + 1 ); + else + models = collection.models.slice( modelIndex, singleIndex + 1 ); + + selection.add( models ).single( model ); + return; + + // If the `method` is set to `toggle`, just flip the selection + // status, regardless of whether the model is the single model. + } else if ( 'toggle' === method ) { + selection[ this.selected() ? 'remove' : 'add' ]( model ).single( model ); + return; + } + + if ( method !== 'add' ) + method = 'reset'; + + if ( this.selected() ) { + // If the model is the single model, remove it. + // If it is not the same as the single model, + // it now becomes the single model. + selection[ single === model ? 'remove' : 'single' ]( model ); + } else { + // If the model is not selected, run the `method` on the + // selection. By default, we `reset` the selection, but the + // `method` can be set to `add` the model to the selection. + selection[ method ]( model ).single( model ); + } + }, + + updateSelect: function() { + this[ this.selected() ? 'select' : 'deselect' ](); + }, + + selected: function() { + var selection = this.options.selection; + if ( selection ) + return !! selection.getByCid( this.model.cid ); + }, + + select: function( model, collection ) { + var selection = this.options.selection; + + // Check if a selection exists and if it's the collection provided. + // If they're not the same collection, bail; we're in another + // selection's event loop. + if ( ! selection || ( collection && collection !== selection ) ) + return; + + this.$el.addClass('selected'); + }, + + deselect: function( model, collection ) { + var selection = this.options.selection; + + // Check if a selection exists and if it's the collection provided. + // If they're not the same collection, bail; we're in another + // selection's event loop. + if ( ! selection || ( collection && collection !== selection ) ) + return; + + this.$el.removeClass('selected'); + }, + + details: function( model, collection ) { + var selection = this.options.selection, + details; + + if ( selection !== collection ) + return; + + details = selection.single(); + this.$el.toggleClass( 'details', details === this.model ); + }, + + preventDefault: function( event ) { + event.preventDefault(); + }, + + imageSize: function( size ) { + var sizes = this.model.get('sizes'); + + size = size || 'medium'; + + // Use the provided image size if possible. + if ( sizes && sizes[ size ] ) { + return _.clone( sizes[ size ] ); + } else { + return { + url: this.model.get('url'), + width: this.model.get('width'), + height: this.model.get('height'), + orientation: this.model.get('orientation') + }; + } + }, + + updateSetting: function( event ) { + var $setting = $( event.target ).closest('[data-setting]'), + setting, value; + + if ( ! $setting.length ) + return; + + setting = $setting.data('setting'); + value = event.target.value; + + if ( this.model.get( setting ) !== value ) + this.save( setting, value ); + }, + + // Pass all the arguments to the model's save method. + // + // Records the aggregate status of all save requests and updates the + // view's classes accordingly. + save: function() { + var view = this, + save = this._save = this._save || { status: 'ready' }, + request = this.model.save.apply( this.model, arguments ), + requests = save.requests ? $.when( request, save.requests ) : request; + + // If we're waiting to remove 'Saved.', stop. + if ( save.savedTimer ) + clearTimeout( save.savedTimer ); + + this.updateSave('waiting'); + save.requests = requests; + requests.always( function() { + // If we've performed another request since this one, bail. + if ( save.requests !== requests ) + return; + + view.updateSave( requests.state() === 'resolved' ? 'complete' : 'error' ); + save.savedTimer = setTimeout( function() { + view.updateSave('ready'); + delete save.savedTimer; + }, 2000 ); + }); + + }, + + updateSave: function( status ) { + var save = this._save = this._save || { status: 'ready' }; + + if ( status && status !== save.status ) { + this.$el.removeClass( 'save-' + save.status ); + save.status = status; + } + + this.$el.addClass( 'save-' + save.status ); + return this; + }, + + updateAll: function() { + var $settings = this.$('[data-setting]'), + model = this.model, + changed; + + changed = _.chain( $settings ).map( function( el ) { + var $input = $('input, textarea, select, [value]', el ), + setting, value; + + if ( ! $input.length ) + return; + + setting = $(el).data('setting'); + value = $input.val(); + + // Record the value if it changed. + if ( model.get( setting ) !== value ) + return [ setting, value ]; + }).compact().object().value(); + + if ( ! _.isEmpty( changed ) ) + model.save( changed ); + }, + + removeFromLibrary: function( event ) { + // Stop propagation so the model isn't selected. + event.stopPropagation(); + + this.collection.remove( this.model ); + }, + + removeFromSelection: function( event ) { + var selection = this.options.selection; + if ( ! selection ) + return; + + // Stop propagation so the model isn't selected. + event.stopPropagation(); + + selection.remove( this.model ); + } + }); + + /** + * wp.media.view.Attachment.Library + */ + media.view.Attachment.Library = media.view.Attachment.extend({ + buttons: { + check: true + } + }); + + /** + * wp.media.view.Attachment.EditLibrary + */ + media.view.Attachment.EditLibrary = media.view.Attachment.extend({ + buttons: { + close: true + } + }); + + /** + * wp.media.view.Attachments + */ + media.view.Attachments = media.View.extend({ + tagName: 'ul', + className: 'attachments', + + cssTemplate: media.template('attachments-css'), + + events: { + 'scroll': 'scroll' + }, + + initialize: function() { + this.el.id = _.uniqueId('__attachments-view-'); + + _.defaults( this.options, { + refreshSensitivity: 200, + refreshThreshold: 3, + AttachmentView: media.view.Attachment, + sortable: false, + resize: true + }); + + this._viewsByCid = {}; + + this.collection.on( 'add', function( attachment, attachments, options ) { + this.views.add( this.createAttachmentView( attachment ), { + at: options.index + }); + }, this ); + + this.collection.on( 'remove', function( attachment, attachments, options ) { + var view = this._viewsByCid[ attachment.cid ]; + delete this._viewsByCid[ attachment.cid ]; + + if ( view ) + view.remove(); + }, this ); + + this.collection.on( 'reset', this.render, this ); + + // Throttle the scroll handler. + this.scroll = _.chain( this.scroll ).bind( this ).throttle( this.options.refreshSensitivity ).value(); + + this.initSortable(); + + _.bindAll( this, 'css' ); + this.model.on( 'change:edge change:gutter', this.css, this ); + this._resizeCss = _.debounce( _.bind( this.css, this ), this.refreshSensitivity ); + if ( this.options.resize ) + $(window).on( 'resize.attachments', this._resizeCss ); + this.css(); + }, + + dispose: function() { + this.collection.props.off( null, null, this ); + $(window).off( 'resize.attachments', this._resizeCss ); + media.View.prototype.dispose.apply( this, arguments ); + }, + + css: function() { + var $css = $( '#' + this.el.id + '-css' ); + + if ( $css.length ) + $css.remove(); + + media.view.Attachments.$head().append( this.cssTemplate({ + id: this.el.id, + edge: this.edge(), + gutter: this.model.get('gutter') + }) ); + }, + + edge: function() { + var edge = this.model.get('edge'), + gutter, width, columns; + + if ( ! this.$el.is(':visible') ) + return edge; + + gutter = this.model.get('gutter') * 2; + width = this.$el.width() - gutter; + columns = Math.ceil( width / ( edge + gutter ) ); + edge = Math.floor( ( width - ( columns * gutter ) ) / columns ); + return edge; + }, + + initSortable: function() { + var collection = this.collection; + + if ( ! this.options.sortable || ! $.fn.sortable ) + return; + + this.$el.sortable( _.extend({ + // If the `collection` has a `comparator`, disable sorting. + disabled: !! collection.comparator, + + // Prevent attachments from being dragged outside the bounding + // box of the list. + containment: this.$el, + + // Change the position of the attachment as soon as the + // mouse pointer overlaps a thumbnail. + tolerance: 'pointer', + + // Record the initial `index` of the dragged model. + start: function( event, ui ) { + ui.item.data('sortableIndexStart', ui.item.index()); + }, + + // Update the model's index in the collection. + // Do so silently, as the view is already accurate. + update: function( event, ui ) { + var model = collection.at( ui.item.data('sortableIndexStart') ), + comparator = collection.comparator; + + // Temporarily disable the comparator to prevent `add` + // from re-sorting. + delete collection.comparator; + + // Silently shift the model to its new index. + collection.remove( model, { + silent: true + }).add( model, { + silent: true, + at: ui.item.index() + }); + + // Restore the comparator. + collection.comparator = comparator; + + // Fire the `reset` event to ensure other collections sync. + collection.trigger( 'reset', collection ); + + // If the collection is sorted by menu order, + // update the menu order. + collection.saveMenuOrder(); + } + }, this.options.sortable ) ); + + // If the `orderby` property is changed on the `collection`, + // check to see if we have a `comparator`. If so, disable sorting. + collection.props.on( 'change:orderby', function() { + this.$el.sortable( 'option', 'disabled', !! collection.comparator ); + }, this ); + + this.collection.props.on( 'change:orderby', this.refreshSortable, this ); + this.refreshSortable(); + }, + + refreshSortable: function() { + if ( ! this.options.sortable || ! $.fn.sortable ) + return; + + // If the `collection` has a `comparator`, disable sorting. + var collection = this.collection, + orderby = collection.props.get('orderby'), + enabled = 'menuOrder' === orderby || ! collection.comparator; + + this.$el.sortable( 'option', 'disabled', ! enabled ); + }, + + createAttachmentView: function( attachment ) { + var view = new this.options.AttachmentView({ + controller: this.controller, + model: attachment, + collection: this.collection, + selection: this.options.selection + }); + + return this._viewsByCid[ attachment.cid ] = view; + }, + + prepare: function() { + // Create all of the Attachment views, and replace + // the list in a single DOM operation. + if ( this.collection.length ) { + this.views.set( this.collection.map( this.createAttachmentView, this ) ); + + // If there are no elements, clear the views and load some. + } else { + this.views.unset(); + this.collection.more().done( this.scroll ); + } + }, + + ready: function() { + // Trigger the scroll event to check if we're within the + // threshold to query for additional attachments. + this.scroll(); + }, + + scroll: function( event ) { + // @todo: is this still necessary? + if ( ! this.$el.is(':visible') ) + return; + + if ( this.collection.hasMore() && this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) { + this.collection.more().done( this.scroll ); + } + } + }, { + $head: (function() { + var $head; + return function() { + return $head = $head || $('head'); + }; + }()) + }); + + /** + * wp.media.view.Search + */ + media.view.Search = media.View.extend({ + tagName: 'input', + className: 'search', + + attributes: { + type: 'search', + placeholder: l10n.search + }, + + events: { + 'input': 'search', + 'keyup': 'search', + 'change': 'search', + 'search': 'search' + }, + + render: function() { + this.el.value = this.model.escape('search'); + return this; + }, + + search: function( event ) { + if ( event.target.value ) + this.model.set( 'search', event.target.value ); + else + this.model.unset('search'); + } + }); + + /** + * wp.media.view.AttachmentFilters + */ + media.view.AttachmentFilters = media.View.extend({ + tagName: 'select', + className: 'attachment-filters', + + events: { + change: 'change' + }, + + keys: [], + + initialize: function() { + this.createFilters(); + _.extend( this.filters, this.options.filters ); + + // Build `