The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Hide effect for similar topics script

2 posters

Go down

Solved Hide effect for similar topics script

Post by darki September 2nd 2015, 7:00 pm

Hi,

I'm using this script from @Ange Tuteur and it works great:
http://fmdesign.forumotion.com/t240-display-similar-topics-on-creation-of-a-new-topic

But now I want something similar to a spoiler/toggle/hide effect for this script. Through this effect it should be possible to show or hide the display for similar topics.

Anyone know how to edit this script for phpbb3?

Thanks in advance.
avatar
darki
Forumember

Posts : 254
Reputation : 10
Language : German, english

http://schiggysboard.com

Simone Boi likes this post

Back to top Go down

Solved Re: Hide effect for similar topics script

Post by Ange Tuteur September 2nd 2015, 9:22 pm

Hi @darki,

Try replacing the script with this :
Code:
/\?f=\d+&mode=newtopic/.test(window.location.search) && $(function() {
  var s = document.getElementsByTagName('INPUT'),i, b;
  for (i=0; i<s.length; i++) {
    if (/subject/.test(s[i].name)) {
      var d = document.createElement('DIV');
      d.innerHTML = '<div id="similarToggle" class="h3">Show Similar Topics</div><div id="topicSimilar" style="display:none">No similar topics..</div>';
      s[i].parentNode.appendChild(d);

      s[i].onkeyup = function() {
        if (this.value.length > 3) $('#topicSimilar').load('/search?search_keywords='+encodeURIComponent(this.value)+' a.topictitle', function() {
          $(this).find('a').attr({'target' : '_blank', 'style' : 'display:block'});
        });
        else $('#topicSimilar').html('No similar topics..');
      };

      b = document.getElementById('similarToggle');

      b.style.cursor = 'pointer';
      b.onclick = function() {
        var box = document.getElementById('topicSimilar');
        if (/none/.test(box.style.display)) {
          box.style.display = 'block';
          this.innerHTML = 'Hide Similar Topics';
        } else {
          box.style.display = 'none';
          this.innerHTML = 'Show Similar Topics';
        }
      };

      break;
    }
  }
});

Should be hidden by default, and to show it just click the title.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Simone Boi likes this post

Back to top Go down

Solved Re: Hide effect for similar topics script

Post by darki September 2nd 2015, 9:33 pm

Wow, works great, thank you very much for your help Ange! Smile
avatar
darki
Forumember

Posts : 254
Reputation : 10
Language : German, english

http://schiggysboard.com

Back to top Go down

Solved Re: Hide effect for similar topics script

Post by Ange Tuteur September 2nd 2015, 9:40 pm

You're welcome ^^

Topic archived

Have a nice day. Smile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum