chrome scrolling bug

User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: chrome scrolling bug

Post by axew3 »

hi, i assume due to the fact that without bracket the code fail to be executed, so the behavior is the consequence?
i do not see any error right now into your wp iframed page, so put me another time in what exactly you want to resolve now.
i have your forum page link, just explain what i should do to see the problem you want to resolve.

the smoothScroll plugin should be part of the phpBB theme. CHeck if there is option to just disable it, i see that it not fire in iframed phpBB, while it show up on bottom on full forum
???
kiro
User ww
User ww
Posts: 33
Joined: Wed Jul 25, 2018 6:44 pm

Re: chrome scrolling bug

Post by kiro »

axew3 wrote: Sun Sep 09, 2018 10:02 am the smoothScroll plugin should be part of the phpBB theme. CHeck if there is option to just disable it, i see that it not fire in iframed phpBB, while it show up on bottom on full forum
???
curious, i didn't notice. by the way, what i told you is not a smooth scrool to top when clicking links and buttons, is a instantly quickly jump to the top

well, i had not the bracket yesterday so if you say that without the bracket the code fail, i add it.
then, right now the jump-to-top is not a problem. when i click a link it leads to the correct position of the page without jumping. so the problem now is that the URL always is xxx.net/forum in the iframe page. so, for example, i can't copy the url for a specific topic or forum (is something like xxx.net/forum/?f=2 for forums i noticed).
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: chrome scrolling bug

Post by axew3 »

i will be around on later afternoon pointing you to resolve this aspect you just need to activate a part of the code added into overall_footer.html about this. I will provide you the code as it need to be when in place more later.
I've start little time yesterday to take a look into the iframe aspect, without big success to move further on at moment, so i'll see as i can to fix what possible also about all others things.
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: chrome scrolling bug

Post by axew3 »

Code for overall_footer.html

Code: Select all

<script type="text/javascript">
	
document.domain = 'neomundos.net'; // THIS IS MANDATORY! Set/Change this value to your domain (example: axew3.com (or leave localhost if on localhost)) 
 
var w3all_doc_domain = document.domain;
 
  $(document).on("click", "a", function() {
   var href = $(this).attr("href");
  $(this).attr("href", href.replace('iframe=true&', '')); // remove! or get loop in htaccess if our var has been appended before ...
   var w3allappend = href;
   var w3all_parent_element_id = $(this).parent().get( 0 ).id; // detect click x ... (ex: return ID smiley-box, onclick post smiles) ... // detect and avoid/allow certain behaviors
   var w3all_onclick_smile  = (w3all_parent_element_id.indexOf('smiley-box') > -1);
   var w3all_onview_topic  = (href.indexOf('viewtopic.php') > -1);
   var w3all_onview_attach  = (href.indexOf('file.php') > -1);
   var w3all_onview_post = /#p[0-9]+/ig.exec(href);
   var w3all_ck_quickmod  = (href.indexOf('quickmod') > -1);
   var w3all_onreply_topic  = (href.indexOf('mode=reply') > -1);
   var w3all_ck_onindex  = (href.indexOf('index.php') > -1);
   var w3all_onsubmit_post = /^post?/ig.exec(href);
  
var mfs = $(this.window).scrollTop() + 0; // may change to 100, or 200 the 0 value here, to better fit your WP theme on scroll 
    if ( w3all_onclick_smile === false && w3all_onview_attach === false ) {
   if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,mfs);
  }
  if ('parentIFrame' in window) window.parentIFrame.sendMessage(w3allappend);
});
 
///////////////////////////////////////////////////////////////////////////
// w3all Ajax UPDATES for phpBB events
 
