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.

Title of watched topics in notifications

View previous topic View next topic Go down

Title of watched topics in notifications

Post by Ange Tuteur on December 19th 2014, 6:49 am

Title of watched topics in notifications
For the notification of a watched topic, there is this phrase " Username wrote a message in a watched topic " :


This tutorial will allow you to modify that phrase, to put the title of the topic and simplify it :


The topic title is simplified to where :

  • a, b, c, d, ..., x, y, z, 0, 1, 2, ..., 7, 8, 9, _ and spaces are preserved
  • é, à, ï, ç, ... are replaced by their basic letter
  • - is replace by a space
  • others are ignored


Installation

Go to Administration Panel > Modules > JavaScript codes management. Make sure JavaScript codes management is enabled, and create a new script.

Title : Your choice
Placement : In all the pages
Code:
$(function(){
  var middle_text = " replied to ";
  var empty_title = "this topic";
  if(typeof(compileNotif)!="function")return;var d=compileNotif;Toolbar.compileNotif=compileNotif=function(b){var a=d(b);if(b.text.type==FA.Notification.NOTIF_TOPIC_WATCH){var c=a.match(/^(.*) wrote a message (<a href="\/t[0-9]+(p[0-9]+)?-([^#?"]*)[^"]+">)[^<]+<\/a>$/);c&&(b=c[1]+middle_text+c[2],a=c[4],a="topic"==a||/^[\s-]*$/.test(a)?empty_title:a.replace(/-/g," ").replace(/(^\s+|\s+$)/g,""),a=b+a+"</a>")}return a}
});

You can modify these texts :

  • " replied to " => text between the poster and topic link
  • "this topic" => text if there is no simplified topic title


Notifications Page (Optional)

Go to Administration Panel > Modules > JavaScript codes management.

Title : Your choice
Placement : In all the pages
Code:
location.pathname=="/profile" && location.search.indexOf("page_profil=notifications")!=-1 && $(function(){
 
  var middle_text = " replied to ";
  var empty_title = "this topic";
 
  $('.table1 td:first-child,td.gen:first-child,.ipbtable td:first-child,.tcr .postdetails').each(function(){
    var a = $(this).html();
    var c = a.match(/^(.*) wrote a message (<a href="\/t[0-9]+(p[0-9]+)?-([^#?"]*)[^"]+">)[^<]+<\/a>$/);
    c&&(b=c[1]+middle_text+c[2],a=c[4],a="topic"==a||/^[\s-]*$/.test(a)?empty_title:a.replace(/-/g," ").replace(/(^\s+|\s+$)/g,""),$(this).html(b+a+"</a>"))
  });
 
});






Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
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