diff --git a/bu-navigation.php b/bu-navigation.php index 8bb3ab8..b4d3cef 100644 --- a/bu-navigation.php +++ b/bu-navigation.php @@ -5,7 +5,7 @@ Author: Boston University (IS&T) Author URI: http://sites.bu.edu/web/ Description: Provides alternative navigation elements designed for blogs with large page counts -Version: 1.2.19 +Version: 1.2.20 Text Domain: bu-navigation Domain Path: /languages */ @@ -60,7 +60,7 @@ class BU_Navigation_Plugin { // Plugin settings public $settings; - const VERSION = '1.2.19'; + const VERSION = '1.2.20'; public function __construct() { diff --git a/js/manage.js b/js/manage.js index d908cb0..38c9483 100644 --- a/js/manage.js +++ b/js/manage.js @@ -337,13 +337,13 @@ if ((typeof bu === 'undefined') || edit: function (link) { - $(this.ui.urlField).attr("value", link.post_content); - $(this.ui.labelField).attr("value", link.post_title); + $(this.ui.urlField).prop("value", link.post_content); + $(this.ui.labelField).prop("value", link.post_title); if ('new' === link.post_meta.bu_link_target) { - $(this.ui.targetNewField).attr("checked", "checked"); + $(this.ui.targetNewField).prop("checked", true); } else { - $(this.ui.targetSameField).attr("checked", "checked"); + $(this.ui.targetSameField).prop("checked", true); } this.data.currentLink = link; @@ -361,10 +361,10 @@ if ((typeof bu === 'undefined') || var link = this.data.currentLink, saved, selected; // Extract updates from form - link.post_content = $(this.ui.urlField).attr("value"); - link.post_title = $(this.ui.labelField).attr("value"); + link.post_content = $(this.ui.urlField).prop("value"); + link.post_title = $(this.ui.labelField).prop("value"); link.url = link.post_content; - link.post_meta.bu_link_target = $("input[name='editlink_target']:checked").attr("value"); + link.post_meta.bu_link_target = $("input[name='editlink_target']:checked").prop("value"); selected = Navtree.getSelectedPost(); diff --git a/js/manage.min.js b/js/manage.min.js index d9ed2f2..4934ae1 100644 --- a/js/manage.min.js +++ b/js/manage.min.js @@ -1 +1 @@ -if("undefined"==typeof bu||void 0===bu.plugins.navigation||void 0===bu.plugins.navigation.tree)throw new TypeError("BU Navigation Manager script dependencies have not been met!");!function(a){"use strict";bu.plugins.navigation.views=bu.plugins.navigation.views||{};var b,c,d;b=bu.plugins.navigation.views.Navman={el:"#nav-tree-container",ui:{form:"#navman_form",noticesContainer:"#navman-notices",movesField:"#navman-moves",insertsField:"#navman-inserts",updatesField:"#navman-updates",deletionsField:"#navman-deletions",expandAllBtn:"#navman_expand_all",collapseAllBtn:"#navman_collapse_all",saveBtn:"#bu_navman_save"},data:{dirty:!1,deletions:[],insertions:{},updates:{},moves:{}},initialize:function(b){var e=this.settings=bu_navman_settings;e.el=this.el,d=bu.plugins.navigation.tree("navman",e),c.initialize({allowTop:!!e.allowTop,isSectionEditor:!!e.isSectionEditor}),d.listenFor("editPost",this.editPost.bind(this)),d.listenFor("postRemoved",this.postRemoved.bind(this)),d.listenFor("postMoved",this.postMoved.bind(this)),c.listenFor("linkInserted",this.linkInserted.bind(this)),c.listenFor("linkUpdated",this.linkUpdated.bind(this)),a(this.ui.form).on("submit",this.save.bind(this)),a(this.ui.expandAllBtn).on("click",this.expandAll),a(this.ui.collapseAllBtn).on("click",this.collapseAll)},expandAll:function(a){a.preventDefault(),a.stopImmediatePropagation(),d.showAll()},collapseAll:function(a){a.preventDefault(),a.stopImmediatePropagation(),d.hideAll()},editPost:function(a){if(bu_navman_settings.linksPostType===a.post_type)c.edit(a);else{var b="post.php?action=edit&post="+a.ID;window.location=b}},linkInserted:function(a){this.data.insertions[a.ID]=a,this.data.dirty=!0},linkUpdated:function(a){"new"===a.post_status?this.data.insertions[a.ID]=a:this.data.updates[a.ID]=a,this.data.dirty=!0},postRemoved:function(a){var b=a.ID;b&&(void 0!==this.data.insertions[b]?delete this.data.insertions[b]:void 0!==this.data.updates[b]?(delete this.data.updates[b],this.data.deletions.push(b),this.data.dirty=!0):void 0!==this.data.moves[b]?(delete this.data.moves[b],this.data.deletions.push(b),this.data.dirty=!0):(this.data.deletions.push(b),this.data.dirty=!0))},postMoved:function(a){"new"!==a.post_status&&(this.data.moves[a.ID]=a,this.data.dirty=!0)},save:function(b){var c,e=this.data.deletions,f={},g={},h={};a.each(this.data.insertions,function(a,b){(c=d.getPost(a))&&(h[c.ID]=c)}),a.each(this.data.updates,function(a,b){(c=d.getPost(a))&&(g[c.ID]=c)}),a.each(this.data.moves,function(a,b){(c=d.getPost(a))&&(f[c.ID]={ID:c.ID,post_status:c.post_status,post_type:c.post_type,post_parent:c.post_parent,menu_order:c.menu_order})}),a(this.ui.deletionsField).attr("value",JSON.stringify(e)),a(this.ui.insertsField).attr("value",JSON.stringify(h)),a(this.ui.updatesField).attr("value",JSON.stringify(g)),a(this.ui.movesField).attr("value",JSON.stringify(f));var i=a(""+bu_navman_settings.saveNotice+"");a(this.ui.saveBtn).prev("img").css("visibility","visible"),this.notice(i.html(),"message"),d.lock(),this.data.dirty=!1},notice:function(b,c,d){d=d||!0;var e=a(this.ui.noticesContainer),f="";d&&e.empty(),f="message"===c?"updated fade":"error",e.append('

'+b+"

")}},c=bu.plugins.navigation.views.Linkman={el:"#navman-link-editor",ui:{form:"#navman_editlink_form",addBtn:"#navman_add_link",urlField:"#editlink_address",labelField:"#editlink_label",targetNewField:"#editlink_target_new",targetSameField:"#editlink_target_same"},data:{currentLink:null,allowTop:!0,isSectionEditor:!1},initialize:function(b){b=b||{},a.extend(!0,this.data,b),bu.signals.register(this),this.$el=a(this.el),this.$form=a(this.ui.form);var c={};c[bu_navman_settings.confirmLinkBtn]=this.save.bind(this),c[bu_navman_settings.cancelLinkBtn]=this.cancel.bind(this),this.$el.dialog({autoOpen:!1,buttons:c,minWidth:400,width:500,modal:!0,resizable:!1}),a(document.body).on("click",".ui-widget-overlay, .ui-widget",this.stopPropagation),a(this.ui.addBtn).on("click",this.add.bind(this)),d.listenFor("postSelected",this.onPostSelected.bind(this)),d.listenFor("postDeselected",this.onPostDeselected.bind(this)),d.listenFor("postsDeselected",this.onPostDeselected.bind(this))},add:function(c){c.preventDefault(),c.stopPropagation();var e,f="";a(c.currentTarget).parent("li").hasClass("disabled")?(e=d.getSelectedPost(),f=bu_navman_settings.noLinksNotice,e&&bu_navman_settings.linksPostType===e.post_type?f=bu_navman_settings.noChildLinkNotice+"\n\n"+bu_navman_settings.createLinkNotice:b.settings.isSectionEditor?f=bu_navman_settings.noTopLevelNotice+"\n\n"+bu_navman_settings.createLinkNotice:b.settings.allowTop||(f=bu_navman_settings.noTopLevelNotice+"\n\n"+bu_navman_settings.createLinkNotice+"\n\n"+bu_navman_settings.allowTopNotice),alert(f)):(this.data.currentLink={post_status:"new",post_type:bu_navman_settings.linksPostType,post_meta:{}},this.$el.dialog("option","title",bu_navman_settings.addLinkDialogTitle).dialog("open"))},edit:function(b){a(this.ui.urlField).attr("value",b.post_content),a(this.ui.labelField).attr("value",b.post_title),"new"===b.post_meta.bu_link_target?a(this.ui.targetNewField).attr("checked","checked"):a(this.ui.targetSameField).attr("checked","checked"),this.data.currentLink=b,this.$el.dialog("option","title",bu_navman_settings.editLinkDialogTitle).dialog("open")},save:function(b){if(b.preventDefault(),b.stopPropagation(),this.$form.valid()){var c,e,f=this.data.currentLink;f.post_content=a(this.ui.urlField).attr("value"),f.post_title=a(this.ui.labelField).attr("value"),f.url=f.post_content,f.post_meta.bu_link_target=a("input[name='editlink_target']:checked").attr("value"),e=d.getSelectedPost(),e?(f.post_parent=e.ID,f.menu_order=1):(f.post_parent=0,f.menu_order=1),"new"!==f.post_status||f.ID?(c=d.updatePost(f),this.broadcast("linkUpdated",[c])):(c=d.insertPost(f),this.broadcast("linkInserted",[c])),this.clear(),this.$el.dialog("close")}},cancel:function(a){a.preventDefault(),a.stopPropagation(),this.$el.dialog("close"),this.clear()},clear:function(){a(this.ui.urlField).attr("value",""),a(this.ui.labelField).attr("value",""),a(this.ui.targetSameField).attr("checked","checked"),a(this.ui.targetNewField).removeAttr("checked"),this.data.currentLink=null},onPostSelected:function(b){var c=!0;b.post_type==bu_navman_settings.linksPostType&&(c=!1),c=bu.hooks.applyFilters("navmanCanAddLink",c,b,d),c?a(this.ui.addBtn).parent("li").removeClass("disabled"):a(this.ui.addBtn).parent("li").addClass("disabled")},onPostDeselected:function(){var b=this.data.allowTop;b=bu.hooks.applyFilters("navmanCanAddLink",b),b?a(this.ui.addBtn).parent("li").removeClass("disabled"):a(this.ui.addBtn).parent("li").addClass("disabled")},stopPropagation:function(a){a.stopPropagation()}},window.onbeforeunload=function(){if(b.data.dirty)return bu_navman_settings.unloadWarning}}(jQuery),jQuery(document).ready(function(a){"use strict";bu.plugins.navigation.views.Navman.initialize()}); \ No newline at end of file +if("undefined"==typeof bu||void 0===bu.plugins.navigation||void 0===bu.plugins.navigation.tree)throw new TypeError("BU Navigation Manager script dependencies have not been met!");!function(a){"use strict";bu.plugins.navigation.views=bu.plugins.navigation.views||{};var b,c,d;b=bu.plugins.navigation.views.Navman={el:"#nav-tree-container",ui:{form:"#navman_form",noticesContainer:"#navman-notices",movesField:"#navman-moves",insertsField:"#navman-inserts",updatesField:"#navman-updates",deletionsField:"#navman-deletions",expandAllBtn:"#navman_expand_all",collapseAllBtn:"#navman_collapse_all",saveBtn:"#bu_navman_save"},data:{dirty:!1,deletions:[],insertions:{},updates:{},moves:{}},initialize:function(b){var e=this.settings=bu_navman_settings;e.el=this.el,d=bu.plugins.navigation.tree("navman",e),c.initialize({allowTop:!!e.allowTop,isSectionEditor:!!e.isSectionEditor}),d.listenFor("editPost",this.editPost.bind(this)),d.listenFor("postRemoved",this.postRemoved.bind(this)),d.listenFor("postMoved",this.postMoved.bind(this)),c.listenFor("linkInserted",this.linkInserted.bind(this)),c.listenFor("linkUpdated",this.linkUpdated.bind(this)),a(this.ui.form).on("submit",this.save.bind(this)),a(this.ui.expandAllBtn).on("click",this.expandAll),a(this.ui.collapseAllBtn).on("click",this.collapseAll)},expandAll:function(a){a.preventDefault(),a.stopImmediatePropagation(),d.showAll()},collapseAll:function(a){a.preventDefault(),a.stopImmediatePropagation(),d.hideAll()},editPost:function(a){if(bu_navman_settings.linksPostType===a.post_type)c.edit(a);else{var b="post.php?action=edit&post="+a.ID;window.location=b}},linkInserted:function(a){this.data.insertions[a.ID]=a,this.data.dirty=!0},linkUpdated:function(a){"new"===a.post_status?this.data.insertions[a.ID]=a:this.data.updates[a.ID]=a,this.data.dirty=!0},postRemoved:function(a){var b=a.ID;b&&(void 0!==this.data.insertions[b]?delete this.data.insertions[b]:void 0!==this.data.updates[b]?(delete this.data.updates[b],this.data.deletions.push(b),this.data.dirty=!0):void 0!==this.data.moves[b]?(delete this.data.moves[b],this.data.deletions.push(b),this.data.dirty=!0):(this.data.deletions.push(b),this.data.dirty=!0))},postMoved:function(a){"new"!==a.post_status&&(this.data.moves[a.ID]=a,this.data.dirty=!0)},save:function(b){var c,e=this.data.deletions,f={},g={},h={};a.each(this.data.insertions,function(a,b){(c=d.getPost(a))&&(h[c.ID]=c)}),a.each(this.data.updates,function(a,b){(c=d.getPost(a))&&(g[c.ID]=c)}),a.each(this.data.moves,function(a,b){(c=d.getPost(a))&&(f[c.ID]={ID:c.ID,post_status:c.post_status,post_type:c.post_type,post_parent:c.post_parent,menu_order:c.menu_order})}),a(this.ui.deletionsField).attr("value",JSON.stringify(e)),a(this.ui.insertsField).attr("value",JSON.stringify(h)),a(this.ui.updatesField).attr("value",JSON.stringify(g)),a(this.ui.movesField).attr("value",JSON.stringify(f));var i=a(""+bu_navman_settings.saveNotice+"");a(this.ui.saveBtn).prev("img").css("visibility","visible"),this.notice(i.html(),"message"),d.lock(),this.data.dirty=!1},notice:function(b,c,d){d=d||!0;var e=a(this.ui.noticesContainer),f="";d&&e.empty(),f="message"===c?"updated fade":"error",e.append('

'+b+"

")}},c=bu.plugins.navigation.views.Linkman={el:"#navman-link-editor",ui:{form:"#navman_editlink_form",addBtn:"#navman_add_link",urlField:"#editlink_address",labelField:"#editlink_label",targetNewField:"#editlink_target_new",targetSameField:"#editlink_target_same"},data:{currentLink:null,allowTop:!0,isSectionEditor:!1},initialize:function(b){b=b||{},a.extend(!0,this.data,b),bu.signals.register(this),this.$el=a(this.el),this.$form=a(this.ui.form);var c={};c[bu_navman_settings.confirmLinkBtn]=this.save.bind(this),c[bu_navman_settings.cancelLinkBtn]=this.cancel.bind(this),this.$el.dialog({autoOpen:!1,buttons:c,minWidth:400,width:500,modal:!0,resizable:!1}),a(document.body).on("click",".ui-widget-overlay, .ui-widget",this.stopPropagation),a(this.ui.addBtn).on("click",this.add.bind(this)),d.listenFor("postSelected",this.onPostSelected.bind(this)),d.listenFor("postDeselected",this.onPostDeselected.bind(this)),d.listenFor("postsDeselected",this.onPostDeselected.bind(this))},add:function(c){c.preventDefault(),c.stopPropagation();var e,f="";a(c.currentTarget).parent("li").hasClass("disabled")?(e=d.getSelectedPost(),f=bu_navman_settings.noLinksNotice,e&&bu_navman_settings.linksPostType===e.post_type?f=bu_navman_settings.noChildLinkNotice+"\n\n"+bu_navman_settings.createLinkNotice:b.settings.isSectionEditor?f=bu_navman_settings.noTopLevelNotice+"\n\n"+bu_navman_settings.createLinkNotice:b.settings.allowTop||(f=bu_navman_settings.noTopLevelNotice+"\n\n"+bu_navman_settings.createLinkNotice+"\n\n"+bu_navman_settings.allowTopNotice),alert(f)):(this.data.currentLink={post_status:"new",post_type:bu_navman_settings.linksPostType,post_meta:{}},this.$el.dialog("option","title",bu_navman_settings.addLinkDialogTitle).dialog("open"))},edit:function(b){a(this.ui.urlField).prop("value",b.post_content),a(this.ui.labelField).prop("value",b.post_title),"new"===b.post_meta.bu_link_target?a(this.ui.targetNewField).prop("checked",!0):a(this.ui.targetSameField).prop("checked",!0),this.data.currentLink=b,this.$el.dialog("option","title",bu_navman_settings.editLinkDialogTitle).dialog("open")},save:function(b){if(b.preventDefault(),b.stopPropagation(),this.$form.valid()){var c,e,f=this.data.currentLink;f.post_content=a(this.ui.urlField).prop("value"),f.post_title=a(this.ui.labelField).prop("value"),f.url=f.post_content,f.post_meta.bu_link_target=a("input[name='editlink_target']:checked").prop("value"),e=d.getSelectedPost(),e?(f.post_parent=e.ID,f.menu_order=1):(f.post_parent=0,f.menu_order=1),"new"!==f.post_status||f.ID?(c=d.updatePost(f),this.broadcast("linkUpdated",[c])):(c=d.insertPost(f),this.broadcast("linkInserted",[c])),this.clear(),this.$el.dialog("close")}},cancel:function(a){a.preventDefault(),a.stopPropagation(),this.$el.dialog("close"),this.clear()},clear:function(){a(this.ui.urlField).attr("value",""),a(this.ui.labelField).attr("value",""),a(this.ui.targetSameField).attr("checked","checked"),a(this.ui.targetNewField).removeAttr("checked"),this.data.currentLink=null},onPostSelected:function(b){var c=!0;b.post_type==bu_navman_settings.linksPostType&&(c=!1),c=bu.hooks.applyFilters("navmanCanAddLink",c,b,d),c?a(this.ui.addBtn).parent("li").removeClass("disabled"):a(this.ui.addBtn).parent("li").addClass("disabled")},onPostDeselected:function(){var b=this.data.allowTop;b=bu.hooks.applyFilters("navmanCanAddLink",b),b?a(this.ui.addBtn).parent("li").removeClass("disabled"):a(this.ui.addBtn).parent("li").addClass("disabled")},stopPropagation:function(a){a.stopPropagation()}},window.onbeforeunload=function(){if(b.data.dirty)return bu_navman_settings.unloadWarning}}(jQuery),jQuery(document).ready(function(a){"use strict";bu.plugins.navigation.views.Navman.initialize()}); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 577e0a6..f2cdd12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bu-navigation", - "version": "1.2.19", + "version": "1.2.20", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 74133f3..b7a64af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bu-navigation", - "version": "1.2.19", + "version": "1.2.20", "description": "Provides alternative navigation elements designed for blogs with large page counts", "main": "bu-navigation.php", "directories": { diff --git a/readme.md b/readme.md index 336c3bc..ea95827 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ **Tags:** navigation, hierarchical, post type, boston university, bu **Requires at least:** 3.1 **Tested up to:** 5.5 -**Stable tag:** 1.2.19 +**Stable tag:** 1.2.20 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html diff --git a/readme.txt b/readme.txt index 065e186..db6ebfe 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: ntk, mgburns, gcorne, jtwiest, awbauer, inderpreet99 Tags: navigation, hierarchical, post type, boston university, bu Requires at least: 3.1 Tested up to: 5.5 -Stable tag: 1.2.19 +Stable tag: 1.2.20 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html