The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Hide effect for similar topics script

View previous topic View next topic Go down

Solved Hide effect for similar topics script

Post by darki on Wed 02 Sep 2015, 19:00

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.

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 on Wed 02 Sep 2015, 21:22

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
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Hide effect for similar topics script

Post by darki on Wed 02 Sep 2015, 21:33

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

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 on Wed 02 Sep 2015, 21:40

You're welcome ^^

Topic archived

Have a nice day. Smile

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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