Turn of auto hyperlink in posts
4 posters
Page 1 of 1
Turn of auto hyperlink in posts
Hi!
Is it possible to turn of auto hyperlink in posts? I need to use url in posts by JS but when it is turned automaticly into hyperlink it breaks my script. Turning it automaticly is not needed for me.
Is it possible to turn of auto hyperlink in posts? I need to use url in posts by JS but when it is turned automaticly into hyperlink it breaks my script. Turning it automaticly is not needed for me.
Last edited by Zanzazaar on November 9th 2021, 3:40 pm; edited 1 time in total
Re: Turn of auto hyperlink in posts
I have looked over the ACP and I don't think it can be turned off unless @pedxz knows of away to stop it using javaScript
Re: Turn of auto hyperlink in posts
@pedxz
It is about that part
- Code:
$(function() {
$('div.postbody div').each(function () {
if ($(this).text().indexOf('[imie]') != -1) $(this).html($(this).html().replace(/\[imie\](.+?)\[\/imie\]/gi, '<div class="mainSquare"><img src="https://66.media.tumblr.com/22bd78b829ff310508e1647b7e424d0b/tumblr_ow2jhkQQ5t1sy4y3mo6_1280.png" class="headerSquare"><div class="nameSquare">$1 </div>'));
if ($(this).text().indexOf('[portret]') != -1) $(this).html($(this).html().replace(/\[portret\](.+?)\[\/portret\]/gi, '<img src="$1" class="iconSquare"></img><div class="kp3w">'));
if ($(this).text().indexOf('[cecha]') != -1) $(this).html($(this).html().replace(/\[cecha\](.+?)\[\/cecha\]/gi, '<div class="kp3">$1 </div>'));
if ($(this).text().indexOf('[opis]') != -1) $(this).html($(this).html().replace(/\[opis\](.+?)\[\/opis\]/gi, '</div><div class="kp4"><div class="kp4t">Opis</div><div class="kp4d">$1 </div></div></div>'));
});
});
It is about that part
- Code:
if ($(this).text().indexOf('[portret]') != -1) $(this).html($(this).html().replace(/\[portret\](.+?)\[\/portret\]/gi, '<img src="$1" class="iconSquare"></img><div class="kp3w">'));
Last edited by Zanzazaar on November 8th 2021, 10:13 pm; edited 1 time in total
Re: Turn of auto hyperlink in posts
Already tried this one, I turned it off and it didn't helped...SLGray wrote:Check this: AP > General > Messages & Emails > Configuration
Messages Section
Allow Embed Links via [EMBED] :
Re: Turn of auto hyperlink in posts
Could you send me a test account and a link to a post that has this issue?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Turn of auto hyperlink in posts
K, it is on PW
Little change in a code, I was checking something in the meantime, one symbol was wrong
Little change in a code, I was checking something in the meantime, one symbol was wrong
Re: Turn of auto hyperlink in posts
Your PM has been received with thanks.
|
Is this solved now?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Turn of auto hyperlink in posts
Did you tried as logged user? On what browser? It does only broke for logged users. For guests it works as intended.
Re: Turn of auto hyperlink in posts
The reason why it works when your not logged in is because All links on our forums are not clickable when not logged in but they are when your logged in.
Re: Turn of auto hyperlink in posts
And thats why I want to make them non clickable also for logged users It is not needed as there is bbcode url
Re: Turn of auto hyperlink in posts
I was using Firefox on a PC. I was logged in using the test account you gave me,
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Turn of auto hyperlink in posts
BTW, sorry for edgy content with that image, it in for an example
No repro (logged of on firefox, should always look like that):
https://imgur.com/9ihFtIn
Repro (logged in on firefox):
https://imgur.com/ZkFK04o
There should be "image in the circle" and shouldn't aby part of html visible. This issue is visible for me on edge, opera gx, firefox on two devices and again for one more user that was trying to help me.
No repro (logged of on firefox, should always look like that):
https://imgur.com/9ihFtIn
Repro (logged in on firefox):
https://imgur.com/ZkFK04o
There should be "image in the circle" and shouldn't aby part of html visible. This issue is visible for me on edge, opera gx, firefox on two devices and again for one more user that was trying to help me.
Re: Turn of auto hyperlink in posts
Change your script to:Zanzazaar wrote:It works if user is logged of, but after log in, links in posts are automaticaly changed into hyperlinks, due to that I cannot change that part with that JS.
- Code:
(function($) {
'use strict';
$(function() {
$([
'.post-entry > div',
'.content > div',
'#preview .postbody > div',
].join(', ')).each(function() {
var $this = $(this);
$this.html($this.html().replace(
/\[imie\]([^\]]+)\[\/imie\]/gi,
function(text, imie) {
return $('<div>', {
'html': [
'<img src="https://66.media.tumblr.com/22bd78b829ff310508e1647b7e424d0b/tumblr_ow2jhkQQ5t1sy4y3mo6_1280.png" class="headerSquare" loading="lazy">',
'<div class="nameSquare">' + imie + '</div>'
].join('\n'),
'class': 'mainSquare',
}).prop('outerHTML');
}
));
$this.html($this.html().replace(
/\[portret\]([^\[]+)\[\/portret\]/g,
function(text, portret) {
return $('<img>', {
'src': location.protocol + '//' + portret,
'class': 'iconSquare',
'loading': 'lazy'
}).prop('outerHTML');
}
));
$this.html($this.html().replace(
/\[cecha\]([^\]]+)\[\/cecha\]/gi,
function(text, cecha) {
return $('<div>', {
'class': 'kp3',
'text': cecha
}).prop('outerHTML');
}
));
$this.html($this.html().replace(
/\[opis\]([^\]]+)\[\/opis\]/gi,
function(text, opis) {
return $('<div>', {
'class': 'kp4',
'html': [
'<div class="kp4t">Opis</div>',
'<div class="kp4d">' + opis + '</div>'
].join('\n')
}).prop('outerHTML');
}
));
});
});
})(jQuery);
|
|
- Code:
[portret]i.servimg.com/u/f62/09/00/43/96/xppj910.png[/portret]
- Code:
if ($(this).text().indexOf('[portret]') != -1) $(this).html($(this).html().replace(/\[portret\](.+?)\[\/portret\]/gi, '<img src="$1" class="iconSquare"></img><div class="kp3w">'));
- Code:
if ($(this).text().indexOf('[portret]') != -1) $(this).html($(this).html().replace(/\[portret\]([^\[]+)\[\/portret\]/g, '<img src="http://$1" class="iconSquare" loading="lazy" /><div class="kp3w">'));
Re: Turn of auto hyperlink in posts
Second solution is one of two work arounds that I was thinking about. Secondary is to use bbcode img and put it choosen div by something like those codes and use css by targeting only images in choosen div.
I think I will stay with my current code as it is not only for me and that looks shorter , but if I may ask, is ther any advantage of putting funkction in second part of regex?
I think I will stay with my current code as it is not only for me and that looks shorter , but if I may ask, is ther any advantage of putting funkction in second part of regex?
Re: Turn of auto hyperlink in posts
The only difference in codes is that I don't see the need for:Zanzazaar wrote:I think I will stay with my current code as it is not only for me and that looks shorter , but if I may ask, is ther any advantage of putting funkction in second part of regex?
- Code:
if ($(this).text().indexOf('[portret]') != -1)
Re: Turn of auto hyperlink in posts
Thank you @pedxz for your help
Problem solved & topic archived.
|
tikky likes this post
Similar topics
» Auto-pruning into Auto-Locking
» Hyperlink in Welcome Message
» Infrequent Popups - Opened when clicking on login button, hyperlink on front page to recent posts
» Way to turn this off?
» How to set auto watch forums (not posts)
» Hyperlink in Welcome Message
» Infrequent Popups - Opened when clicking on login button, hyperlink on front page to recent posts
» Way to turn this off?
» How to set auto watch forums (not posts)
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum