Permalink
Browse files

Wiki_Pages, wordpress-wiki.js / If wpw_action parameter is present, u…

…se it to select a tab.
  • Loading branch information...
Rad Geek
Rad Geek committed Dec 26, 2016
1 parent d1f2ee3 commit 8555bcd354ee579a439953d7ebd988262d2897fd
Showing with 20 additions and 5 deletions.
  1. +8 −5 controllers/wiki_pages.php
  2. +12 −0 static/wordpress-wiki.js
View
@@ -288,13 +288,11 @@ public function wiki_edit_link ($link, $post_id, $context) {
endif;
$link .= $sep . 'wpw_action=edit';
if ('display' == $context) :
endif;
$link = esc_url($link, /*protocols=*/ null, $context);
endif;
return esc_url($link, /*protocols=*/ null, $context);
return $link;
}
function front_end_interface($content) {
@@ -402,6 +400,11 @@ function () {
$(window).load(function() {
$(".wpw-hide-it").removeClass("wpw-hide-it");
$("#wpw_tabs").tabs();
var act;
if (act = getParameterByName('wpw_action')) {
$('#wpw_' + act).click();
} /* if */
});
});
</script>
View
@@ -22,4 +22,16 @@ function check_toc() {
} else {
jQuery("#wiki_toc").attr("checked", false).attr("disabled", true);
}
}
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

0 comments on commit 8555bcd

Please sign in to comment.