diff --git a/wp-admin/js/revisions.min.js b/wp-admin/js/revisions.min.js index 37eb98adfb..feeeeee379 100644 --- a/wp-admin/js/revisions.min.js +++ b/wp-admin/js/revisions.min.js @@ -1 +1 @@ -window.wp=window.wp||{};(function(b){var a;a=wp.revisions={model:{},view:{},controller:{}};a.settings=_.isUndefined(_wpRevisionsSettings)?{}:_wpRevisionsSettings;a.debug=true;a.log=function(){if(a.debug){console.log.apply(console,arguments)}};if(a.settings.selectedRevision){a.settings.selectedRevision=parseInt(a.settings.selectedRevision,10)}a.model.Slider=Backbone.Model.extend({defaults:{value:0,min:0,max:1,step:1}});a.model.Tooltip=Backbone.Model.extend({defaults:{revision:null,position:0}});a.model.Revision=Backbone.Model.extend({});a.model.Revisions=Backbone.Collection.extend({model:a.model.Revision,comparator:function(e,c){var g=e.get("dateUnix");var d=c.get("dateUnix");var f=(g>d)-(g')}},ready:function(){var c=this;c.numberOfTickmarksSet();b(window).on("resize",_.debounce(function(){c.$el.html("");c.numberOfTickmarksSet()},50))}});a.view.Meta=wp.Backbone.View.extend({className:"revisions-meta",template:wp.template("revisions-meta"),events:{"click .restore-revision":"restoreRevision"},initialize:function(){this.listenTo(this.model,"update:revisions",this.updateMeta)},restoreRevision:function(){var c=this.model.get("to").attributes.restoreUrl.replace(/&/g,"&");document.location=c},updateMeta:function(d,c){this.$el.html(this.template(this.model.toJSON()));this.$(".restore-revision").prop("disabled",c.attributes.current)}});a.view.Checkbox=wp.Backbone.View.extend({className:"revisions-checkbox",template:wp.template("revisions-checkbox"),events:{"click .compare-two-revisions":"compareTwoToggle"},initialize:function(){this.$el.html(this.template())},updateCompareTwoMode:function(){this.$(".compare-two-revisions").prop("checked",this.model.get("compareTwoMode"))},compareTwoToggle:function(c){this.model.set({compareTwoMode:b(".compare-two-revisions").prop("checked")});this.model.router.updateUrl()},ready:function(){if(this.model.revisions.length<3){b(".revision-toggle-compare-mode").hide()}this.listenTo(this.model,"change:compareTwoMode",this.updateCompareTwoMode);this.updateCompareTwoMode()}});a.view.Tooltip=wp.Backbone.View.extend({className:"revisions-tooltip",template:wp.template("revisions-tooltip"),initialize:function(){this.listenTo(this.model,"change",this.render)},ready:function(){this.$el.addClass("hidden")},show:function(){this.$el.removeClass("hidden")},hide:function(){this.$el.addClass("hidden")},render:function(){if(null===this.model.get("revision")){return}this.$el.html(this.template(this.model.get("revision").toJSON()));var c=b(".revisions-buttons").offset().left;this.$el.css("left",this.model.get("position")-c)}});a.view.Buttons=wp.Backbone.View.extend({className:"revisions-buttons",template:wp.template("revisions-buttons"),events:{"click #next":"nextRevision","click #previous":"previousRevision"},initialize:function(){this.$el.html(this.template())},ready:function(){this.listenTo(this.model,"update:revisions",this.disabledButtonCheck)},gotoModel:function(d){var c={to:this.model.revisions.at(isRtl?this.model.revisions.length-d-1:d)};if(isRtl?this.model.revisions.length-d-1:d){c.from=this.model.revisions.at(isRtl?this.model.revisions.length-d-2:d-1)}else{this.model.unset("from",{silent:true})}this.model.set(c);this.model.router.updateUrl()},nextRevision:function(){var c=isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-1:this.model.revisions.indexOf(this.model.get("to"));c=isRtl?c-1:c+1;this.gotoModel(c)},previousRevision:function(){var c=isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-1:this.model.revisions.indexOf(this.model.get("to"));c=isRtl?c+1:c-1;this.gotoModel(c)},disabledButtonCheck:function(){var g=this.model.revisions.length-1,c=0,d=b(".revisions-next .button"),e=b(".revisions-previous .button"),f=this.model.revisions.indexOf(this.model.get("to"));d.prop("disabled",(g===f));e.prop("disabled",(c===f))}});a.view.Slider=wp.Backbone.View.extend({className:"wp-slider",events:{mousemove:"mousemove",mouseleave:"mouseleave",mouseenter:"mouseenter"},initialize:function(c){_.bindAll(this,"start","slide","stop");this.tooltip=c.tooltip;var d=this.model.revisions.length-1;var e=this.model.revisions.indexOf(this.model.revisions.findWhere({id:a.settings.selectedRevision}));this.settings=new a.model.Slider({max:d,value:e,start:this.start,slide:this.slide,stop:this.stop})},ready:function(){this.settings.attributes.value=this.model.revisions.indexOf(this.model.revisions.findWhere({id:a.settings.selectedRevision}));this.updateSliderSettings();this.slide("",this.settings.attributes);this.$el.slider(this.settings.toJSON());this.listenTo(this.model,"change:compareTwoMode",this.updateSliderSettings);this.settings.on("change",function(){this.updateSliderSettings()},this);this.listenTo(this.model,"update:revisions",this.updateRevisions)},mousemove:function(k){var f=this.model.revisions.length-1,h=Math.ceil(this.$el.offset().left),g=this.$el.width(),c=Math.floor(g/f),j=k.clientX-h,d=Math.floor((j+c/2)/c),i=h+2+d*c;if(isRtl){d=this.model.revisions.length-d-1}if(d<0){d=0}else{if(d>=this.model.revisions.length){d=this.model.revisions.length-1}}this.tooltip.model.set("revision",this.model.revisions.at(d));this.tooltip.model.set("position",i)},mouseleave:function(c){this.tooltip.hide()},mouseenter:function(c){this.tooltip.show()},updateSliderSettings:function(){var d;if(this.model.get("compareTwoMode")){var e,c;if(_.isUndefined(this.model.get("from"))){if(isRtl){e=this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-2;c=e+1}else{e=this.model.revisions.indexOf(this.model.get("to"));c=e+1}}else{e=isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-1:this.model.revisions.indexOf(this.model.get("from")),c=isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("from"))-1:this.model.revisions.indexOf(this.model.get("to"))}this.$el.slider({values:[e,c],value:null,range:true});d=this.$("a.ui-slider-handle");d.first().toggleClass("right-handle",!!isRtl).toggleClass("left-handle",!isRtl);d.last().toggleClass("left-handle",!!isRtl).toggleClass("right-handle",!isRtl)}else{this.$el.slider({value:isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-1:this.model.revisions.indexOf(this.model.get("to")),values:null,range:false});this.$("a.ui-slider-handle").removeClass("left-handle right-handle")}},updateRevisions:function(d,c){if(this.model.get("compareTwoMode")){this.settings.set({values:[this.model.revisions.indexOf(d),this.model.revisions.indexOf(c)]})}else{this.settings.set({value:this.model.revisions.indexOf(c)})}},getSliderPosition:function(c){return isRtl?this.model.revisions.length-c.value-1:c.value},start:function(c,d){b(window).on("mousemove",{view:this},function(i){var j=i.data.view,n=j.$el.offset().left,f=n,g=n+j.$el.width(),l=g,m=0,o=g-f;if(j.model.get("compareTwoMode")){var k=b(d.handle).parent().find(".right-handle"),h=b(d.handle).parent().find(".left-handle");if(b(d.handle).hasClass("left-handle")){if(isRtl){n=k.offset().left+k.width();m=n-f}else{l=k.offset().left;o=l-f}}else{if(isRtl){l=h.offset().left;o=l-f}else{n=h.offset().left+h.width();m=n-f}}}if(i.clientXl){b(d.handle).css("left",o)}else{b(d.handle).css("left",i.clientX-f)}}})},slide:function(e,f){var d;if(!_.isUndefined(f.values)&&this.model.get("compareTwoMode")){if(f.values[1]===f.values[0]){return false}d={to:this.model.revisions.at(isRtl?this.model.revisions.length-f.values[0]-1:f.values[1]),from:this.model.revisions.at(isRtl?this.model.revisions.length-f.values[1]-1:f.values[0])}}else{var c=this.getSliderPosition(f);d={to:this.model.revisions.at(c)};if(c){d.from=this.model.revisions.at(c-1)}else{this.model.unset("from",{silent:true})}}this.model.set(d)},stop:function(c,d){b(window).off("mousemove");this.settings.trigger("change")}});a.view.Diff=wp.Backbone.View.extend({className:"revisions-diff",template:wp.template("revisions-diff"),prepare:function(){return _.extend({fields:this.model.fields.toJSON()},this.options)}});a.Router=Backbone.Router.extend({initialize:function(c){this.model=c.model;this.listenTo(this.model,"update:diff",_.debounce(this.updateUrl,250))},routes:{"from/:from/to/:to":"handleRoute","at/:to":"handleRoute"},updateUrl:function(){var d=this.model.has("from")?this.model.get("from").id:0;var c=this.model.get("to").id;if(this.model.get("compareTwoMode")){this.navigate("from/"+d+"/to/"+c)}else{this.navigate("at/"+c)}},handleRoute:function(e,d){var i,h,g;if(_.isUndefined(d)){d=e;e=0;g=false}else{g=true}i=parseInt(e,10);h=parseInt(d,10);this.model.set({compareTwoMode:g});if(!_.isUndefined(this.model)){var f=this.model.revisions.findWhere({id:h}),c=this.model.revisions.findWhere({id:i});this.model.set({to:f,from:c})}a.settings.selectedRevision=h}});a.init=function(){a.view.frame=new a.view.Frame({collection:new a.model.Revisions(a.settings.revisionData)}).render()};b(a.init)}(jQuery)); \ No newline at end of file +window.wp=window.wp||{};(function(b){var a;a=wp.revisions={model:{},view:{},controller:{}};a.settings=_.isUndefined(_wpRevisionsSettings)?{}:_wpRevisionsSettings;a.debug=true;a.log=function(){if(a.debug){console.log.apply(console,arguments)}};if(a.settings.selectedRevision){a.settings.selectedRevision=parseInt(a.settings.selectedRevision,10)}a.model.Slider=Backbone.Model.extend({defaults:{value:0,min:0,max:1,step:1}});a.model.Tooltip=Backbone.Model.extend({defaults:{revision:null,position:0}});a.model.Revision=Backbone.Model.extend({});a.model.Revisions=Backbone.Collection.extend({model:a.model.Revision,comparator:function(e,c){var g=e.get("dateUnix");var d=c.get("dateUnix");var f=(g>d)-(g')}},ready:function(){var c=this;c.numberOfTickmarksSet();b(window).on("resize",_.debounce(function(){c.$el.html("");c.numberOfTickmarksSet()},50))}});a.view.Meta=wp.Backbone.View.extend({className:"revisions-meta",template:wp.template("revisions-meta"),events:{"click .restore-revision":"restoreRevision"},initialize:function(){this.listenTo(this.model,"update:revisions",this.updateMeta)},restoreRevision:function(){var c=this.model.get("to").attributes.restoreUrl.replace(/&/g,"&");document.location=c},updateMeta:function(d,c){this.$el.html(this.template(this.model.toJSON()));this.$(".restore-revision").prop("disabled",c.attributes.current)}});a.view.Checkbox=wp.Backbone.View.extend({className:"revisions-checkbox",template:wp.template("revisions-checkbox"),events:{"click .compare-two-revisions":"compareTwoToggle"},initialize:function(){this.$el.html(this.template())},updateCompareTwoMode:function(){this.$(".compare-two-revisions").prop("checked",this.model.get("compareTwoMode"))},compareTwoToggle:function(c){this.model.set({compareTwoMode:b(".compare-two-revisions").prop("checked")});this.model.router.updateUrl()},ready:function(){if(this.model.revisions.length<3){b(".revision-toggle-compare-mode").hide()}this.listenTo(this.model,"change:compareTwoMode",this.updateCompareTwoMode);this.updateCompareTwoMode()}});a.view.Tooltip=wp.Backbone.View.extend({className:"revisions-tooltip",template:wp.template("revisions-tooltip"),initialize:function(){this.listenTo(this.model,"change",this.render)},ready:function(){this.$el.addClass("hidden")},show:function(){this.$el.removeClass("hidden")},hide:function(){this.$el.addClass("hidden")},render:function(){if(null===this.model.get("revision")){return}this.$el.html(this.template(this.model.get("revision").toJSON()));var c=b(".revisions-buttons").offset().left;this.$el.css("left",this.model.get("position")-c)}});a.view.Buttons=wp.Backbone.View.extend({className:"revisions-buttons",template:wp.template("revisions-buttons"),events:{"click #next":"nextRevision","click #previous":"previousRevision"},initialize:function(){this.$el.html(this.template())},ready:function(){this.listenTo(this.model,"update:revisions",this.disabledButtonCheck)},gotoModel:function(d){var c={to:this.model.revisions.at(isRtl?this.model.revisions.length-d-1:d)};if(isRtl?this.model.revisions.length-d-1:d){c.from=this.model.revisions.at(isRtl?this.model.revisions.length-d-2:d-1)}else{this.model.unset("from",{silent:true})}this.model.set(c);this.model.router.updateUrl()},nextRevision:function(){var c=isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-1:this.model.revisions.indexOf(this.model.get("to"));c=isRtl?c-1:c+1;this.gotoModel(c)},previousRevision:function(){var c=isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-1:this.model.revisions.indexOf(this.model.get("to"));c=isRtl?c+1:c-1;this.gotoModel(c)},disabledButtonCheck:function(){var g=this.model.revisions.length-1,c=0,d=b(".revisions-next .button"),e=b(".revisions-previous .button"),f=this.model.revisions.indexOf(this.model.get("to"));d.prop("disabled",(g===f));e.prop("disabled",(c===f))}});a.view.Slider=wp.Backbone.View.extend({className:"wp-slider",events:{mousemove:"mousemove",mouseleave:"mouseleave",mouseenter:"mouseenter"},initialize:function(c){_.bindAll(this,"start","slide","stop");this.tooltip=c.tooltip;var d=this.model.revisions.length-1;var e=this.model.revisions.indexOf(this.model.revisions.findWhere({id:a.settings.selectedRevision}));this.settings=new a.model.Slider({max:d,value:e,start:this.start,slide:this.slide,stop:this.stop})},ready:function(){this.settings.attributes.value=this.model.revisions.indexOf(this.model.revisions.findWhere({id:a.settings.selectedRevision}));this.updateSliderSettings();this.slide("",this.settings.attributes);this.$el.slider(this.settings.toJSON());this.listenTo(this.model,"change:compareTwoMode",this.updateSliderSettings);this.settings.on("change",function(){this.updateSliderSettings()},this);this.listenTo(this.model,"update:revisions",this.updateRevisions)},mousemove:function(k){var f=this.model.revisions.length-1,h=Math.ceil(this.$el.offset().left),g=this.$el.width(),c=Math.floor(g/f),j=k.clientX-h,d=Math.floor((j+c/2)/c),i=h+2+d*c;if(isRtl){d=this.model.revisions.length-d-1}if(d<0){d=0}else{if(d>=this.model.revisions.length){d=this.model.revisions.length-1}}this.tooltip.model.set("revision",this.model.revisions.at(d));this.tooltip.model.set("position",i)},mouseleave:function(c){this.tooltip.hide()},mouseenter:function(c){this.tooltip.show()},updateSliderSettings:function(){var d;if(this.model.get("compareTwoMode")){var e,c;if(_.isUndefined(this.model.get("from"))){if(isRtl){e=this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-2;c=e+1}else{e=this.model.revisions.indexOf(this.model.get("to"));c=e+1}}else{e=isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-1:this.model.revisions.indexOf(this.model.get("from")),c=isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("from"))-1:this.model.revisions.indexOf(this.model.get("to"))}this.$el.slider({values:[e,c],value:null,range:true});d=this.$("a.ui-slider-handle");d.first().toggleClass("right-handle",!!isRtl).toggleClass("left-handle",!isRtl);d.last().toggleClass("left-handle",!!isRtl).toggleClass("right-handle",!isRtl)}else{this.$el.slider({value:isRtl?this.model.revisions.length-this.model.revisions.indexOf(this.model.get("to"))-1:this.model.revisions.indexOf(this.model.get("to")),values:null,range:false});this.$("a.ui-slider-handle").removeClass("left-handle right-handle")}},updateRevisions:function(d,c){if(this.model.get("compareTwoMode")){this.settings.set({values:[this.model.revisions.indexOf(d),this.model.revisions.indexOf(c)]})}else{this.settings.set({value:this.model.revisions.indexOf(c)})}},getSliderPosition:function(c){return isRtl?this.model.revisions.length-c.value-1:c.value},start:function(c,d){b(window).on("mousemove",{view:this},function(i){var j=i.data.view,n=j.$el.offset().left,f=n,g=n+j.$el.width(),l=g,m=0,o=g-f;if(j.model.get("compareTwoMode")){var k=b(d.handle).parent().find(".right-handle"),h=b(d.handle).parent().find(".left-handle");if(b(d.handle).hasClass("left-handle")){if(isRtl){n=k.offset().left+k.width();m=n-f}else{l=k.offset().left;o=l-f}}else{if(isRtl){l=h.offset().left;o=l-f}else{n=h.offset().left+h.width();m=n-f}}}if(i.clientXl){b(d.handle).css("left",o)}else{b(d.handle).css("left",i.clientX-f)}}})},slide:function(e,f){var d;if(!_.isUndefined(f.values)&&this.model.get("compareTwoMode")){if(f.values[1]===f.values[0]){return false}d={to:this.model.revisions.at(isRtl?this.model.revisions.length-f.values[0]-1:f.values[1]),from:this.model.revisions.at(isRtl?this.model.revisions.length-f.values[1]-1:f.values[0])}}else{var c=this.getSliderPosition(f);d={to:this.model.revisions.at(c)};if(c){d.from=this.model.revisions.at(c-1)}else{this.model.unset("from",{silent:true})}}this.model.set(d)},stop:function(c,d){b(window).off("mousemove");this.settings.trigger("change")}});a.view.Diff=wp.Backbone.View.extend({className:"revisions-diff",template:wp.template("revisions-diff"),prepare:function(){return _.extend({fields:this.model.fields.toJSON()},this.options)}});a.Router=Backbone.Router.extend({initialize:function(c){this.model=c.model;this.listenTo(this.model,"update:diff",_.debounce(this.updateUrl,250))},routes:{"from/:from/to/:to":"handleRoute","at/:to":"handleRoute"},updateUrl:function(){var d=this.model.has("from")?this.model.get("from").id:0;var c=this.model.get("to").id;if(this.model.get("compareTwoMode")){this.navigate("from/"+d+"/to/"+c)}else{this.navigate("at/"+c)}},handleRoute:function(e,d){var i,h,g;if(_.isUndefined(d)){d=e;e=0;g=false}else{g=true}i=parseInt(e,10);h=parseInt(d,10);this.model.set({compareTwoMode:g});if(!_.isUndefined(this.model)){var f=this.model.revisions.findWhere({id:h}),c=this.model.revisions.findWhere({id:i});this.model.set({to:f,from:c})}a.settings.selectedRevision=h}});a.init=function(){a.view.frame=new a.view.Frame({collection:new a.model.Revisions(a.settings.revisionData)}).render()};b(a.init)}(jQuery)); \ No newline at end of file diff --git a/wp-includes/js/media-models.min.js b/wp-includes/js/media-models.min.js index c201cdb7c1..274c2fe9e6 100644 --- a/wp-includes/js/media-models.min.js +++ b/wp-includes/js/media-models.min.js @@ -1 +1 @@ -window.wp=window.wp||{};(function(g){var e,d,b,f,c,h,a;h=wp.media=function(i){var j=h.view.MediaFrame,k;if(!j){return}i=_.defaults(i||{},{frame:"select"});if("select"===i.frame&&j.Select){k=new j.Select(i)}else{if("post"===i.frame&&j.Post){k=new j.Post(i)}}delete i.frame;return k};_.extend(h,{model:{},view:{},controller:{},frames:{}});c=h.model.l10n=typeof _wpMediaModelsL10n==="undefined"?{}:_wpMediaModelsL10n;h.model.settings=c.settings||{};delete c.settings;f=function(j,i,k,l){if(_.isEqual(j,i)){return k===l?0:(k>l?-1:1)}else{return j>i?-1:1}};a=function(k,j){var l=j.success,i=j.error;j.success=function(m){if(l){l(m)}k.trigger("sync",k,m,j)};j.error=function(m){if(i){i(m)}k.trigger("error",k,m,j)};return j};_.extend(h,{template:wp.template,post:wp.xhr.post,ajax:wp.xhr.send,fit:function(m){var j=m.width,i=m.height,l=m.maxWidth,k=m.maxHeight,n;if(!_.isUndefined(l)&&!_.isUndefined(k)){n=(j/i>l/k)?"width":"height"}else{if(_.isUndefined(k)){n="width"}else{if(_.isUndefined(l)&&i>k){n="height"}}}if("width"===n&&j>l){return{width:l,height:Math.round(l*i/j)}}else{if("height"===n&&i>k){return{width:Math.round(k*j/i),height:k}}else{return{width:j,height:i}}}},truncate:function(i,k,j){k=k||30;j=j||"…";if(i.length<=k){return i}return i.substr(0,k/2)+j+i.substr(-1*k/2)}});h.attachment=function(i){return e.get(i)};e=h.model.Attachment=Backbone.Model.extend({sync:function(k,j,i){if(_.isUndefined(this.id)){return g.Deferred().rejectWith(this).promise()}if("read"===k){i=i||{};i.context=this;i.data=_.extend(i.data||{},{action:"get-attachment",id:this.id});a(j,i);return h.ajax(i)}else{if("update"===k){if(!this.get("nonces")||!this.get("nonces").update){return g.Deferred().rejectWith(this).promise()}i=i||{};i.context=this;i.data=_.extend(i.data||{},{action:"save-attachment",id:this.id,nonce:this.get("nonces").update,post_id:h.model.settings.post.id});if(j.hasChanged()){i.data.changes={};_.each(j.changed,function(m,l){i.data.changes[l]=this.get(l)},this)}a(j,i);return h.ajax(i)}else{if("delete"===k){i=i||{};if(!i.wait){this.destroyed=true}i.context=this;i.data=_.extend(i.data||{},{action:"delete-post",id:this.id,_wpnonce:this.get("nonces")["delete"]});a(j,i);return h.ajax(i).done(function(){this.destroyed=true}).fail(function(){this.destroyed=false})}else{return Backbone.Model.prototype.sync.apply(this,arguments)}}}},parse:function(j,i){if(!j){return j}j.date=new Date(j.date);j.modified=new Date(j.modified);return j},saveCompat:function(k,j){var i=this;if(!this.get("nonces")||!this.get("nonces").update){return g.Deferred().rejectWith(this).promise()}return h.post("save-attachment-compat",_.defaults({id:this.id,nonce:this.get("nonces").update,post_id:h.model.settings.post.id},k)).done(function(n,l,m){i.set(i.parse(n,m),j)})}},{create:function(i){return d.all.push(i)},get:_.memoize(function(j,i){return d.all.push(i||{id:j})})});d=h.model.Attachments=Backbone.Collection.extend({model:e,initialize:function(j,i){i=i||{};this.props=new Backbone.Model();this.filters=i.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(i.props||{}));if(i.observe){this.observe(i.observe)}},_changeOrder:function(j,i){if(this.comparator){this.sort()}},_changeOrderby:function(i,j){if(this.comparator&&this.comparator!==d.comparator){return}if(j&&"post__in"!==j){this.comparator=d.comparator}else{delete this.comparator}},_changeQuery:function(i,j){if(j){this.props.on("change",this._requery,this);this._requery()}else{this.props.off("change",this._requery,this)}},_changeFilteredProps:function(j,i){if(this.props.get("query")){return}var k=_.chain(j.changed).map(function(m,o){var n=d.filters[o],l=j.get(o);if(!n){return}if(l&&!this.filters[o]){this.filters[o]=n}else{if(!l&&this.filters[o]===n){delete this.filters[o]}else{return}}return true},this).any().value();if(!k){return}if(!this._source){this._source=new d(this.models)}this.reset(this._source.filter(this.validator,this))},validateDestroyed:false,validator:function(i){if(!this.validateDestroyed&&i.destroyed){return false}return _.all(this.filters,function(k,j){return !!k.call(this,i)},this)},validate:function(l,j){var k=this.validator(l),i=!!this.get(l.cid);if(!k&&i){this.remove(l,j)}else{if(k&&!i){this.add(l,j)}}return this},validateAll:function(i,j){j=j||{};_.each(i.models,function(k){this.validate(k,{silent:true})},this);if(!j.silent){this.trigger("reset",this,j)}return this},observe:function(i){this.observers=this.observers||[];this.observers.push(i);i.on("add change remove",this._validateHandler,this);i.on("reset",this._validateAllHandler,this);this.validateAll(i);return this},unobserve:function(i){if(i){i.off(null,null,this);this.observers=_.without(this.observers,i)}else{_.each(this.observers,function(j){j.off(null,null,this)},this);delete this.observers}return this},_validateHandler:function(k,i,j){j=i===this.mirroring?j:{silent:j&&j.silent};return this.validate(k,j)},_validateAllHandler:function(i,j){return this.validateAll(i,j)},mirror:function(i){if(this.mirroring&&this.mirroring===i){return this}this.unmirror();this.mirroring=i;this.reset([],{silent:true});this.observe(i);return this},unmirror:function(){if(!this.mirroring){return}this.unobserve(this.mirroring);delete this.mirroring},more:function(k){var j=g.Deferred(),l=this.mirroring,i=this;if(!l||!l.more){return j.resolveWith(this).promise()}l.more(k).done(function(){if(this===i.mirroring){j.resolveWith(this)}});return j.promise()},hasMore:function(){return this.mirroring?this.mirroring.hasMore():false},_requery:function(){if(this.props.get("query")){this.mirror(b.get(this.props.toJSON()))}},saveMenuOrder:function(){if("menuOrder"!==this.props.get("orderby")){return}var i=this.chain().filter(function(j){return !_.isUndefined(j.id)}).map(function(k,j){j=j+1;k.set("menuOrder",j);return[k.id,j]}).object().value();if(_.isEmpty(i)){return}return h.post("save-attachment-order",{nonce:h.model.settings.post.nonce,post_id:h.model.settings.post.id,attachments:i})}},{comparator:function(k,j,l){var m=this.props.get("orderby"),i=this.props.get("order")||"DESC",n=k.cid,o=j.cid;k=k.get(m);j=j.get(m);if("date"===m||"modified"===m){k=k||new Date();j=j||new Date()}if(l&&l.ties){n=o=null}return("DESC"===i)?f(k,j,n,o):f(j,k,o,n)},filters:{search:function(i){if(!this.props.get("search")){return true}return _.any(["title","filename","description","caption","name"],function(j){var k=i.get(j);return k&&-1!==k.search(this.props.get("search"))},this)},type:function(j){var i=this.props.get("type");return !i||-1!==i.indexOf(j.get("type"))},uploadedTo:function(j){var i=this.props.get("uploadedTo");if(_.isUndefined(i)){return true}return i===j.get("uploadedTo")}}});d.all=new d();h.query=function(i){return new d(null,{props:_.extend(_.defaults(i||{},{orderby:"date"}),{query:true})})};b=h.model.Query=d.extend({initialize:function(k,i){var j;i=i||{};d.prototype.initialize.apply(this,arguments);this.args=i.args;this._hasMore=true;this.created=new Date();this.filters.order=function(n){var m=this.props.get("orderby"),l=this.props.get("order");if(!this.comparator){return true}if(this.length){return 1!==this.comparator(n,this.last(),{ties:true})}else{if("DESC"===l&&("date"===m||"modified"===m)){return n.get(m)>=this.created}else{if("ASC"===l&&"menuOrder"===m){return n.get(m)===0}}}return false};j=["s","order","orderby","posts_per_page","post_mime_type","post_parent"];if(wp.Uploader&&_(this.args).chain().keys().difference(j).isEmpty().value()){this.observe(wp.Uploader.queue)}},hasMore:function(){return this._hasMore},more:function(i){var j=this;if(this._more&&"pending"===this._more.state()){return this._more}if(!this.hasMore()){return g.Deferred().resolveWith(this).promise()}i=i||{};i.remove=false;return this._more=this.fetch(i).done(function(k){if(_.isEmpty(k)||-1===this.args.posts_per_page||k.lengthl?-1:1)}else{return j>i?-1:1}};a=function(k,j){var l=j.success,i=j.error;j.success=function(m){if(l){l(m)}k.trigger("sync",k,m,j)};j.error=function(m){if(i){i(m)}k.trigger("error",k,m,j)};return j};_.extend(h,{template:wp.template,post:wp.ajax.post,ajax:wp.ajax.send,fit:function(m){var j=m.width,i=m.height,l=m.maxWidth,k=m.maxHeight,n;if(!_.isUndefined(l)&&!_.isUndefined(k)){n=(j/i>l/k)?"width":"height"}else{if(_.isUndefined(k)){n="width"}else{if(_.isUndefined(l)&&i>k){n="height"}}}if("width"===n&&j>l){return{width:l,height:Math.round(l*i/j)}}else{if("height"===n&&i>k){return{width:Math.round(k*j/i),height:k}}else{return{width:j,height:i}}}},truncate:function(i,k,j){k=k||30;j=j||"…";if(i.length<=k){return i}return i.substr(0,k/2)+j+i.substr(-1*k/2)}});h.attachment=function(i){return e.get(i)};e=h.model.Attachment=Backbone.Model.extend({sync:function(k,j,i){if(_.isUndefined(this.id)){return g.Deferred().rejectWith(this).promise()}if("read"===k){i=i||{};i.context=this;i.data=_.extend(i.data||{},{action:"get-attachment",id:this.id});a(j,i);return h.ajax(i)}else{if("update"===k){if(!this.get("nonces")||!this.get("nonces").update){return g.Deferred().rejectWith(this).promise()}i=i||{};i.context=this;i.data=_.extend(i.data||{},{action:"save-attachment",id:this.id,nonce:this.get("nonces").update,post_id:h.model.settings.post.id});if(j.hasChanged()){i.data.changes={};_.each(j.changed,function(m,l){i.data.changes[l]=this.get(l)},this)}a(j,i);return h.ajax(i)}else{if("delete"===k){i=i||{};if(!i.wait){this.destroyed=true}i.context=this;i.data=_.extend(i.data||{},{action:"delete-post",id:this.id,_wpnonce:this.get("nonces")["delete"]});a(j,i);return h.ajax(i).done(function(){this.destroyed=true}).fail(function(){this.destroyed=false})}else{return Backbone.Model.prototype.sync.apply(this,arguments)}}}},parse:function(j,i){if(!j){return j}j.date=new Date(j.date);j.modified=new Date(j.modified);return j},saveCompat:function(k,j){var i=this;if(!this.get("nonces")||!this.get("nonces").update){return g.Deferred().rejectWith(this).promise()}return h.post("save-attachment-compat",_.defaults({id:this.id,nonce:this.get("nonces").update,post_id:h.model.settings.post.id},k)).done(function(n,l,m){i.set(i.parse(n,m),j)})}},{create:function(i){return d.all.push(i)},get:_.memoize(function(j,i){return d.all.push(i||{id:j})})});d=h.model.Attachments=Backbone.Collection.extend({model:e,initialize:function(j,i){i=i||{};this.props=new Backbone.Model();this.filters=i.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(i.props||{}));if(i.observe){this.observe(i.observe)}},_changeOrder:function(j,i){if(this.comparator){this.sort()}},_changeOrderby:function(i,j){if(this.comparator&&this.comparator!==d.comparator){return}if(j&&"post__in"!==j){this.comparator=d.comparator}else{delete this.comparator}},_changeQuery:function(i,j){if(j){this.props.on("change",this._requery,this);this._requery()}else{this.props.off("change",this._requery,this)}},_changeFilteredProps:function(j,i){if(this.props.get("query")){return}var k=_.chain(j.changed).map(function(m,o){var n=d.filters[o],l=j.get(o);if(!n){return}if(l&&!this.filters[o]){this.filters[o]=n}else{if(!l&&this.filters[o]===n){delete this.filters[o]}else{return}}return true},this).any().value();if(!k){return}if(!this._source){this._source=new d(this.models)}this.reset(this._source.filter(this.validator,this))},validateDestroyed:false,validator:function(i){if(!this.validateDestroyed&&i.destroyed){return false}return _.all(this.filters,function(k,j){return !!k.call(this,i)},this)},validate:function(l,j){var k=this.validator(l),i=!!this.get(l.cid);if(!k&&i){this.remove(l,j)}else{if(k&&!i){this.add(l,j)}}return this},validateAll:function(i,j){j=j||{};_.each(i.models,function(k){this.validate(k,{silent:true})},this);if(!j.silent){this.trigger("reset",this,j)}return this},observe:function(i){this.observers=this.observers||[];this.observers.push(i);i.on("add change remove",this._validateHandler,this);i.on("reset",this._validateAllHandler,this);this.validateAll(i);return this},unobserve:function(i){if(i){i.off(null,null,this);this.observers=_.without(this.observers,i)}else{_.each(this.observers,function(j){j.off(null,null,this)},this);delete this.observers}return this},_validateHandler:function(k,i,j){j=i===this.mirroring?j:{silent:j&&j.silent};return this.validate(k,j)},_validateAllHandler:function(i,j){return this.validateAll(i,j)},mirror:function(i){if(this.mirroring&&this.mirroring===i){return this}this.unmirror();this.mirroring=i;this.reset([],{silent:true});this.observe(i);return this},unmirror:function(){if(!this.mirroring){return}this.unobserve(this.mirroring);delete this.mirroring},more:function(k){var j=g.Deferred(),l=this.mirroring,i=this;if(!l||!l.more){return j.resolveWith(this).promise()}l.more(k).done(function(){if(this===i.mirroring){j.resolveWith(this)}});return j.promise()},hasMore:function(){return this.mirroring?this.mirroring.hasMore():false},_requery:function(){if(this.props.get("query")){this.mirror(b.get(this.props.toJSON()))}},saveMenuOrder:function(){if("menuOrder"!==this.props.get("orderby")){return}var i=this.chain().filter(function(j){return !_.isUndefined(j.id)}).map(function(k,j){j=j+1;k.set("menuOrder",j);return[k.id,j]}).object().value();if(_.isEmpty(i)){return}return h.post("save-attachment-order",{nonce:h.model.settings.post.nonce,post_id:h.model.settings.post.id,attachments:i})}},{comparator:function(k,j,l){var m=this.props.get("orderby"),i=this.props.get("order")||"DESC",n=k.cid,o=j.cid;k=k.get(m);j=j.get(m);if("date"===m||"modified"===m){k=k||new Date();j=j||new Date()}if(l&&l.ties){n=o=null}return("DESC"===i)?f(k,j,n,o):f(j,k,o,n)},filters:{search:function(i){if(!this.props.get("search")){return true}return _.any(["title","filename","description","caption","name"],function(j){var k=i.get(j);return k&&-1!==k.search(this.props.get("search"))},this)},type:function(j){var i=this.props.get("type");return !i||-1!==i.indexOf(j.get("type"))},uploadedTo:function(j){var i=this.props.get("uploadedTo");if(_.isUndefined(i)){return true}return i===j.get("uploadedTo")}}});d.all=new d();h.query=function(i){return new d(null,{props:_.extend(_.defaults(i||{},{orderby:"date"}),{query:true})})};b=h.model.Query=d.extend({initialize:function(k,i){var j;i=i||{};d.prototype.initialize.apply(this,arguments);this.args=i.args;this._hasMore=true;this.created=new Date();this.filters.order=function(n){var m=this.props.get("orderby"),l=this.props.get("order");if(!this.comparator){return true}if(this.length){return 1!==this.comparator(n,this.last(),{ties:true})}else{if("DESC"===l&&("date"===m||"modified"===m)){return n.get(m)>=this.created}else{if("ASC"===l&&"menuOrder"===m){return n.get(m)===0}}}return false};j=["s","order","orderby","posts_per_page","post_mime_type","post_parent"];if(wp.Uploader&&_(this.args).chain().keys().difference(j).isEmpty().value()){this.observe(wp.Uploader.queue)}},hasMore:function(){return this._hasMore},more:function(i){var j=this;if(this._more&&"pending"===this._more.state()){return this._more}if(!this.hasMore()){return g.Deferred().resolveWith(this).promise()}i=i||{};i.remove=false;return this._more=this.fetch(i).done(function(k){if(_.isEmpty(k)||-1===this.args.posts_per_page||k.length/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(f){d=d||_.template(b("#tmpl-"+e).html(),null,c);return d(f)}});wp.xhr={settings:a.xhr||{},post:function(d,c){return wp.xhr.send({data:_.isObject(d)?d:_.extend(c||{},{action:d})})},send:function(d,c){if(_.isObject(d)){c=d}else{c=c||{};c.data=_.extend(c.data||{},{action:d})}c=_.defaults(c||{},{type:"POST",url:wp.xhr.settings.url,context:this});return b.Deferred(function(e){if(c.success){e.done(c.success)}if(c.error){e.fail(c.error)}delete c.success;delete c.error;b.ajax(c).done(function(f){if(f==="1"||f===1){f={success:true}}if(_.isObject(f)&&!_.isUndefined(f.success)){e[f.success?"resolveWith":"rejectWith"](this,[f.data])}else{e.rejectWith(this,[f])}}).fail(function(){e.rejectWith(this,arguments)})}).promise()}}}(jQuery)); \ No newline at end of file +window.wp=window.wp||{};(function(b){var a=typeof _wpUtilSettings==="undefined"?{}:_wpUtilSettings;wp.template=_.memoize(function(e){var d,c={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(f){d=d||_.template(b("#tmpl-"+e).html(),null,c);return d(f)}});wp.ajax={settings:a.ajax||{},post:function(d,c){return wp.ajax.send({data:_.isObject(d)?d:_.extend(c||{},{action:d})})},send:function(d,c){if(_.isObject(d)){c=d}else{c=c||{};c.data=_.extend(c.data||{},{action:d})}c=_.defaults(c||{},{type:"POST",url:wp.ajax.settings.url,context:this});return b.Deferred(function(e){if(c.success){e.done(c.success)}if(c.error){e.fail(c.error)}delete c.success;delete c.error;b.ajax(c).done(function(f){if(f==="1"||f===1){f={success:true}}if(_.isObject(f)&&!_.isUndefined(f.success)){e[f.success?"resolveWith":"rejectWith"](this,[f.data])}else{e.rejectWith(this,[f])}}).fail(function(){e.rejectWith(this,arguments)})}).promise()}}}(jQuery)); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index cbf59dc986..41d334555b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '3.6-beta4-24647'; +$wp_version = '3.6-beta4-24653'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.