if (window.frameElement) { // if in iframe mode ... if phpBB is surfed by full address and not iframe
 
window.onload = function() {
var pmn = "{PRIVATE_MESSAGE_COUNT}";
var w3all_phpbb_u_logged = "{S_USER_LOGGED_IN}";
// to send to wp at once here, like this: #w3all_phpbbpmcount=val#w3all_phpbbnotifycount=val#etc etc etc
var w3appendevents = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged;
parent.w3all_ajaxup_from_phpbb(w3appendevents);
}
 
///////////////////////////////////////////////////////////////////////////
// htaccess trick for right click /copy/paste/ links
// to apply htaccess rules and rewrite urls for this and email notification, please read this tutorial:
// https://www.axew3.com/w3/2017/04/wp_w3all-htaccess-javascript-rewrite-links-point-iframe-how-to/
 
// remove starting /* and ending */ 
// that wrap the code here below to activate
 
$( "a" ).contextmenu(function() {
  var href = $(this).attr("href");
  var shortlink = /^#p[0-9]+/ig.exec(href);
	var ck  = (href.indexOf('iframe=true') > -1);
	var ckl = /^(http[s]?:\/\/[-a-z0-9\.]+)/ig.exec(href); // check if link point to external resource: a passed phpBB url (attr("href")) is relative, not absolute: so we assume that if http(s) is present, 
	// than it should be a link that point to an external iframe resource. Can be improved further more using this same pattern result.
	
	 if ( ck == false && ckl == null && shortlink == null ){ // not re-append // not append if short link like #p49 (link of the post on viewtopic) or passed link point to an external resource
	 	  var href0 = href.split('?');
	 	  if(href0[1] == null){ href0[1] = ''; } else { href0[1] = '&' + href0[1]; }
      var href1 = href0[0] + '?iframe=true' + href0[1];
    $(this).attr("href", href1); // send out before mouseup ...
   }
});
$( "a" ).mouseup(function() { // but remove on mouseup, or leaving iframe=true we'll loop with htaccess ...
  var href = $(this).attr("href");
  $(this).attr("href", href.replace('iframe=true&', ''));
});
 
// TO ACTIVATE phpBB lightbox events remove /* and */ here below
// NOTE: Due to last update fix, this should not be more required, as in any other phpBB mod
/* 
$(document).on('mouseup', '.postimage', function(){
 //var w3allappend = "getw3all_lightbox";
 if ('parentIFrame' in window) window.parentIFrame.scrollToOffset(0,0);
 //if ('parentIFrame' in window) window.parentIFrame.sendMessage(w3allappend);
});
*/
 
} // END if (window.frameElement) {
</script>
<script type="text/javascript" src="https://foro.neomundos.net/iframeResizer.contentWindow.min.js" defer></script>
Recompile phpBB template.
Now open the .htaccess file of your phpBB root folder, search for this line:

Code: Select all

RewriteRule ^(.*)$ app.php [QSA,L]
immediately after add this:

Code: Select all

#p reserved in WP
RewriteCond %{QUERY_STRING} ^(.*)(iframe=true&)(.*)(p=)([0-9]+)(.*)?$
RewriteRule . /index.php/forum/?%3post_id=%5%6 [R,L]
#all others
RewriteCond %{QUERY_STRING} ^(.*)(iframe=true)(.*)$
RewriteRule . /index.php/forum/?%3 [R,L]
note the /index.php/forum that is the relative url in wp to your wp (phpBB iframed) forum page.
kiro
User ww
User ww
Posts: 33
Joined: Wed Jul 25, 2018 6:44 pm

Re: chrome scrolling bug

Post by kiro »

thank you. i added the code and recompiled in the moment you told and didn't make any effect.
something must be missing
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: chrome scrolling bug

Post by axew3 »

not missed, there is a not needed bracket more, this is the correct tested code (with domain and js file inclusion ready for your site)

Code: Select all

<script type="text/javascript">
	
document.domain = 'neomundos.net'; // THIS IS MANDATORY! Set/Change this value to your domain (example: axew3.com (or leave localhost if on localhost)) 
 
