Latest topics
Recent Tutorials
Who is online?
In total there are 12 users online :: 3 Registered, 0 Hidden and 9 Guests

Ace 1, DDril, Wolfuryo

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

Starred Forums

Page 2 of 3 Previous  1, 2, 3  Next

View previous topic View next topic Go down

avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9687
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Wed 20 Apr 2016, 13:27

First topic message reminder :

This plugin allows you to "Star" forums. Starred forums are placed at the very top of the forum list, so you can easily access your favorite forums.


Click to view demo

Features
Usability ! You can star forums by hovering over the forum title and clicking the star next to it. You can unstar starred forums the same way.
Easy Access ! All the forums that you starred will be available at the top of the forum list.
Editability ! Personalize this plugin by changing the text, icons, etc ..!

This plugin will work on any forum version, so long as the templates aren't heavily modified.


Installation

To install this plugin go to Admin Panel > Modules > JavaScript codes management and create a new script with the following settings.

Title : Starred Forums
Placement : In the homepage
Code:
$(function() {
  'DEVELOPED BY ANGE TUTEUR';
  'NO DISTRIBUTION WITHOUT CONSENT OF THE AUTHOR';
  'ORIGIN : http://fmdesign.forumotion.com/t501-starred-forums#6825';
  if (/\/c\d+-/.test(window.location.href)) return; // return if category
 
  // automatically detects the version
  var version = $('.bodylinewidth')[0] ? 0 : document.getElementById('wrap') ? 1 : $('div.pun')[0] ? 2 : document.getElementById('ipbwrapper') ? 3 : document.getElementById('fa_edge') ? 4 : 'badapple';
 
  // error notifications
  if (version == 'badapple' || !window.JSON || !window.localStorage) {
    var errString = 'The plugin "fa_starred" could not be executed because : ';
 
    if (version == 'badapple') errString += '\nYour forum version is not supported.';
    if (!window.JSON) errString += '\nJSON is not supported by your browser';
    if (!window.localStorage) errString += '\nThe Storage API is not support by your browser.';
 
    window.console && console.error ? console.error(errString) : alert(errString);
    return;
  }
 
  // get fontawesome if unavailable
  if (!$('link[href$="font-awesome.min.css"]')[0]) {
    document.getElementsByTagName('HEAD')[0].insertAdjacentHTML('beforeend', '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" />');
  }
 
  window.fa_starred = {
    version : version, // forum version
    forums : localStorage.fa_starred_forums ? JSON.parse(localStorage.fa_starred_forums) : null,
 
    // language settings
    lang : {
        star : 'Star this forum',
      unstar : 'Unstar this forum',
      starred : 'Starred Forums'
    },
 
    icon : {
        star : '',
      unstar : ''
    },
 
    // selectors
    select : {
      content : version ? document.getElementById('main-content') : $('#content-container td:has(> img[height="5"])')[0],
      category : ['.forumline:has(.secondarytitle)', '.forabg', '.main:has(.tcr) .main-content', '.borderwrap:has(.index-box)', '.forum-category'][version],
      forum : 'a.' + (version ? 'forumtitle' : 'forumlink'),
      row : version == 1 ? 'li' : version == 4 ? '.forum-block' : 'tr'
    },
 
    // move the selected forum to the "starred" category
    star : function(that, id, startup) {
      if (!fa_starred.forums) fa_starred.forums = {};
      if (!fa_starred.board) fa_starred.createStarBoard();
 
      if (!fa_starred.forums[id]) {
        // clone the row and add it to the star board
        var clone = $(that).closest(fa_starred.select.row)[0].cloneNode(true),
            rows = $(that).closest(fa_starred.select.row).parent().find(fa_starred.select.row);
 
        // update the star attributes for the clone
        $('.fa_star', clone).attr({
          'onclick' : 'fa_starred.unstar(this, ' + id + '); return false',
          'class' : 'fa_unstar',
          'title' : fa_starred.lang.unstar
        }).html('<i class="fa">' + fa_starred.icon.unstar + '</i>');
 
        fa_starred.list.appendChild(clone); // append the clone to the starred category
 
        $(that).closest(fa_starred.select.row)[0].style.display = 'none'; // hide the original row
 
        // check if all forums are hidden for this category
        for (var i = 0, j = rows.length, k = 0; i < j; i++) {
          if (/none/.test(rows[i].style.display)) k++;
        }
 
        // hide the category if all forums are hidden
        if (i == k) {
          $(that).closest(fa_starred.select.category)[0].className += ' fa_star_hidden';
        }
 
        // jump to the star board if it's out of sight
        if (!startup && document.getElementById('fa_star_board').getBoundingClientRect().top < 0) {
          window.location.hash = '';
          window.location.hash = '#fa_star_board';
        }
 
        // update storage
        fa_starred.forums[id] = 1;
        localStorage.fa_starred_forums = JSON.stringify(fa_starred.forums);
      }
 
    },
 
    // unstar the selected forum
    unstar : function (that, id) {
      var forum, catg, i = 0, j;
 
      fa_starred.list.removeChild($(that).closest(fa_starred.select.row)[0]); // remove cloned row
 
      // update variables
      forum = $(fa_starred.select.forum + '[href^="/f' + id + '-"]')[0]; // original forum
      catg = $(forum).closest(fa_starred.select.category)[0]; // original category
 
      $(forum).closest(fa_starred.select.row)[0].style.display = ''; // show the original forum's row
 
      // show the category if all forums were hidden
      if (/fa_star_hidden/.test(catg.className)) {
        catg.className = catg.className.replace(/fa_star_hidden/, '');
      }
 
      // delete the starred forum and check if there are anymore stars
      delete fa_starred.forums[id];
      for (j in fa_starred.forums) {
        if (fa_starred.forums[j]) i++;
      }
 
      // update storage
      if (i) {
        localStorage.fa_starred_forums = JSON.stringify(fa_starred.forums);
      } else {
        fa_starred.forums = null;
        localStorage.removeItem('fa_starred_forums');
 
        // remove nodes
        if (version == 2) {
          fa_starred.board.parentNode.removeChild(fa_starred.board.previousSibling); // remove header for punbb
        }
        fa_starred.board.parentNode.removeChild(fa_starred.board);
 
        // delete node references
        delete fa_starred.board;
        delete fa_starred.list;
      }
 
    },
 
    // create the "starred" category
    createStarBoard : function() {
      var catg = $(fa_starred.select.category, fa_starred.select.content)[0],
          board = catg ? catg.cloneNode(true) : null,
          rows = $(fa_starred.select.row, board);
     
      if (!catg) return;
 
      board.id = 'fa_star_board';
      board.style.display = '';
 
      if (version != 2) {
        board.getElementsByTagName('H2')[0].innerHTML = fa_starred.lang.starred; // change category title
      }
 
      // find forum list and remove exisiting rows in the clone
      fa_starred.list = rows[0].parentNode;
      rows.remove();
 
      // punbb insertion method
      if (version == 2) {
        var head = catg.previousSibling.cloneNode(true);
        head.getElementsByTagName('H2')[0].innerHTML = fa_starred.lang.starred;
 
        catg.parentNode.insertBefore(board, catg.previousSibling);
        board.parentNode.insertBefore(head, board);
      } else {
        catg.parentNode.insertBefore(board, catg); // default insertion
      }
 
      fa_starred.board = board;
    }
  };
 
  fa_starred.select.row += ':has(' + fa_starred.select.forum + ')'; // update row selector
 
  // general startup
  var a = $(fa_starred.select.forum, fa_starred.select.content),
      i = 0,
      j = a.length,
      k,
      id;
 
  // setup star board and reset forum states if starred
  if (fa_starred.forums) {
    if (!fa_starred.board) fa_starred.createStarBoard();
    for (k in fa_starred.forums) {
      fa_starred.forums[k] = 0;
    }
  }
 
  // setup stars and starred forums
  for (; i < j; i++) {
    id = a[i].href.replace(/.*?\/f(\d+).*/, '$1');
 
    a[i].insertAdjacentHTML('afterend', '<a href="#" class="fa_star" onclick="fa_starred.star(this, ' + id + '); return false;" title="' + fa_starred.lang.star + '"><i class="fa">' + fa_starred.icon.unstar + '</i></a>');
 
    if (fa_starred.forums) {
      for (k in fa_starred.forums) {
        if (k == id) {
          fa_starred.star(a[i], id, true);
        }
      }
    }
  }
 
  document.getElementsByTagName('HEAD')[0].insertAdjacentHTML('beforeend', '<style type="text/css">a.fa_star,a.fa_unstar{color:#999!important;font-size:16px;vertical-align:-2px;margin-left:3px;opacity:0}a.fa_star:hover,a.fa_unstar,li:hover a.fa_star,tr:hover a.fa_star{opacity:1}a.fa_star i,a.fa_unstar i{position:relative}a.fa_star i:hover:after,a.fa_unstar i:after{content:"' + fa_starred.icon.star + '";position:absolute;left:0;bottom:0}a.fa_unstar i:hover:after{content:""}.fa_star_hidden {display:none!important}</style>');
});
When you're finished, save the script and the plugin will be installed ! Go to your forum and hover over a forum, doing so should display a star. Clicking this star will pin the forum to the very top of the list so you can easily access it. You can unstar forums and remove them from the starred list by clicking the star next to the forum title.

If you want to make modifications to this plugin please see the next section.


Modifications

Below are the modifications that can be made to this plugin.


1. Language
If you want to change the wording or translate the texts, find the lang object in the script and edit the texts to whatever you want.
Code:
    lang : {
        star : 'Star this forum',
      unstar : 'Unstar this forum',
      starred : 'Starred Forums'
    },


2. The Star Icon
If you want to change the star icon to something else, find the icon object in the script.
Code:
    icon : {
        star : '',
      unstar : ''
    },
By default it uses FontAwesome icons. However, you can also use HTML images if you want.


3. The Theme
If you want to change the color of the star icons, find this stylesheet at the bottom of the script and change this color ;
Code:
#999
Code:
document.getElementsByTagName('HEAD')[0].insertAdjacentHTML('beforeend', '<style type="text/css">a.fa_star,a.fa_unstar{color:#999!important;font-size:16px;vertical-align:-2px;margin-left:3px;opacity:0}a.fa_star:hover,a.fa_unstar,li:hover a.fa_star,tr:hover a.fa_star{opacity:1}a.fa_star i,a.fa_unstar i{position:relative}a.fa_star i:hover:after,a.fa_unstar i:after{content:"' + fa_starred.icon.star + '";position:absolute;left:0;bottom:0}a.fa_unstar i:hover:after{content:""}.fa_star_hidden {display:none!important}</style>');
You can also change the font-size and other attributes.



That's all the modifications you can make ! If you have any questions, comments, or find a bug feel free to leave a reply below. Enjoy ! Coffee


Notice
Tutorial written by Ange Tuteur.
Special thanks to the Beta Testers for testing this plugin.
Reproduction not permitted without consent from the author.


Last edited by Ange Tuteur on Mon 30 Jan 2017, 10:27; edited 3 times in total

avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 416
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Fri 20 Jan 2017, 03:13

Hello @Ange Tuteur ,
please, are you the solution ?

Thank you Wink .

a++
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 416
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Mon 23 Jan 2017, 10:40

Hello @Ange Tuteur ,
please, are you the solution ?

Thank you Wink .

a++
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9687
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 23 Jan 2017, 12:02

@Milouze14 sorry, I missed your reply. I made a correction to the script in the first post. Replace the script that's currently on your forum with the one located here. Wink

Thanks reporting the issue Rose
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 416
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Mon 23 Jan 2017, 12:24

Ok thank you very much, I come back to give news.
It's a pleasure to come here my friend.

a++
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9687
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 23 Jan 2017, 12:38

You're welcome. Smile

Have a good day Doff
avatar
MAX

Title :
Gender : Unspecified
Posts : 83
Points : 499
Reputation : 5
Language : English
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

PostMAX on Mon 23 Jan 2017, 12:46

@Ange Tuteur it was not a issue of fmm but you caan send me me code please in pm? I am inn urgent need
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9687
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 23 Jan 2017, 12:52

Mr.Alam wrote:@Ange Tuteur it was not a issue of fmm but you caan send me me code please in pm? I am inn urgent need
I already gave you my reply. Either take your queries to the support forum or sit and do nothing, the choice is yours. If you read the topic I linked, I am no longer assisting with new requests.
avatar
MAX

