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() {
});
// link move buttons
$(".act_move").click(function(){
$(".act_move").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id);
$("#action").val("move");
......@@ -211,13 +212,16 @@ $( document ).ready(function() {
});
// link toggle buttons
$(".act_toggle").click(function(){
$(".act_toggle").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id);
$("#action").val("toggle");
$("#iform").submit();
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>
<?php include("fbegin.inc"); ?>
......
......@@ -153,7 +153,8 @@ $main_buttons = array(
});
// link move buttons
$(".act_move").click(function(){
$(".act_move").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id);
$("#action").val("move");
......@@ -161,12 +162,15 @@ $main_buttons = array(
});
// link toggle buttons
$(".act_toggle").click(function(){
$(".act_toggle").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id);
$("#action").val("toggle");
$("#iform").submit();
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>
......
......@@ -155,7 +155,8 @@ $main_buttons = array(
});
// link move buttons
$(".act_move").click(function(){
$(".act_move").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id);
$("#action").val("move");
......@@ -163,13 +164,15 @@ $main_buttons = array(
});
// link toggle buttons
$(".act_toggle").click(function(){
$(".act_toggle").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id);
$("#action").val("toggle");
$("#iform").submit();
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>
......
......@@ -224,23 +224,24 @@ include("head.inc");
});
// link move buttons
$(".act_move").click(function(){
$(".act_move").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id);
$("#action").val("move");
$("#iform").submit();
event.preventDefault();
});
// link toggle buttons
$(".act_toggle").click(function(){
$(".act_toggle").click(function(event){
event.preventDefault();
var id = $(this).attr("id").split('_').pop(-1);
$("#id").val(id);
$("#action").val("toggle");
$("#iform").submit();
event.preventDefault();
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>
<?php include("fbegin.inc"); ?>
......
......@@ -96,11 +96,14 @@ $main_buttons = array(
});
});
// 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) {
location.reload();
});
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>
......
......@@ -94,11 +94,14 @@ $main_buttons = array(
});
});
// 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) {
location.reload();
});
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>
......
......@@ -270,6 +270,8 @@ $( document ).ready(function() {
}]
});
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>
......
......@@ -206,13 +206,16 @@ $( document ).ready(function() {
});
// link move buttons
$(".act_move").click(function(){
$(".act_move").click(function(event){
event.preventDefault();
var id = $(this).data("id");
$("#id").val(id);
$("#act").val("move");
$("#iform").submit();
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>
<body>
......
......@@ -414,20 +414,22 @@ $( document ).ready(function() {
});
// 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) {
location.reload();
});
});
// link move buttons
$(".act_move").click(function(){
$(".act_move").click(function(event){
event.preventDefault();
$("#id").val($(this).data("id"));
$("#action").val("move");
$("#iform2").submit();
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
......
......@@ -283,14 +283,16 @@ $( document ).ready(function() {
}
});
// 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) {
location.reload();
});
});
// link move buttons
$(".act_move").click(function(){
$(".act_move").click(function(event){
event.preventDefault();
$("#id").val($(this).data("id"));
$("#action").val("move");
$("#iform2").submit();
......@@ -348,7 +350,8 @@ $( document ).ready(function() {
$("#ntp_server_enable").change();
$("#netbios_enable").change();
}
// watch scroll position and set to last known on page load
watchScrollPosition();
});
//]]>
</script>
......
......@@ -426,6 +426,8 @@ legacy_html_escape_form_data($pconfig);
<script type="text/javascript">
//<![CDATA[
$( document ).ready(function() {
// watch scroll position and set to last known on page load
watchScrollPosition();
// link delete buttons
$(".act_delete").click(function(){
var id = $(this).attr("id").split('_').pop(-1);
......@@ -450,7 +452,8 @@ $( document ).ready(function() {
});
// 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) {
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