Commit f8233bd0 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

Remember scrolling position when toggling, https://github.com/opnsense/core/issues/840

(cherry picked from commit 862fd2c6)
parent f2642562
...@@ -203,7 +203,8 @@ $( document ).ready(function() { ...@@ -203,7 +203,8 @@ $( document ).ready(function() {
}); });
// link move buttons // link move buttons
$(".act_move").click(function(){ $(".act_move").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id); $("#id").val(id);
$("#action").val("move"); $("#action").val("move");
...@@ -211,13 +212,16 @@ $( document ).ready(function() { ...@@ -211,13 +212,16 @@ $( document ).ready(function() {
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id); $("#id").val(id);
$("#action").val("toggle"); $("#action").val("toggle");
$("#iform").submit(); $("#iform").submit();
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
</script> </script>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
......
...@@ -153,7 +153,8 @@ $main_buttons = array( ...@@ -153,7 +153,8 @@ $main_buttons = array(
}); });
// link move buttons // link move buttons
$(".act_move").click(function(){ $(".act_move").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id); $("#id").val(id);
$("#action").val("move"); $("#action").val("move");
...@@ -161,12 +162,15 @@ $main_buttons = array( ...@@ -161,12 +162,15 @@ $main_buttons = array(
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id); $("#id").val(id);
$("#action").val("toggle"); $("#action").val("toggle");
$("#iform").submit(); $("#iform").submit();
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
</script> </script>
......
...@@ -155,7 +155,8 @@ $main_buttons = array( ...@@ -155,7 +155,8 @@ $main_buttons = array(
}); });
// link move buttons // link move buttons
$(".act_move").click(function(){ $(".act_move").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id); $("#id").val(id);
$("#action").val("move"); $("#action").val("move");
...@@ -163,13 +164,15 @@ $main_buttons = array( ...@@ -163,13 +164,15 @@ $main_buttons = array(
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id); $("#id").val(id);
$("#action").val("toggle"); $("#action").val("toggle");
$("#iform").submit(); $("#iform").submit();
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
</script> </script>
......
...@@ -224,23 +224,24 @@ include("head.inc"); ...@@ -224,23 +224,24 @@ include("head.inc");
}); });
// link move buttons // link move buttons
$(".act_move").click(function(){ $(".act_move").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id); $("#id").val(id);
$("#action").val("move"); $("#action").val("move");
$("#iform").submit(); $("#iform").submit();
event.preventDefault();
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id); $("#id").val(id);
$("#action").val("toggle"); $("#action").val("toggle");
$("#iform").submit(); $("#iform").submit();
event.preventDefault();
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
</script> </script>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
......
...@@ -96,11 +96,14 @@ $main_buttons = array( ...@@ -96,11 +96,14 @@ $main_buttons = array(
}); });
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
$.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) { $.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) {
location.reload(); location.reload();
}); });
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
</script> </script>
......
...@@ -94,11 +94,14 @@ $main_buttons = array( ...@@ -94,11 +94,14 @@ $main_buttons = array(
}); });
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
$.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) { $.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) {
location.reload(); location.reload();
}); });
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
</script> </script>
......
...@@ -270,6 +270,8 @@ $( document ).ready(function() { ...@@ -270,6 +270,8 @@ $( document ).ready(function() {
}] }]
}); });
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
</script> </script>
......
...@@ -206,13 +206,16 @@ $( document ).ready(function() { ...@@ -206,13 +206,16 @@ $( document ).ready(function() {
}); });
// link move buttons // link move buttons
$(".act_move").click(function(){ $(".act_move").click(function(event){
event.preventDefault();
var id = $(this).data("id"); var id = $(this).data("id");
$("#id").val(id); $("#id").val(id);
$("#act").val("move"); $("#act").val("move");
$("#iform").submit(); $("#iform").submit();
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
</script> </script>
<body> <body>
......
...@@ -414,20 +414,22 @@ $( document ).ready(function() { ...@@ -414,20 +414,22 @@ $( document ).ready(function() {
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
$.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) { $.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) {
location.reload(); location.reload();
}); });
}); });
// link move buttons // link move buttons
$(".act_move").click(function(){ $(".act_move").click(function(event){
event.preventDefault();
$("#id").val($(this).data("id")); $("#id").val($(this).data("id"));
$("#action").val("move"); $("#action").val("move");
$("#iform2").submit(); $("#iform2").submit();
}); });
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
......
...@@ -283,14 +283,16 @@ $( document ).ready(function() { ...@@ -283,14 +283,16 @@ $( document ).ready(function() {
} }
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
$.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) { $.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) {
location.reload(); location.reload();
}); });
}); });
// link move buttons // link move buttons
$(".act_move").click(function(){ $(".act_move").click(function(event){
event.preventDefault();
$("#id").val($(this).data("id")); $("#id").val($(this).data("id"));
$("#action").val("move"); $("#action").val("move");
$("#iform2").submit(); $("#iform2").submit();
...@@ -348,7 +350,8 @@ $( document ).ready(function() { ...@@ -348,7 +350,8 @@ $( document ).ready(function() {
$("#ntp_server_enable").change(); $("#ntp_server_enable").change();
$("#netbios_enable").change(); $("#netbios_enable").change();
} }
// watch scroll position and set to last known on page load
watchScrollPosition();
}); });
//]]> //]]>
</script> </script>
......
...@@ -426,6 +426,8 @@ legacy_html_escape_form_data($pconfig); ...@@ -426,6 +426,8 @@ legacy_html_escape_form_data($pconfig);
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
$( document ).ready(function() { $( document ).ready(function() {
// watch scroll position and set to last known on page load
watchScrollPosition();
// link delete buttons // link delete buttons
$(".act_delete").click(function(){ $(".act_delete").click(function(){
var id = $(this).attr("id").split('_').pop(-1); var id = $(this).attr("id").split('_').pop(-1);
...@@ -450,7 +452,8 @@ $( document ).ready(function() { ...@@ -450,7 +452,8 @@ $( document ).ready(function() {
}); });
// link toggle buttons // link toggle buttons
$(".act_toggle").click(function(){ $(".act_toggle").click(function(event){
event.preventDefault();
$.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) { $.post(window.location, {act: 'toggle', id:$(this).data("id")}, function(data) {
location.reload(); location.reload();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment