Skip to content
Permalink
Browse files

retain scroll position when switching editor modes; updates #202

  • Loading branch information...
following5 committed Sep 8, 2015
1 parent ff969f6 commit db30747e6051b5dab1800dc888a7f08821670851
@@ -291,6 +291,9 @@
}
}
tpl_set_var('scrollposx', isset($_REQUEST['scrollposx']) ? $_REQUEST['scrollposx'] + 0 : 0);
tpl_set_var('scrollposy', isset($_REQUEST['scrollposy']) ? $_REQUEST['scrollposy'] + 0 : 0);
//make the template and send it out
tpl_BuildTemplate();
?>
@@ -395,6 +395,9 @@
}
}
tpl_set_var('scrollposx', isset($_REQUEST['scrollposx']) ? $_REQUEST['scrollposx'] + 0 : 0);
tpl_set_var('scrollposy', isset($_REQUEST['scrollposy']) ? $_REQUEST['scrollposy'] + 0 : 0);
//make the template and send it out
tpl_BuildTemplate();
?>
@@ -38,6 +38,8 @@
<input type="hidden" name="version2" value="1"/>
<input id="descMode" type="hidden" name="descMode" value="1" />
<input id="oldDescMode" type="hidden" name="oldDescMode" value="1" />
<input type="hidden" name="scrollposx" value="{scrollposx}" />
<input type="hidden" name="scrollposy" value="{scrollposy}" />
<table class="table">
<tr>
<td>{t}Language:{/t}</td>
@@ -83,6 +83,8 @@ function _chkFound () {
<input type="hidden" name="version2" value="1"/>
<input id="oldDescMode" type="hidden" name="oldDescMode" value="1" />
<input id="descMode" type="hidden" name="descMode" value="1" />
<input type="hidden" name="scrollposx" value="{scrollposx}" />
<input type="hidden" name="scrollposy" value="{scrollposy}" />

<table class="table">
<tr><td class="spacer" colspan="2"></td></tr>
@@ -126,6 +126,8 @@ function toggleAttr(id)
<input type="hidden" id="cache_attribs" name="cache_attribs" value="{cache_attribs}" />
<input id="descMode" type="hidden" name="descMode" value="1" />
<input id="oldDescMode" type="hidden" name="oldDescMode" value="1" />
<input type="hidden" name="scrollposx" value="{scrollposx}" />
<input type="hidden" name="scrollposy" value="{scrollposy}" />
<table class="table">
{general_message}
<tr><td class="spacer" colspan="2"></td></tr>
@@ -248,7 +250,7 @@ function toggleAttr(id)
<td colspan="2">{cache_attrib_list}{safari_message}</td>
</tr>
<tr><td class="spacer" colspan="2">&nbsp;</td></tr>
<tr id="editor">
<tr>
<td class="header-small" colspan="2">
<div class="content2-container bg-blue02">
<p class="content-title-noshade-size2">
@@ -37,6 +37,8 @@
<input type="hidden" name="version2" value="1"/>
<input id="descMode" type="hidden" name="descMode" value="1" />
<input id="oldDescMode" type="hidden" name="oldDescMode" value="1" />
<input type="hidden" name="scrollposx" value="{scrollposx}" />
<input type="hidden" name="scrollposy" value="{scrollposy}" />
<table class="table">
<tr><td class="spacer" colspan="2"></td></tr>
<tr>
@@ -279,6 +279,8 @@
}
// prepare template and display
$tpl->assign('scrollposx', isset($_REQUEST['scrollposx']) ? $_REQUEST['scrollposx'] + 0 : 0);
$tpl->assign('scrollposy', isset($_REQUEST['scrollposy']) ? $_REQUEST['scrollposy'] + 0 : 0);
$tpl->assign('validate', $validate);
$tpl->display();
?>
@@ -114,6 +114,8 @@ function changetext()
{
$tpl->name = 'mydescription';
assignFromDB($login->userid,true);
$tpl->assign('scrollposx', isset($_REQUEST['scrollposx']) ? $_REQUEST['scrollposx'] + 0 : 0);
$tpl->assign('scrollposy', isset($_REQUEST['scrollposy']) ? $_REQUEST['scrollposy'] + 0 : 0);
$tpl->display();
}
}
@@ -195,6 +195,9 @@
$tpl->assign('descMode', $descMode);
$tpl->assign('list_caches', $list_caches);
$tpl->assign('scrollposx', isset($_REQUEST['scrollposx']) ? $_REQUEST['scrollposx'] + 0 : 0);
$tpl->assign('scrollposy', isset($_REQUEST['scrollposy']) ? $_REQUEST['scrollposy'] + 0 : 0);
$tpl->display();
?>
@@ -944,7 +944,10 @@
if ($no_tpl_build == false)
{
//make the template and send it out
tpl_set_var('scrollposx', isset($_REQUEST['scrollposx']) ? $_REQUEST['scrollposx'] + 0 : 0);
tpl_set_var('scrollposy', isset($_REQUEST['scrollposy']) ? $_REQUEST['scrollposy'] + 0 : 0);
// make the template and send it out
tpl_BuildTemplate();
}
?>
@@ -233,6 +233,9 @@
}
}
tpl_set_var('scrollposx', isset($_REQUEST['scrollposx']) ? $_REQUEST['scrollposx'] + 0 : 0);
tpl_set_var('scrollposy', isset($_REQUEST['scrollposy']) ? $_REQUEST['scrollposy'] + 0 : 0);
//make the template and send it out
tpl_BuildTemplate();
?>
@@ -16,6 +16,9 @@

