Like SystemiConnectFri 15 Oct 2021, 04:50
Auto Save MessagesLGforumFri 26 Feb 2021, 13:31
New tutorial questionTheCrowMon 15 Feb 2021, 08:12
Support iOS Emojis (and other platforms)LGforumSun 14 Feb 2021, 01:25
LGforum (2806)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
Mr.Easybb (1587)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
Bloodbath (745)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
Rukiafan (533)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
Dom (513)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
puppycheese (446)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
pedro (330)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
Neymar (301)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
Hitsu (281)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 
Flora (275)
Test RegExp value Vote_lcapTest RegExp value Voting_barTest RegExp value Vote_rcap 


Test RegExp value

SSYTSSYT
Status : SSYT 2.0 is here - 2k17

Posts : 12
Join date : 2015-05-05
Age : 29
Fri 06 May 2016, 08:24
Code:
[panda=js]// Hook of forumotion post !
// Inline Quote by SSYT.JS (RO.SSYT)
$(function() {
    var $post = $('.post .postbody'), i = 0;
    for(i; i < $post.length; i++) {
        var x = new RegExp("`(.*?)`", "g");
        if(/^http([s]?):\/\/.*/.test(x)) $post[i].innerHTML = $post[i].innerHTML.replace(x, "<span class="inline-quote"><a href="$1">$1</a></span>"); else $post[i].innerHTML = $post[i].innerHTML.replace(x, "<span class="inline-quote">$1</span>");
    }
});

How to test/check on var x is url?
LGforumLGforum
Status : Working to restore AWC!

Posts : 2806
Join date : 2011-10-05
Age : 30
Location : UK
Fri 06 May 2016, 09:35
Well X is never a URL because X is a RegExp. What you need to test is the matches to X.
SSYTSSYT
Status : SSYT 2.0 is here - 2k17

Posts : 12
Join date : 2015-05-05
Age : 29
Fri 06 May 2016, 17:37
Ok, thanks !
LGforumLGforum
Status : Working to restore AWC!

Posts : 2806
Join date : 2011-10-05
Age : 30
Location : UK
Fri 06 May 2016, 19:11
Let me know if you need more help.

I like the idea of this code, but if you're planning on adding more BBcode style features then LGBB is right way to go Wink
If you have LGBB installed already, this code would give you what you want:
[ic]LGBB.addSwap(/`(.*?)`/g, '<span class="inline-quote">$1</span>');[/ic]

We actually have an inline quote feature on this forum but it uses BBcode: [iq=AdminX]Inline quote - hover over to see the username[/iq]
SSYTSSYT
Status : SSYT 2.0 is here - 2k17

Posts : 12
Join date : 2015-05-05
Age : 29
Sat 07 May 2016, 19:28
Thanks for solution LGforum Smile
Sponsored content