Title :
Gender : Unspecified
Posts : 83
Points : 499
Reputation : 5
Language : English
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

PostMAX on Mon 23 Jan 2017, 12:59

Oh ange become cruel and strict
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9687
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 23 Jan 2017, 16:02

Mr.Alam wrote:Oh ange become cruel and strict
Sorry, but that's the way it is. I've grown tired of what I've done over the past 3 years and have decided to move on. You can't rely on me to do everything for you forever, so you should either learn to do these things for yourself or find another person to rely on. This is why I've recommended the support forum to you, because the staff and members there are dedicated to helping you with requests within reason.
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 416
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Tue 24 Jan 2017, 10:39

Hello @Ange Tuteur ,

My member still has a worry about categories,
Look here please:

http://forumessai.superforum.fr/c2-le-diamant-mandarin-en-images

The Toolbar is absent Wink .

Thank you my friend.

a++



avatar
Valoish
Graphic Designer
Title :
Gender : Female
Age : 20
Posts : 3627
Points : 4653
Reputation : 350
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Opera Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile http://www.canvasforums.com https://twitter.com/https://twitter.com/Valoishx3

PostValoish on Tue 24 Jan 2017, 11:24

Mr.Alam wrote:Oh ange become cruel and strict
I know this isn't my place to butt in, but I can't stay quiet after reading this. 

Cruel? How is it cruel for Seth to want some time to himself after dedicating THREE YEARS to helping everyone with their Forumotion questions and developing countless awesome plugins for all of us to use FOR FREE? Not to mention he never not once complained about the workload and how stressful it must have been to handle so many requests on a daily basis on his own with almost no help from others (yes, there were members helping out here and there, when they could, but the majority was done by Seth).
He more than deserves this break and he definitely doesn't deserve to be called cruel or whatever else for everything he's done.

/Rant over

--------

"I was afraid. And my own insecurity crushed him." - Youku x Boku SS
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 416
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Tue 24 Jan 2017, 13:44

Mr.Alam wrote:Oh ange become cruel and strict

Yes, I also share this comment, if a person does not deserve this type of message, it is Ange Tuteur, it is a person that I appreciate enormously for his availability and kindness

a++
avatar
Valoish
Graphic Designer
Title :
Gender : Female
Age : 20
Posts : 3627
Points : 4653
Reputation : 350
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Opera Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile http://www.canvasforums.com https://twitter.com/https://twitter.com/Valoishx3

PostValoish on Tue 24 Jan 2017, 14:02

@Milouze14 I can see the toolbar fine o; http://prntscr.com/dztzwe
Have you tried clearing your cache?

--------

"I was afraid. And my own insecurity crushed him." - Youku x Boku SS
avatar
Guest
Guest
View all awards

PostGuest on Wed 25 Jan 2017, 05:30

Let me be clear on this: I hardly ever swear untill I feel it's really necessary to do so, so better be warned.

@Mr.Alam: Is that your heartfelt 'thanks' to Ange for all he did for you? Is that the credit you give him for all his hard work while he's retiring? After all? Better you get lost dude. I've known Ange for too long he'll ban you for all the trouble you caused already, and really I feel he should now. It's not in my personal interest to see you leave, but it should serve the community best as a whole, anywhere @ FM, to see you leave. All you know is how to copy codes, steal stuff others made without even caring and argue with people if you don't get what you want, like a little kid in the candy store. You don't know how to move a button with CSS nor even JS enlightened your life. Anyone with eyes can see the things you try to pull off each day. And please be sure to take all of your fake accounts down with you, Mr. Abolo, The Singer, Royal Bengal, plenty more where those came from. We all know who you are. The reason I left FMD is because of YOU and YOU only because I don't want you to be a copycat and spread your frantic fantasies all over the place using my codes! You even stole from your good old friends. SHAME ON YOU!!!! , even showed the worst you could be by just 'taking' the codes that were just promised to a just few on ESF... .
telling them it's phpBB3 while you just KNEW it's EDGE and you couldn't get no more help on here. Taking something that was not meant to be yours is called: stealing, in the civilized western world, you shapeshifting Paki thief! You're a very bad one. And IF I 'd met you in person I'd smack your face so very very badly you 'd need a new passport, you lame lazy dumbass! You should be banned TODAY on here AND on ESF I tell ya! I know I'm being rude now but I can't keep silent on this one. Staff, ban me at will, but I just couldn't keep shut on this one. I hate him and all of his guts. So go back north, join the herd into those mountains again, wine about the fantasies you once ever had but leave us alone, and seek help for all the jealousy you carry, you sucker!

