mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-19 17:15:16 +01:00
bfcaab99e0
This updates the 4.3 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy. Because older branches use (really) old versions of NodeJS, the local Docker environment cannot be backported since the needed dependencies will not run on these older versions (see #48301). This also blocks the ability to move automated testing over to GitHub Actions (see #50401). This change also introduces a `packager-lock.json` file to the branch. In addition to backporting the package updates that happened after branching 4.3, dependencies that were removed in future releases have also been updated to their latest versions. Props desrosj, dd32, netweb, jorbin. Merges [33726,34888,35332,35335,35363,35513,35520-35521,35538-35541,35562-35563,35859-36865,36935,36978-36980,37017,37019-37020,37212,37612,38111,38688,39110,39113-39119,39478,42460-42461,42463,42887,43320,43323,43977,44219,44233,44728,45321,45765,46404,46408-46409,47404,47867-47869,47872-47873,48705,49636,49933,49937,49939,50017,50126,50176,50185] to the 4.3 branch. See #52341. Built from https://develop.svn.wordpress.org/branches/4.3@50212 git-svn-id: http://core.svn.wordpress.org/branches/4.3@49882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
8.8 KiB
JavaScript
1 line
8.8 KiB
JavaScript
var wpWidgets;!function(c){var g=c(document);wpWidgets={hoveredSidebar:null,init:function(){var r,o,s=this,i=c(".widgets-chooser"),d=i.find(".widgets-chooser-sidebars"),e=c("div.widgets-sortables"),l=!("undefined"==typeof isRtl||!isRtl);c("#widgets-right .sidebar-name").click(function(){var e=c(this),i=e.closest(".widgets-holder-wrap");i.hasClass("closed")?(i.removeClass("closed"),e.parent().sortable("refresh")):i.addClass("closed"),g.triggerHandler("wp-pin-menu")}),c("#widgets-left .sidebar-name").click(function(){c(this).closest(".widgets-holder-wrap").toggleClass("closed"),g.triggerHandler("wp-pin-menu")}),c(document.body).bind("click.widgets-toggle",function(e){var i,t,s,d,n=c(e.target),a={"z-index":100};n.parents(".widget-top").length&&!n.parents("#available-widgets").length?(t=(i=n.closest("div.widget")).children(".widget-inside"),s=parseInt(i.find("input.widget-width").val(),10),d=i.parent().width(),t.is(":hidden")?(250<s&&d<s+30&&i.closest("div.widgets-sortables").length&&(a[i.closest("div.widget-liquid-right").length?l?"margin-right":"margin-left":l?"margin-left":"margin-right"]=d-(s+30)+"px",i.css(a)),i.addClass("open"),t.slideDown("fast")):t.slideUp("fast",function(){i.attr("style",""),i.removeClass("open")}),e.preventDefault()):n.hasClass("widget-control-save")?(wpWidgets.save(n.closest("div.widget"),0,1,0),e.preventDefault()):n.hasClass("widget-control-remove")?(wpWidgets.save(n.closest("div.widget"),1,1,0),e.preventDefault()):n.hasClass("widget-control-close")&&((i=n.closest("div.widget")).removeClass("open"),wpWidgets.close(i),e.preventDefault())}),e.children(".widget").each(function(){var e=c(this);wpWidgets.appendTitle(this),e.find("p.widget-error").length&&e.find("a.widget-action").trigger("click")}),c("#widget-list").children(".widget").draggable({connectToSortable:"div.widgets-sortables",handle:"> .widget-top > .widget-title",distance:2,helper:"clone",zIndex:100,containment:"#wpwrap",refreshPositions:!0,start:function(e,i){var t=c(this).find(".widgets-chooser");i.helper.find("div.widget-description").hide(),o=this.id,t.length&&(c("#wpbody-content").append(t.hide()),i.helper.find(".widgets-chooser").remove(),s.clearWidgetSelection())},stop:function(){r&&c(r).hide(),r=""}}),e.droppable({tolerance:"intersect",over:function(e){var i=c(e.target).parent();wpWidgets.hoveredSidebar&&!i.is(wpWidgets.hoveredSidebar)&&wpWidgets.closeSidebar(e),i.hasClass("closed")&&(wpWidgets.hoveredSidebar=i).removeClass("closed"),c(this).sortable("refresh")},out:function(e){wpWidgets.hoveredSidebar&&wpWidgets.closeSidebar(e)}}),e.sortable({placeholder:"widget-placeholder",items:"> .widget",handle:"> .widget-top > .widget-title",cursor:"move",distance:2,containment:"#wpwrap",tolerance:"pointer",refreshPositions:!0,start:function(e,i){var t=c(this),s=t.parent(),d=i.item.children(".widget-inside");"block"===d.css("display")&&(d.hide(),c(this).sortable("refreshPositions")),s.hasClass("closed")||(i=i.item.hasClass("ui-draggable")?t.height():1+t.height(),t.css("min-height",i+"px"))},stop:function(e,i){var t,s,d,n=i.item,a=o;if(wpWidgets.hoveredSidebar=null,n.hasClass("deleting"))return wpWidgets.save(n,1,0,1),void n.remove();t=n.find("input.add_new").val(),s=n.find("input.multi_number").val(),n.attr("style","").removeClass("ui-draggable"),o="",t&&("multi"===t?(n.html(n.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,s)})),n.attr("id",a.replace("__i__",s)),s++,c("div#"+a).find("input.multi_number").val(s)):"single"===t&&(n.attr("id","new-"+a),r="div#"+a),wpWidgets.save(n,0,0,1),n.find("input.add_new").val(""),g.trigger("widget-added",[n])),(d=n.parent()).parent().hasClass("closed")&&(d.parent().removeClass("closed"),1<(i=d.children(".widget")).length&&(a=i.get(0),i=n.get(0),a.id&&i.id&&a.id!==i.id&&c(a).before(n))),t?n.find("a.widget-action").trigger("click"):wpWidgets.saveOrder(d.attr("id"))},activate:function(){c(this).parent().addClass("widget-hover")},deactivate:function(){c(this).css("min-height","").parent().removeClass("widget-hover")},receive:function(e,i){i=c(i.sender);-1<this.id.indexOf("orphaned_widgets")?i.sortable("cancel"):-1<i.attr("id").indexOf("orphaned_widgets")&&!i.children(".widget").length&&i.parents(".orphan-sidebar").slideUp(400,function(){c(this).remove()})}}).sortable("option","connectWith","div.widgets-sortables"),c("#available-widgets").droppable({tolerance:"pointer",accept:function(e){return"widget-list"!==c(e).parent().attr("id")},drop:function(e,i){i.draggable.addClass("deleting"),c("#removing-widget").hide().children("span").empty()},over:function(e,i){i.draggable.addClass("deleting"),c("div.widget-placeholder").hide(),i.draggable.hasClass("ui-sortable-helper")&&c("#removing-widget").show().children("span").html(i.draggable.find("div.widget-title").children("h4").html())},out:function(e,i){i.draggable.removeClass("deleting"),c("div.widget-placeholder").show(),c("#removing-widget").hide().children("span").empty()}}),c("#widgets-right .widgets-holder-wrap").each(function(e,i){var t=c(i),i=t.find(".sidebar-name h3").text(),t=t.find(".widgets-sortables").attr("id"),i=c('<li tabindex="0">').text(c.trim(i));0===e&&i.addClass("widgets-chooser-selected"),d.append(i),i.data("sidebarId",t)}),c("#available-widgets .widget .widget-title").on("click.widgets-chooser",function(){var e=c(this).closest(".widget");e.hasClass("widget-in-question")||c("#widgets-left").hasClass("chooser")?s.closeChooser():(s.clearWidgetSelection(),c("#widgets-left").addClass("chooser"),e.addClass("widget-in-question").children(".widget-description").after(i),i.slideDown(300,function(){d.find(".widgets-chooser-selected").focus()}),d.find("li").on("focusin.widgets-chooser",function(){d.find(".widgets-chooser-selected").removeClass("widgets-chooser-selected"),c(this).addClass("widgets-chooser-selected")}))}),i.on("click.widgets-chooser",function(e){e=c(e.target);e.hasClass("button-primary")?(s.addWidget(i),s.closeChooser()):e.hasClass("button-secondary")&&s.closeChooser()}).on("keyup.widgets-chooser",function(e){e.which===c.ui.keyCode.ENTER?(c(e.target).hasClass("button-secondary")||s.addWidget(i),s.closeChooser()):e.which===c.ui.keyCode.ESCAPE&&s.closeChooser()})},saveOrder:function(e){var i={action:"widgets-order",savewidgets:c("#_wpnonce_widgets").val(),sidebars:[]};e&&c("#"+e).find(".spinner:first").addClass("is-active"),c("div.widgets-sortables").each(function(){c(this).sortable&&(i["sidebars["+c(this).attr("id")+"]"]=c(this).sortable("toArray").join(","))}),c.post(ajaxurl,i,function(){c(".spinner").removeClass("is-active")})},save:function(t,s,d,n){var e=t.closest("div.widgets-sortables").attr("id"),i=t.find("form").serialize();t=c(t),c(".spinner",t).addClass("is-active"),e={action:"save-widget",savewidgets:c("#_wpnonce_widgets").val(),sidebar:e},s&&(e.delete_widget=1),i+="&"+c.param(e),c.post(ajaxurl,i,function(e){var i;s?(c("input.widget_number",t).val()||(i=c("input.widget-id",t).val(),c("#available-widgets").find("input.widget-id").each(function(){c(this).val()===i&&c(this).closest("div.widget").show()})),d?(n=0,t.slideUp("fast",function(){c(this).remove(),wpWidgets.saveOrder()})):t.remove()):(c(".spinner").removeClass("is-active"),e&&2<e.length&&(c("div.widget-content",t).html(e),wpWidgets.appendTitle(t),g.trigger("widget-updated",[t]))),n&&wpWidgets.saveOrder()})},appendTitle:function(e){var i=(i=c('input[id*="-title"]',e).val()||"")&&": "+i.replace(/<[^<>]+>/g,"").replace(/</g,"<").replace(/>/g,">");c(e).children(".widget-top").children(".widget-title").children().children(".in-widget-title").html(i)},close:function(e){e.children(".widget-inside").slideUp("fast",function(){e.attr("style","")})},addWidget:function(e){var i=e.find(".widgets-chooser-selected").data("sidebarId"),t=c("#"+i),s=c("#available-widgets").find(".widget-in-question").clone(),d=s.attr("id"),e=s.find("input.add_new").val(),n=s.find("input.multi_number").val();s.find(".widgets-chooser").remove(),"multi"===e?(s.html(s.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,n)})),s.attr("id",d.replace("__i__",n)),n++,c("#"+d).find("input.multi_number").val(n)):"single"===e&&(s.attr("id","new-"+d),c("#"+d).hide()),t.closest(".widgets-holder-wrap").removeClass("closed"),t.append(s),t.sortable("refresh"),wpWidgets.save(s,0,0,1),s.find("input.add_new").val(""),g.trigger("widget-added",[s]),e=(i=c(window).scrollTop())+c(window).height(),(d=t.offset()).bottom=d.top+t.outerHeight(),(i>d.bottom||e<d.top)&&c("html, body").animate({scrollTop:d.top-130},200),window.setTimeout(function(){s.find(".widget-title").trigger("click")},250)},closeChooser:function(){var e=this;c(".widgets-chooser").slideUp(200,function(){c("#wpbody-content").append(this),e.clearWidgetSelection()})},clearWidgetSelection:function(){c("#widgets-left").removeClass("chooser"),c(".widget-in-question").removeClass("widget-in-question")},closeSidebar:function(e){this.hoveredSidebar.addClass("closed"),c(e.target).css("min-height",""),this.hoveredSidebar=null}},g.ready(function(){wpWidgets.init()})}(jQuery); |