function OcInitEditor()
{
if (document.editform.scrollposx.value + document.editform.scrollposy.value != 0)
window.scrollTo(document.editform.scrollposx.value, document.editform.scrollposy.value);

document.getElementById("scriptwarning").firstChild.nodeValue = "";
document.getElementById("oldDescMode").value = descMode;
if (descMode == 3)
@@ -122,13 +125,26 @@
if (switchfield != null)
switchfield.value = "1";

if (document.getElementById("editor"))
document.editform.action += '#editor';

saveScrollPos();
document.editform.submit();
}
}

function saveScrollPos()
{
if (window.pageXOffset != undefined)
{
document.editform.scrollposx.value = window.pageXOffset;
document.editform.scrollposy.value = window.pageYOffset;
}
else
{
var d = document, r = d.documentElement, b = d.body;
d.editform.scrollposx.value = r.scrollLeft || b.scrollLeft || 0;
d.editform.scrollposy.value = r.scrollTop || b.scrollTop || 0;
}
}

function btnMouseOver(id)
{
switch (id)
@@ -84,6 +84,8 @@ function _chkFound () {
<input type="hidden" name="version3" value="1"/>
<input id="descMode" type="hidden" name="descMode" value="1" />
<input id="oldDescMode" type="hidden" name="oldDescMode" value="1" />
<input type="hidden" name="scrollposx" value="{$scrollposx}" />
<input type="hidden" name="scrollposy" value="{$scrollposy}" />
<table class="table">
<tr><td class="spacer" colspan="2"></td></tr>
<tr><td colspan="2"></td></tr>
@@ -14,6 +14,8 @@
<input type="hidden" name="action" value="changetext" />
<input id="descMode" type="hidden" name="descMode" value="3" />
<input id="oldDescMode" type="hidden" name="oldDescMode" value="3" />
<input type="hidden" name="scrollposx" value="{$scrollposx}" />
<input type="hidden" name="scrollposy" value="{$scrollposy}" />

<p>{t}The following text is displayed in your <a href="viewprofile.php">public profile</a>:{/t}</p>

@@ -54,6 +54,8 @@
<input id="oldDescMode" type="hidden" name="oldDescMode" value="3" />
<input type="hidden" id="switchDescMode" name="switchDescMode" value="0" />
{if $fromsearch}<input type="hidden" name="fromsearch" value="{$fromsearch}" />{/if}
<input type="hidden" name="scrollposx" value="{$scrollposx}" />
<input type="hidden" name="scrollposy" value="{$scrollposy}" />

<table class="table" id="addlist" {if !($name_error || $edit_list || $newlist_mode)}style="display:none"{/if}>
<tr><td class="separator"></td></tr>

0 comments on commit db30747

Please sign in to comment.
You can’t perform that action at this time.