@staff, you've never seen me real mad b4, but now you know. I've sharpened my nails on this one!

Well that's about all I've got to say on this damn one. Here's to Mr. Alam. Take it as a man:

avatar
SLGray
Valued Member
Title :
Owner of 2 Forums
Gender : Male
Age : 44
Posts : 2389
Points : 4602
Reputation : 282
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
Awards :
View all awards
View user profile http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray on Wed 25 Jan 2017, 14:55


Ange Tuteur gave out the code for the homepage message on ESF.
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 416
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Wed 25 Jan 2017, 23:59

Hello @Valoish ,

With Firefox we do not see this toolbar, I just tested with Edge and it is well present .

a++
avatar
Valoish
Graphic Designer
Title :
Gender : Female
Age : 20
Posts : 3627
Points : 4653
Reputation : 350
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Opera Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile http://www.canvasforums.com https://twitter.com/https://twitter.com/Valoishx3

PostValoish on Thu 26 Jan 2017, 11:50

@Milouze14 That's odd.. Maybe it's a JS issue.. Try disabling your JS codes one by one and see if the issue is resolved.
I don't have Firefox on my work computer, so I can't take a look at the issue until I get home.

--------

"I was afraid. And my own insecurity crushed him." - Youku x Boku SS
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 416
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Thu 26 Jan 2017, 13:26

No, it's not a problem with another JS or my cache, I assure you ,but thank you Wink .
a++
avatar
Guest
Guest
View all awards

PostGuest on Thu 26 Jan 2017, 15:26

Yet another fake account by mr.alam... dr.vahid

http://help.forumotion.com/t150569-leader-or-legend-widget-issue#1038121
.monAva / .myStaff issue

http://avacs.nforum.biz/t544-why-dr-vahid-is-left-avacs << the admins
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9687
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Thu 26 Jan 2017, 21:57

@Milouze14 I think it's related to the page location. "/c2-" is a category, but is also considered the "homepage" ( "Accueil" en Francais ? ) in JS codes management. The script wasn't designed to function there, hence the error. Try using the corrected script below, and let me know if it solves your issue.

Code:
$(function() {
  'DEVELOPED BY ANGE TUTEUR';
  'NO DISTRIBUTION WITHOUT CONSENT OF THE AUTHOR';
  'ORIGIN : http://fmdesign.forumotion.com/t501-starred-forums#6825';
  if (/\/c\d+-/.test(window.location.href)) return; // return if category
 
  // automatically detects the version
  var version = $('.bodylinewidth')[0] ? 0 : document.getElementById('wrap') ? 1 : $('div.pun')[0] ? 2 : document.getElementById('ipbwrapper') ? 3 : document.getElementById('fa_edge') ? 4 : 'badapple';
 
  // error notifications
  if (version == 'badapple' || !window.JSON || !window.localStorage) {
    var errString = 'The plugin "fa_starred" could not be executed because : ';
 
    if (version == 'badapple') errString += '\nYour forum version is not supported.';
    if (!window.JSON) errString += '\nJSON is not supported by your browser';
    if (!window.localStorage) errString += '\nThe Storage API is not support by your browser.';
 
    window.console && console.error ? console.error(errString) : alert(errString);
    return;
  }
 
  // get fontawesome if unavailable
  if (!$('link[href$="font-awesome.min.css"]')[0]) {
    document.getElementsByTagName('HEAD')[0].insertAdjacentHTML('beforeend', '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" />');
  }
 
  window.fa_starred = {
    version : version, // forum version
    forums : localStorage.fa_starred_forums ? JSON.parse(localStorage.fa_starred_forums) : null,
 
    // language settings
    lang : {
        star : 'Star this forum',
      unstar : 'Unstar this forum',
      starred : 'Starred Forums'
    },
 
    icon : {
        star : '',
      unstar : ''
    },
 
    // selectors
    select : {
      content : version ? document.getElementById('main-content') : $('#content-container td:has(> img[height="5"])')[0],
      category : ['.forumline:has(.secondarytitle)', '.forabg', '.main:has(.tcr) .main-content', '.borderwrap:has(.index-box)', '.forum-category'][version],
      forum : 'a.' + (version ? 'forumtitle' : 'forumlink'),
      row : version == 1 ? 'li' : version == 4 ? '.forum-block' : 'tr'
    },
 
    // move the selected forum to the "starred" category
    star : function(that, id, startup) {
      if (!fa_starred.forums) fa_starred.forums = {};
      if (!fa_starred.board) fa_starred.createStarBoard();
 
      if (!fa_starred.forums[id]) {
        // clone the row and add it to the star board
        var clone = $(that).closest(fa_starred.select.row)[0].cloneNode(true),
            rows = $(that).closest(fa_starred.select.row).parent().find(fa_starred.select.row);
 
        // update the star attributes for the clone
        $('.fa_star', clone).attr({
          'onclick' : 'fa_starred.unstar(this, ' + id + '); return false',
          'class' : 'fa_unstar',
          'title' : fa_starred.lang.unstar
        }).html('<i class="fa">' + fa_starred.icon.unstar + '</i>');
 
        fa_starred.list.appendChild(clone); // append the clone to the starred category
 
        $(that).closest(fa_starred.select.row)[0].style.display = 'none'; // hide the original row
 
        // check if all forums are hidden for this category
        for (var i = 0, j = rows.length, k = 0; i < j; i++) {
          if (/none/.test(rows[i].style.display)) k++;
        }
 
        // hide the category if all forums are hidden
        if (i == k) {
          $(that).closest(fa_starred.select.category)[0].className += ' fa_star_hidden';
        }
 
        // jump to the star board if it's out of sight
        if (!startup && document.getElementById('fa_star_board').getBoundingClientRect().top < 0) {
          window.location.hash = '';
          window.location.hash = '#fa_star_board';
        }
 
        // update storage
        fa_starred.forums[id] = 1;
        localStorage.fa_starred_forums = JSON.stringify(fa_starred.forums);
      }
 
    },
 
    // unstar the selected forum
    unstar : function (that, id) {
      var forum, catg, i = 0, j;
 
      fa_starred.list.removeChild($(that).closest(fa_starred.select.row)[0]); // remove cloned row
 
      // update variables
      forum = $(fa_starred.select.forum + '[href^="/f' + id + '-"]')[0]; // original forum
      catg = $(forum).closest(fa_starred.select.category)[0]; // original category
 
      $(forum).closest(fa_starred.select.row)[0].style.display = ''; // show the original forum's row
 
      // show the category if all forums were hidden
      if (/fa_star_hidden/.test(catg.className)) {
        catg.className = catg.className.replace(/fa_star_hidden/, '');
      }
 
      // delete the starred forum and check if there are anymore stars
      delete fa_starred.forums[id];
      for (j in fa_starred.forums) {
        if (fa_starred.forums[j]) i++;
      }
 
      // update storage
      if (i) {
        localStorage.fa_starred_forums = JSON.stringify(fa_starred.forums);
      } else {
        fa_starred.forums = null;
        localStorage.removeItem('fa_starred_forums');
 
        // remove nodes
        if (version == 2) {
          fa_starred.board.parentNode.removeChild(fa_starred.board.previousSibling); // remove header for punbb
        }
        fa_starred.board.parentNode.removeChild(fa_starred.board);
 
        // delete node references
        delete fa_starred.board;
        delete fa_starred.list;
      }
 
    },
 
    // create the "starred" category
    createStarBoard : function() {
      var catg = $(fa_starred.select.category, fa_starred.select.content)[0],
          board = catg ? catg.cloneNode(true) : null,
          rows = $(fa_starred.select.row, board);
   
      if (!catg) return;
 
      board.id = 'fa_star_board';
      board.style.display = '';
 
      if (version != 2) {
        board.getElementsByTagName('H2')[0].innerHTML = fa_starred.lang.starred; // change category title
      }
 
      // find forum list and remove exisiting rows in the clone
      fa_starred.list = rows[0].parentNode;
      rows.remove();
 
      // punbb insertion method
      if (version == 2) {
        var head = catg.previousSibling.cloneNode(true);
        head.getElementsByTagName('H2')[0].innerHTML = fa_starred.lang.starred;
 
        catg.parentNode.insertBefore(board, catg.previousSibling);
        board.parentNode.insertBefore(head, board);
      } else {
        catg.parentNode.insertBefore(board, catg); // default insertion
      }
 
      fa_starred.board = board;
    }
  };
 
  fa_starred.select.row += ':has(' + fa_starred.select.forum + ')'; // update row selector
 
  // general startup
  var a = $(fa_starred.select.forum, fa_starred.select.content),
      i = 0,
      j = a.length,
      k,
      id;
 
  // setup star board and reset forum states if starred
  if (fa_starred.forums) {
    if (!fa_starred.board) fa_starred.createStarBoard();
    for (k in fa_starred.forums) {
      fa_starred.forums[k] = 0;
    }
  }
 
  // setup stars and starred forums
  for (; i < j; i++) {
    id = a[i].href.replace(/.*?\/f(\d+).*/, '$1');
 
    a[i].insertAdjacentHTML('afterend', '<a href="#" class="fa_star" onclick="fa_starred.star(this, ' + id + '); return false;" title="' + fa_starred.lang.star + '"><i class="fa">' + fa_starred.icon.unstar + '</i></a>');
 
    if (fa_starred.forums) {
      for (k in fa_starred.forums) {
        if (k == id) {
          fa_starred.star(a[i], id, true);
        }
      }
    }
  }
 
  document.getElementsByTagName('HEAD')[0].insertAdjacentHTML('beforeend', '<style type="text/css">a.fa_star,a.fa_unstar{color:#999!important;font-size:16px;vertical-align:-2px;margin-left:3px;opacity:0}a.fa_star:hover,a.fa_unstar,li:hover a.fa_star,tr:hover a.fa_star{opacity:1}a.fa_star i,a.fa_unstar i{position:relative}a.fa_star i:hover:after,a.fa_unstar i:after{content:"' + fa_starred.icon.star + '";position:absolute;left:0;bottom:0}a.fa_unstar i:hover:after{content:""}.fa_star_hidden {display:none!important}</style>');
});

