WordPress phpBB mChat integration procedure

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

Re: WordPress phpBB mChat integration procedure

Post by axew3 »

the above has been edited
xray
User ww
User ww
Posts: 34
Joined: Mon Dec 24, 2018 9:48 pm

Re: WordPress phpBB mChat integration procedure

Post by xray »

I applied the new code, but that did not work.

The link for a post in the chat box is what I am referring to. If there is a topic post and clicked its staying within the chat. If I am using the mChat from the iFrame the link will work. Expected behavior would be when clicking on a link within the wp_chat box it will open the iFrame forum, or if its an external link to another site than it goes there. Otherwise it will open the forum.
User avatar
axew3
w3all User
w3all User
Posts: 2689
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: WordPress phpBB mChat integration procedure

Post by axew3 »

yes gotcha the problem looking asap
User avatar
axew3
w3all User
w3all User
Posts: 2689
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: WordPress phpBB mChat integration procedure

Post by axew3 »

ok look may i have over complicate things, it seem to me lack of the right tricky and easy logic that exist behind, even if i've not still discover. I will return over as soon i stop to fight with an mmpeg install on a centoOS cloud server :( unable to compile it correctly like a newbie from hours now- damned

But in the while the patched code may can be something like this (that maybe resolve the problem):

Code: Select all

<script>
// a simple mChat style/display example setup for WP 
if( /#w3allmchatif/ig.exec(document.URL) != null || /#w3allmchatif/ig.exec(document.location.href) != null ){
	var boardU = "{BOARD_URL}";
	var hnofollow = 0;
$( document ).ready(function() {

$( "body" ).on("click", "a", function(e) {
	var href = $(this).attr("href");

 if( typeof href != 'undefined' && this.href[this.href.length -1] != '#' && /\?jumpto=/ig.exec(this.href) == null )
	{
	 if( href.indexOf(boardU) < 0 || href.indexOf('i=permissions&mode=setting_user_global') > -1 || href.indexOf('/mchat') > -1 ){
	 //if(href.indexOf('/mchat') > -1){
	 if( /[.+[\/mchat]$/ig.exec(href) !== null ){
		return;
	 }
	 
		hnofollow = 1;
		e.preventDefault();
		e.stopPropagation();
		window.open(href,'_blank');
		return;
	} else {
		e.preventDefault();
		e.stopPropagation();
		window.open(href,'_blank');
		return;
	}
	}
});	
	
$( "#page-header,#page-footer" ).css( { "height" : "0px", "max-height" : "0px", "overflow": "hidden" } ); // can't be none, or events will not affect
$( "body" ).css( "padding", "0px" );
$( ".page-body h2" ).css( "display", "none" );
$( "div.mchat-text blockquote div cite a" ).click(function(e) {
	if( /\?jumpto=/ig.exec(this.href) == null ){
		e.preventDefault();
		if(hnofollow < 1){
		 window.open(this.href,'_blank');
	  }
		return;
	}
});

$( "div.list-inner span.mchat-title a" ).click(function(e) {
		e.preventDefault();
		window.open(this.href,'_blank');
		return;
});

$( "body" ).on("click", ".username,.username-coloured,#mchat-legend a,cite a", function(e) {
	var href = $(this).attr("href");
	if( typeof href != 'undefined' && /\?jumpto=/ig.exec(this.href) == null ){
		e.preventDefault();
		if(hnofollow < 1){
		window.open(href,'_blank');
	}
		return;
	}
});

}); // ready
}
</script>
xray
User ww
User ww
Posts: 34
Joined: Mon Dec 24, 2018 9:48 pm

Re: WordPress phpBB mChat integration procedure

Post by xray »

Added fix to style/prosilver/overall_footer.html

I clicked on the link within the chat window and expected behavior to open within the WP iFrame is correct. Instead of it opening the current window it opens a new window, but takes you to the link within the forum AND it keeps you logged in.
User avatar
axew3
w3all User
w3all User
Posts: 2689
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: WordPress phpBB mChat integration procedure

Post by axew3 »

OBSOLETE
1.9.5 has been released and the procedure is available here
but takes you to the link within the forum AND it keeps you logged in.
I've not well understand this, i will take a look asap because would like to release new plugin vers very soon.
The css code to style mChat html elements wrappers has been separated into a file, that can be so also moved/edited into custom folder to avoid the overwrite of custom css style when plugin update.
About the needed js on overall_footer.html, it is just a little short piece of code to make the joke happen. As said last time, it lack to me of the trick to make all work perfect in a more easy way about links/buttons, without adding more code to complicate things, so some idea will come out in short in mind as over the thing or may because suggested!

P.s last time i've test the second test code, that i nor applied on the online raw example, it was working ok in any mess i've try, but maybe i've not check all
Post Reply