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

This commit is contained in:
Ad Schellevis 2016-03-28 17:52:09 +02:00
parent 53d00da877
commit 862fd2c6ae
11 changed files with 54 additions and 23 deletions

View File

@ -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"); ?>

View File

@ -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>

View File

@ -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>

View File

@ -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"); ?>

View File

@ -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>

View File

@ -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>

View File

@ -270,6 +270,8 @@ $( document ).ready(function() {
}]
});
});
// watch scroll position and set to last known on page load
watchScrollPosition();
});
</script>

View File

@ -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>

View File

@ -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();
});

View File

@ -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>

View File

@ -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();
});