Admin Menu Tree Page View - Version 2.6

Version Description

  • Fixes for popup on WP 3.5
  • Replaced live() with on() for jQuery
  • Small CSS fixes, for example search box label being a bit off
Download this release

Release Info

Developer eskapism
Plugin Icon wp plugin Admin Menu Tree Page View
Version 2.6
Comparing to
See all releases

Code changes from version 2.5 to 2.6

Files changed (4) hide show
  1. css/styles.css +7 -2
  2. index.php +2 -2
  3. js/scripts.js +33 -32
  4. readme.txt +6 -1
css/styles.css CHANGED
@@ -299,7 +299,7 @@ span.admin-menu-tree-page-tree_headline {
299
  color: #BBBBBB;
300
  left: 13px;
301
  position: absolute;
302
- top: 5px;
303
  cursor: text;
304
  }
305
 
@@ -375,6 +375,7 @@ ul.admin-menu-tree-page-tree span.child-count {
375
  background-image: -moz-linear-gradient(left , #d3dbe1, #EAF2FA 10px);
376
  background-image: -webkit-linear-gradient(left , #d3dbe1, #EAF2FA 5px);
377
  margin-top: -8px;
 
378
  }
379
  .amtpv-editpopup-hover {
380
  display: block;
@@ -602,6 +603,10 @@ ul.amtpv-editpopup-addpages-names-ul .ui-state-highlight {
602
  }
603
 
604
  /* fix from wordpress.org/support/topic/plugin-admin-menu-tree-page-view-flyout-menus-broken-in-wp-33 */
605
- #adminmenuwrap #adminmenu #menu-pages .wp-submenu {
 
606
  overflow: visible !important;
607
  }
 
 
 
299
  color: #BBBBBB;
300
  left: 13px;
301
  position: absolute;
302
+ top: 4px;
303
  cursor: text;
304
  }
305
 
375
  background-image: -moz-linear-gradient(left , #d3dbe1, #EAF2FA 10px);
376
  background-image: -webkit-linear-gradient(left , #d3dbe1, #EAF2FA 5px);
377
  margin-top: -8px;
378
+ color: #464646;
379
  }
380
  .amtpv-editpopup-hover {
381
  display: block;
603
  }
604
 
605
  /* fix from wordpress.org/support/topic/plugin-admin-menu-tree-page-view-flyout-menus-broken-in-wp-33 */
606
+ #adminmenuwrap #adminmenu #menu-pages .wp-submenu,
607
+ #adminmenu .wp-submenu li {
608
  overflow: visible !important;
609
  }
610
+
611
+
612
+
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Admin Menu Tree Page View
4
  Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
5
  Description: Get a tree view of all your pages directly in the admin menu. Search, edit, view and add pages - all with just one click away!
6
- Version: 2.5
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -38,7 +38,7 @@ add_action('wp_ajax_admin_menu_tree_page_view_move_page', 'admin_menu_tree_page_
38
 
39
  function admin_menu_tree_page_view_admin_init() {
40
 
41
- define( "admin_menu_tree_page_view_VERSION", "2.5" );
42
  define( "admin_menu_tree_page_view_URL", WP_PLUGIN_URL . '/admin-menu-tree-page-view/' );
43
  define( "admin_menu_tree_page_view_DIR", WP_PLUGIN_DIR . '/admin-menu-tree-page-view/' );
44
 
3
  Plugin Name: Admin Menu Tree Page View
4
  Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
5
  Description: Get a tree view of all your pages directly in the admin menu. Search, edit, view and add pages - all with just one click away!
6
+ Version: 2.6
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
38
 
39
  function admin_menu_tree_page_view_admin_init() {
40
 
41
+ define( "admin_menu_tree_page_view_VERSION", "2.6" );
42
  define( "admin_menu_tree_page_view_URL", WP_PLUGIN_URL . '/admin-menu-tree-page-view/' );
43
  define( "admin_menu_tree_page_view_DIR", WP_PLUGIN_DIR . '/admin-menu-tree-page-view/' );
44
 
js/scripts.js CHANGED
@@ -14,11 +14,11 @@ jQuery(function($) {
14
  var s = $(this).val();
15
  var selector = "li:AminMenuTreePageContains('"+s+"')";
16
  var hits = ul.find(selector);
17
- if (hits.length > 0 || s != "") {
18
  ul.find("div.admin-menu-tree-page-filter-reset").fadeIn("fast");
19
  ul.unhighlight();
20
  }
21
- if (s == "") {
22
  ul.find("div.admin-menu-tree-page-filter-reset").fadeOut("fast");
23
  }
24
  ul.highlight(s);
@@ -37,7 +37,7 @@ jQuery(function($) {
37
 
38
  // if no hits: tell the user so we have less confusion. confusion is bad.
39
  var nohits_div = ul.find("div.admin-menu-tree-page-filter-nohits");
40
- if (hits.length == 0) {
41
  nohits_div.show();
42
  } else {
43
  nohits_div.hide();
@@ -67,7 +67,7 @@ jQuery(function($) {
67
 
68
  // add links to expand/collapse
69
  trees.find("li.admin-menu-tree-page-view-has-childs > div").after("<div class='admin-menu-tree-page-expand' title='Show/Hide child pages' />");
70
- trees.find("div.admin-menu-tree-page-expand").live("click", function(e) {
71
 
72
  e.preventDefault();
73
  var $t = $(this);
@@ -105,12 +105,12 @@ jQuery(function($) {
105
 
106
 
107
  // mouse over to show edit-box
108
- $("ul.admin-menu-tree-page-tree li div.amtpv-linkwrap:first-child").live("mouseenter mouseleave", function(e) {
109
 
110
  var t = $(this);
111
  var li = t.closest("li");
112
  var popupdiv = li.find("div.amtpv-editpopup:first");
113
- var linkwrap = li.find("div.amtpv-linkwrap:first")
114
  //var popup_linkwrap = popupdiv.closest("div.amtpv-linkwrap");
115
 
116
  if (e.type == "mouseenter" || e.type == "mouseover") {
@@ -124,7 +124,7 @@ jQuery(function($) {
124
  ul.find("div.amtpv-linkwrap").removeClass("amtpv-linkwrap-hover");
125
  popupdiv.addClass("amtpv-editpopup-hover");
126
  linkwrap.addClass("amtpv-linkwrap-hover");
127
- }
128
 
129
  } else if (e.type == "mouseleave" || e.type == "mouseout") {
130
 
@@ -146,11 +146,13 @@ jQuery(function($) {
146
 
147
  }
148
  });
149
- $("div.amtpv-editpopup").live("mouseenter mouseleave", function(e) {
 
 
150
  var t = $(this);
151
  var li = t.closest("li");
152
  var popupdiv = li.find("div.amtpv-editpopup:first");
153
- var linkwrap = li.find("div.amtpv-linkwrap:first")
154
 
155
  if (e.type == "mouseenter" || e.type == "mouseover") {
156
  t.addClass("amtpv-editpopup-hover-hover");
@@ -161,14 +163,10 @@ jQuery(function($) {
161
  }
162
  }
163
  });
164
-
165
- // don't allow clicks directly on .amtpv-editpopup. it's kinda confusing
166
- $("div.amtpv-editpopup").live("click", function(e) {
167
- //e.preventDefault();
168
- });
169
-
170
  // edit/view links
171
- $("div.amtpv-editpopup-edit, div.amtpv-editpopup-view").live("click",function(e) {
 
172
  e.preventDefault();
173
  var t = $(this);
174
  var link = t.data("link");
@@ -176,7 +174,7 @@ jQuery(function($) {
176
 
177
  if ( ($.client.os == "Mac" && (e.metaKey || e.shiftKey)) || ($.client.os != "Mac" && e.ctrlKey) ) {
178
  new_win = true;
179
- }
180
  if (new_win) {
181
  window.open(link);
182
  } else {
@@ -186,7 +184,7 @@ jQuery(function($) {
186
  });
187
 
188
  // add links
189
- $("div.amtpv-editpopup-add-after, div.amtpv-editpopup-add-inside").live("click", function(e) {
190
 
191
  var t = $(this);
192
  var post_id = t.closest("a").data("post-id");
@@ -221,7 +219,7 @@ jQuery(function($) {
221
  if (type=="after") {
222
  add_pages.append( $("<div class='amtpv-editpopup-addpages-position'><input checked='checked' type='radio' name='amtpv-editpopup-addpages-position' id='amtpv-editpopup-addpages-position-after' value='after' /><label for='amtpv-editpopup-addpages-position-after'>After</label> <input type='radio' name='amtpv-editpopup-addpages-position' id='amtpv-editpopup-addpages-position-inside' value='inside' /><label for='amtpv-editpopup-addpages-position-inside'>Inside</label> </div") );
223
  } else if (type=="inside") {
224
- add_pages.append( $("<div class='amtpv-editpopup-addpages-position'><input type='radio' name='amtpv-editpopup-addpages-position' id='amtpv-editpopup-addpages-position-after' value='after' /><label for='amtpv-editpopup-addpages-position-after'>After</label> <input checked='checked' type='radio' name='amtpv-editpopup-addpages-position' id='amtpv-editpopup-addpages-position-inside' value='inside' /><label for='amtpv-editpopup-addpages-position-inside'>Inside</label> </div") );
225
  }
226
 
227
  add_pages.append( $("<div class='amtpv-editpopup-addpages-publish'><label for='amtpv-editpopup-addpages-publish-select'>Status</label><select id='amtpv-editpopup-addpages-publish-select' name='status'><option value='publish'>Published</option><option value='pending'>Pending Review</option><option value='draft' selected='selected'>Draft</option></select></div") );
@@ -247,7 +245,7 @@ jQuery(function($) {
247
  });
248
 
249
  // add new page-link
250
- $("div.amtpv-editpopup-addpages-addpage a").live("click", function(e) {
251
  e.preventDefault();
252
  var t = $(this);
253
  var newelm = $("<li><span></span><input class='amtpv-editpopup-addpages-name' type='text' value=''/></li>");
@@ -257,7 +255,7 @@ jQuery(function($) {
257
 
258
  // when typing in the input, add another input if we are at the last input
259
  // this way we don't have to click that "add page" button. less clicks = more productive.
260
- $("input.amtpv-editpopup-addpages-name").live("keyup", function(e) {
261
  // check if this is the last li
262
  var t = $(this);
263
  var ul = t.closest("ul");
@@ -265,19 +263,22 @@ jQuery(function($) {
265
 
266
  // if this input is the last one, and we have entered something, add another one
267
  var isLast = (li.index() == ul.find("li").length-1);
268
- if (isLast && t.val() != "") {
269
  var newelm = $("<li class='hidden'><span></span><input class='amtpv-editpopup-addpages-name' type='text' value=''/></li>");
270
  ul.append( newelm );
271
- newelm.slideDown("fast");
272
  }
273
 
274
  });
275
 
276
  // cancel-link
277
- $("a.amtpv-editpopup-addpages-cancel").live("click", function() {
278
- var t = $(this);
279
- var popup = t.closest("div.amtpv-editpopup");
280
- var linkwrap = popup.closest("div.amtpv-linkwrap");
 
 
 
281
 
282
  popup.find(".amtpv-editpopup-addpages").hide().remove();
283
  popup.find("> div").show();
@@ -286,7 +287,7 @@ jQuery(function($) {
286
  });
287
 
288
  // woho, add da pages!
289
- $("form.amtpv-editpopup-addpages").live("submit", function(e) {
290
  // fetch all .amtpv-editpopup-addpages-name for this popup
291
 
292
  e.preventDefault();
@@ -306,7 +307,7 @@ jQuery(function($) {
306
 
307
  // we must at least have one name
308
  // @todo: make this a bit better looking
309
- if (arr_names.length == 0) {
310
  alert("Please enter a name for the new page");
311
  return false;
312
  }
@@ -413,7 +414,7 @@ jQuery(function($) {
413
  // click "pages" headline to hide or show the tree
414
  // @todo: remember state in a cookie, to be read by PHP
415
  // @todo: also add arrow or something that shows state
416
- $(".admin-menu-tree-page-tree_headline").live("click", function() {
417
  var t = $(this);
418
  var ul = t.closest("ul");
419
  var lis = ul.find("li").not(".admin-menu-tree-page-tree_headline"); // also consider .admin-menu-tree-page-filter
@@ -437,9 +438,9 @@ function admin_menu_tree_page_view_save_opened_posts() {
437
  // array with all post ids that are open
438
  var admin_menu_tree_page_view_opened_posts = jQuery.cookie('admin-menu-tree-page-view-open-posts') || "";
439
  admin_menu_tree_page_view_opened_posts = admin_menu_tree_page_view_opened_posts.split(",");
440
- if (admin_menu_tree_page_view_opened_posts[0] == "") {
441
  // admin_menu_tree_page_view_opened_posts = [];
442
- }
443
 
444
  // http://stackoverflow.com/questions/187537/is-there-a-case-insensitive-jquery-contains-selector
445
  jQuery.expr[':'].AminMenuTreePageContains = function(a,i,m){
14
  var s = $(this).val();
15
  var selector = "li:AminMenuTreePageContains('"+s+"')";
16
  var hits = ul.find(selector);
17
+ if (hits.length > 0 || s !== "") {
18
  ul.find("div.admin-menu-tree-page-filter-reset").fadeIn("fast");
19
  ul.unhighlight();
20
  }
21
+ if (s === "") {
22
  ul.find("div.admin-menu-tree-page-filter-reset").fadeOut("fast");
23
  }
24
  ul.highlight(s);
37
 
38
  // if no hits: tell the user so we have less confusion. confusion is bad.
39
  var nohits_div = ul.find("div.admin-menu-tree-page-filter-nohits");
40
+ if (hits.length === 0) {
41
  nohits_div.show();
42
  } else {
43
  nohits_div.hide();
67
 
68
  // add links to expand/collapse
69
  trees.find("li.admin-menu-tree-page-view-has-childs > div").after("<div class='admin-menu-tree-page-expand' title='Show/Hide child pages' />");
70
+ trees.on("click", "div.admin-menu-tree-page-expand", function(e) {
71
 
72
  e.preventDefault();
73
  var $t = $(this);
105
 
106
 
107
  // mouse over to show edit-box
108
+ trees.on("mouseenter mouseleave", "li div.amtpv-linkwrap:first-child", function(e) {
109
 
110
  var t = $(this);
111
  var li = t.closest("li");
112
  var popupdiv = li.find("div.amtpv-editpopup:first");
113
+ var linkwrap = li.find("div.amtpv-linkwrap:first");
114
  //var popup_linkwrap = popupdiv.closest("div.amtpv-linkwrap");
115
 
116
  if (e.type == "mouseenter" || e.type == "mouseover") {
124
  ul.find("div.amtpv-linkwrap").removeClass("amtpv-linkwrap-hover");
125
  popupdiv.addClass("amtpv-editpopup-hover");
126
  linkwrap.addClass("amtpv-linkwrap-hover");
127
+ }
128
 
129
  } else if (e.type == "mouseleave" || e.type == "mouseout") {
130
 
146
 
147
  }
148
  });
149
+
150
+ //
151
+ trees.on("mouseenter mouseleave", "div.amtpv-editpopup", function(e) {
152
  var t = $(this);
153
  var li = t.closest("li");
154
  var popupdiv = li.find("div.amtpv-editpopup:first");
155
+ var linkwrap = li.find("div.amtpv-linkwrap:first");
156
 
157
  if (e.type == "mouseenter" || e.type == "mouseover") {
158
  t.addClass("amtpv-editpopup-hover-hover");
163
  }
164
  }
165
  });
166
+
 
 
 
 
 
167
  // edit/view links
168
+ trees.on("click", "div.amtpv-editpopup-edit, div.amtpv-editpopup-view", function(e) {
169
+
170
  e.preventDefault();
171
  var t = $(this);
172
  var link = t.data("link");
174
 
175
  if ( ($.client.os == "Mac" && (e.metaKey || e.shiftKey)) || ($.client.os != "Mac" && e.ctrlKey) ) {
176
  new_win = true;
177
+ }
178
  if (new_win) {
179
  window.open(link);
180
  } else {
184
  });
185
 
186
  // add links
187
+ trees.on("click", "div.amtpv-editpopup-add-after, div.amtpv-editpopup-add-inside", function(e) {
188
 
189
  var t = $(this);
190
  var post_id = t.closest("a").data("post-id");
219
  if (type=="after") {
220
  add_pages.append( $("<div class='amtpv-editpopup-addpages-position'><input checked='checked' type='radio' name='amtpv-editpopup-addpages-position' id='amtpv-editpopup-addpages-position-after' value='after' /><label for='amtpv-editpopup-addpages-position-after'>After</label> <input type='radio' name='amtpv-editpopup-addpages-position' id='amtpv-editpopup-addpages-position-inside' value='inside' /><label for='amtpv-editpopup-addpages-position-inside'>Inside</label> </div") );
221
  } else if (type=="inside") {
222
+ add_pages.append( $("<div class='amtpv-editpopup-addpages-position'><input type='radio' name='amtpv-editpopup-addpages-position' id='amtpv-editpopup-addpages-position-after' value='after' /><label for='amtpv-editpopup-addpages-position-after'>After</label> <input checked='checked' type='radio' name='amtpv-editpopup-addpages-position' id='amtpv-editpopup-addpages-position-inside' value='inside' /><label for='amtpv-editpopup-addpages-position-inside'>Inside</label> </div") );
223
  }
224
 
225
  add_pages.append( $("<div class='amtpv-editpopup-addpages-publish'><label for='amtpv-editpopup-addpages-publish-select'>Status</label><select id='amtpv-editpopup-addpages-publish-select' name='status'><option value='publish'>Published</option><option value='pending'>Pending Review</option><option value='draft' selected='selected'>Draft</option></select></div") );
245
  });
246
 
247
  // add new page-link
248
+ trees.on("click", "div.amtpv-editpopup-addpages-addpage a", function(e) {
249
  e.preventDefault();
250
  var t = $(this);
251
  var newelm = $("<li><span></span><input class='amtpv-editpopup-addpages-name' type='text' value=''/></li>");
255
 
256
  // when typing in the input, add another input if we are at the last input
257
  // this way we don't have to click that "add page" button. less clicks = more productive.
258
+ trees.on("keyup", "input.amtpv-editpopup-addpages-name", function(e) {
259
  // check if this is the last li
260
  var t = $(this);
261
  var ul = t.closest("ul");
263
 
264
  // if this input is the last one, and we have entered something, add another one
265
  var isLast = (li.index() == ul.find("li").length-1);
266
+ if (isLast && t.val() !== "") {
267
  var newelm = $("<li class='hidden'><span></span><input class='amtpv-editpopup-addpages-name' type='text' value=''/></li>");
268
  ul.append( newelm );
269
+ newelm.show();
270
  }
271
 
272
  });
273
 
274
  // cancel-link
275
+ trees.on("click", "a.amtpv-editpopup-addpages-cancel", function(e) {
276
+
277
+ e.preventDefault();
278
+
279
+ var t = $(this),
280
+ popup = t.closest("div.amtpv-editpopup"),
281
+ linkwrap = popup.closest("div.amtpv-linkwrap");
282
 
283
  popup.find(".amtpv-editpopup-addpages").hide().remove();
284
  popup.find("> div").show();
287
  });
288
 
289
  // woho, add da pages!
290
+ trees.on("submit", "form.amtpv-editpopup-addpages", function(e) {
291
  // fetch all .amtpv-editpopup-addpages-name for this popup
292
 
293
  e.preventDefault();
307
 
308
  // we must at least have one name
309
  // @todo: make this a bit better looking
310
+ if (arr_names.length === 0) {
311
  alert("Please enter a name for the new page");
312
  return false;
313
  }
414
  // click "pages" headline to hide or show the tree
415
  // @todo: remember state in a cookie, to be read by PHP
416
  // @todo: also add arrow or something that shows state
417
+ trees.on("click", ".admin-menu-tree-page-tree_headline", function() {
418
  var t = $(this);
419
  var ul = t.closest("ul");
420
  var lis = ul.find("li").not(".admin-menu-tree-page-tree_headline"); // also consider .admin-menu-tree-page-filter
438
  // array with all post ids that are open
439
  var admin_menu_tree_page_view_opened_posts = jQuery.cookie('admin-menu-tree-page-view-open-posts') || "";
440
  admin_menu_tree_page_view_opened_posts = admin_menu_tree_page_view_opened_posts.split(",");
441
+ //if (admin_menu_tree_page_view_opened_posts[0] == "") {
442
  // admin_menu_tree_page_view_opened_posts = [];
443
+ //}
444
 
445
  // http://stackoverflow.com/questions/187537/is-there-a-case-insensitive-jquery-contains-selector
446
  jQuery.expr[':'].AminMenuTreePageContains = function(a,i,m){
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: admin, page, pages, page tree, hierarchy, cms, tree, view, admin menu, menu, change order, drag and drop
5
  Requires at least: 3.0
6
  Tested up to: 3.5
7
- Stable tag: 2.5
8
 
9
  Get a tree view of all your pages directly in the admin menu. Search, edit, view, re-order/sort and add pages – all is just one click away!
10
 
@@ -50,6 +50,11 @@ Now the tree with the pages will be visible in the admin menu to the left.
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
53
  = 2.5 =
54
  - Fix for search highlight being to big
55
 
4
  Tags: admin, page, pages, page tree, hierarchy, cms, tree, view, admin menu, menu, change order, drag and drop
5
  Requires at least: 3.0
6
  Tested up to: 3.5
7
+ Stable tag: 2.6
8
 
9
  Get a tree view of all your pages directly in the admin menu. Search, edit, view, re-order/sort and add pages – all is just one click away!
10
 
50
 
51
  == Changelog ==
52
 
53
+ = 2.6 =
54
+ - Fixes for popup on WP 3.5
55
+ - Replaced live() with on() for jQuery
56
+ - Small CSS fixes, for example search box label being a bit off
57
+
58
  = 2.5 =
59
  - Fix for search highlight being to big
60