added :
Code:
if (/\/c\d+-/.test(window.location.href)) return; // return if category
avatar
Milouze14

Title :
Gender : Male
Age : 51
Posts : 76
Points : 416
Reputation : 22
Location : French Vendée
Language : French
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.milouze14.com/

PostMilouze14 on Fri 27 Jan 2017, 09:12

Hello @Ange Tuteur ,

thank you very much for the new code, it's ok for me cheers .

Good day my friend .

a++
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9687
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 30 Jan 2017, 10:26

Excellent ! I'll update the script in the first post then. Wink

Thanks for confirming. Rose
avatar
tillytiger99
Member
Title :
Gender : Unspecified
Posts : 13
Points : 151
Reputation : 2
Language : English
Browser : Browser : Microsoft Edge Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://cherryblossomsims.forumieren.com/forum

Posttillytiger99 on Sun 21 May 2017, 04:35

Thank you for this. I love this on my forum!
avatar
Gae
New Member
Title :
Gender : Unspecified
Posts : 9
Points : 153
Reputation : 2
Language : French English
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostGae on Thu 25 May 2017, 16:23

Hi @Ange Tuteur

Thanks you this real tricks. It's very useful when you have many forums. 
But on my side, only two forums are working with this tricks not the rest. I can't find who is the problem... 
Normally i will minify your script and add it in one JS for "homepage" only (index in French) 

I've tested with all others JS homepages
I've tested in a alone JS in homepage too nothing change

This is the link of my test forum : http://testforumdev.forumactif.fr/ 
Thanks in advance for you answer!
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9687
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sat 27 May 2017, 12:27

Hi @Gae,

I think the problem comes from modified templates. When looking at your forum, the main-content container ends early when it should be wrapping your entire forum's content. I think you added an extra closing </div> tag somewhere which ended up closing this container early.


It could possibly be in your forum description, maybe. I just think the spot where it ends is weird. scratch Still, the likely area for the problem could be a forum description or one of these templates : index_body, index_box.

Page 2 of 3 Previous  1, 2, 3  Next

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

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