var w3all_doc_domain = document.domain;
 
  $(document).on("click", "a", function() {
   var href = $(this).attr("href");
  $(this).attr("href", href.replace('iframe=true&', '')); // remove! or get loop in htaccess if our var has been appended before ...
   var w3allappend = href;
   var w3all_parent_element_id = $(this).parent().get( 0 ).id; // detect click x ... (ex: return ID smiley-box, onclick post smiles) ... // detect and avoid/allow certain behaviors
   var w3all_onclick_smile  = (w3all_parent_element_id.indexOf('smiley-box') > -1);
   var w3all_onview_topic  = (href.indexOf('viewtopic.php') > -1);
   var w3all_onview_attach  = (href.indexOf('file.php') > -1);
   var w3all_onview_post = /#p[0-9]+/ig.exec(href);
   var w3all_ck_quickmod  = (href.indexOf('quickmod') > -1);
   var w3all_onreply_topic  = (href.indexOf('mode=reply') > -1);
   var w3all_ck_onindex  = (href.indexOf('index.php') > -1);
   var w3all_onsubmit_post = /^post?/ig.exec(href);
  
var mfs = $(this.window).scrollTop() + 0; // may change to 100, or 200 the 0 value here, to better fit your WP theme on scroll 
    if ( w3all_onclick_smile === false && w3all_onview_attach === false ) {
   if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,mfs);
  }
  if ('parentIFrame' in window) window.parentIFrame.sendMessage(w3allappend);
});
 
///////////////////////////////////////////////////////////////////////////
// w3all Ajax UPDATES for phpBB events
 
if (window.frameElement) { // if in iframe mode ... if phpBB is surfed by full address and not iframe
 
window.onload = function() {
var pmn = "{PRIVATE_MESSAGE_COUNT}";
var w3all_phpbb_u_logged = "{S_USER_LOGGED_IN}";
// to send to wp at once here, like this: #w3all_phpbbpmcount=val#w3all_phpbbnotifycount=val#etc etc etc
var w3appendevents = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged;
parent.w3all_ajaxup_from_phpbb(w3appendevents);
}
 
///////////////////////////////////////////////////////////////////////////
// htaccess trick for right click /copy/paste/ links
// to apply htaccess rules and rewrite urls for this and email notification, please read this tutorial:
// https://www.axew3.com/w3/2017/04/wp_w3all-htaccess-javascript-rewrite-links-point-iframe-how-to/
 
// remove starting /* and ending */ 
// that wrap the code here below to activate
 
$( "a" ).contextmenu(function() {
  var href = $(this).attr("href");
  var shortlink = /^#p[0-9]+/ig.exec(href);
	var ck  = (href.indexOf('iframe=true') > -1);
	var ckl = /^(http[s]?:\/\/[-a-z0-9\.]+)/ig.exec(href); // check if link point to external resource: a passed phpBB url (attr("href")) is relative, not absolute: so we assume that if http(s) is present, 
	// than it should be a link that point to an external iframe resource. Can be improved further more using this same pattern result.
	
	 if ( ck == false && ckl == null && shortlink == null ){ // not re-append // not append if short link like #p49 (link of the post on viewtopic) or passed link point to an external resource
	 	  var href0 = href.split('?');
	 	  if(href0[1] == null){ href0[1] = ''; } else { href0[1] = '&' + href0[1]; }
      var href1 = href0[0] + '?iframe=true' + href0[1];
    $(this).attr("href", href1); // send out before mouseup ...
   }
});
$( "a" ).mouseup(function() { // but remove on mouseup, or leaving iframe=true we'll loop with htaccess ...
  var href = $(this).attr("href");
  $(this).attr("href", href.replace('iframe=true&', ''));
});
 
// TO ACTIVATE phpBB lightbox events remove /* and */ here below
// NOTE: Due to last update fix, this should not be more required, as in any other phpBB mod
/* 
$(document).on('mouseup', '.postimage', function(){
 //var w3allappend = "getw3all_lightbox";
 if ('parentIFrame' in window) window.parentIFrame.scrollToOffset(0,0);
 //if ('parentIFrame' in window) window.parentIFrame.sendMessage(w3allappend);
});
*/
 
} // END if (window.frameElement) {
</script>
<script type="text/javascript" src="https://foro.neomundos.net/iframeResizer.contentWindow.min.js" defer></script>
Locked