FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 31 users online :: 0 Registered, 0 Hidden and 31 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

Problems through toolbar.replace

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Sat 16 Jul 2016, 08:21

Hello @Ange Tuteur,

every script which has the content
Code:
toolbar.replace
like for example your script "EmotiUser"
Code:
toolbar = toolbar.replace(/date/, 'emotiuser,date');
results in this error in console:
TypeError: toolbar.replace is not a function
https://i.servimg.com/u/f35/16/43/86/96/fdghjg10.png
(Only an example)


This is part of a problem I mentioned here:
https://fmdesign.forumotion.com/t596p25-widgets-below-instead-of-left-right

The problem appears not everytime - sometimes yes, sometimes no. But if the problem appears, the toolbar disappears and the widgets below the forum appear somewhere else like I said in the thread above.

Why? And what is the reason for the error message for scripts with the content
Code:
toolbar.replace
?

I deleted scripts with this content. I hope I got all.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Sat 16 Jul 2016, 19:05

Hm.. you may need to check if toolbar is defined, by default it is, if the sceditor is defined. So all you would need to add in the script is :
Code:
if (!toolbar) return;
Just add it before statements where toolbar is redefined and it should fix the problem.
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Sun 17 Jul 2016, 06:30

@Ange Tuteur I added it to the script like that:
Code:
if (!toolbar) return; toolbar = toolbar.replace(/date/, 'emotiuser,date');
But the problem still occurs.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 18 Jul 2016, 06:53

That's weird.. it shouldn't occur in that case because you're strictly telling JavaScript to return if "toolbar" is undefined. Could you post the scripts in question ?
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Mon 18 Jul 2016, 09:40

What do you mean by "in question"?
The scripts which causes the problem are e.g. EmojiUser and your script for Twitter without any edits.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 18 Jul 2016, 16:09

"Could you post the scripts in question ?" Means I am asking you to post the scripts that are being discussed. This will probably explain better, maybe. Razz

Post both the ones you mentioned here and I'll have a look at 'em. Wink
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Mon 18 Jul 2016, 16:19

The following for example, but as I said I didn't make any modifications except from the language. Also the result is the same by using your fix or not.
Code:
if (!toolbar) return;

Code:
(function() {
  'EmotiUser - Become your own personal emoticon !';
  'DEVELOPED BY ANGE TUTEUR';
  'NO DISTRIBUTION WITHOUT CONSENT OF THE AUTHOR';
  'ORIGIN : http://fmdesign.forumotion.com/';
 
  window.EmotiUser = {
    default_icon : 'http://2img.net/i/fa/invision/pp-blank-thumb-38px.png', // default avatar
    cacheTime : 1*60*60*1000, // amount of time the avatar is cached ( 1 hour )
 
    // tagType influences the type of tags used
    // 0 = BBCode
    // 1 = HTML
    tagType : 0,
 
    // markup format
    tag : [
      '[table class="emotiuser"][tr][td]:u{UID}:[/td][/tr][/table]',
      '<span class="emotiuser">:u{UID}:</span>'
    ],
 
    parse : function() {
      if (!EmotiUser.tags) {
        EmotiUser.tags = $('.emotiuser');
        EmotiUser.index = -1;
      }
 
      var tag = EmotiUser.tags[++EmotiUser.index];
      if (tag) {
        var txt = $(tag).text(),
            tag_id = txt.replace(/:u(\d+):/, '$1'),
            storage = window.localStorage;
         
        if (storage && storage['emotiuser_' + tag_id] && storage['emotiuser_' + tag_id + '_exp'] > +new Date - EmotiUser.cacheTime) {
          var icon = document.createElement('IMG'),
              data = JSON.parse(storage['emotiuser_' + tag_id]);
           
          icon.className = 'emotiuser_icon';
          icon.src = data.src;
          icon.alt = data.alt;
          icon.title = data.title;
       
          tag.parentNode.insertBefore(icon, tag);
          tag.parentNode.removeChild(tag);
          EmotiUser.parse();
        } else {
          $.get('/ajax/index.php?f=m&user_id=' + tag_id, function(d) {
            var icon = $('.tooltip-content > img', d)[0],
                name = $('.tooltip-title', d).text() || d;
       
            if (!icon) {
              icon = document.createElement('IMG');
              icon.src = EmotiUser.default_icon;
            }
         
            icon.className = 'emotiuser_icon';
            icon.title = name;
            icon.alt = txt;
       
            if (storage && window.JSON) {
              storage['emotiuser_' + tag_id] = JSON.stringify({
                src : icon.src,
                alt : icon.alt,
                title : icon.title
              });
              storage['emotiuser_' + tag_id + '_exp'] = +new Date;
            }
         
            tag.parentNode.insertBefore(icon, tag);
            tag.parentNode.removeChild(tag);
            EmotiUser.parse();
          });
        }
      } else {
        delete EmotiUser.tags;
        delete EmotiUser.index;
      }
    }
  };
 
  document.write('<style type="text/css">.emotiuser, .emotiuser * { display:inline-block; } .emotiuser_icon { height:30px; vertical-align:middle; margin:3px; } .sceditor-button-emotiuser div { background:none !important; }</style>');
 
  $(function(){
    EmotiUser.parse();
 
    if ($.sceditor && toolbar) {
      $.sceditor.command.set('emotiuser', {
        dropDown : function(editor, caller, callback) {
          var content = document.createElement('DIV'),
              input = document.createElement('INPUT'),
              submit = document.createElement('INPUT');
 
          input.type = 'text';
          input.value = _userdata.user_id;
          input.id = 'emotiuser_number';
 
          submit.type = 'button';
          submit.className = 'button';
          submit.value = 'Einfügen';
          submit.onclick = function() {
            var id = +$('#emotiuser_number', this.parentNode)[0].value;
            if (typeof id === 'number' && id > 0) {
              callback(id);
              editor.closeDropDown(true);
            } else {
              alert('Bitte füge eine User ID ein.');
            }
          };
 
          content.innerHTML = '<div><label for="emotiuser_number">User Id</label></div>';
          content.firstChild.appendChild(input);
          content.appendChild(submit);
 
          editor.createDropDown(caller, 'emotiuser', content);
        },
 
        exec : function(c) {
          var e = this;
          $.sceditor.command.get('emotiuser').dropDown(e, c, function(content) {
            e.insertText(EmotiUser.tag[EmotiUser.tagType].replace(/\{UID\}/, content));
          });
        },
 
        txtExec : function(c) {
          var e = this;
          $.sceditor.command.get('emotiuser').dropDown(e, c, function(content) {
            e.insertText(EmotiUser.tag[EmotiUser.tagType].replace(/\{UID\}/, content));
          });
        },
     
        tooltip : 'EmotiUser'
      });
   
      toolbar = toolbar.replace(/date/, 'emotiuser,date');
   
      $(function() {
        var button = $('.sceditor-button-emotiuser div')[0];
        if (button) {
          $(button).append(_userdata.avatar.replace(/<img/, '<img style="height:16px;width:16px;"'));
          button.style.textIndent = '0px';
        }
      });
    }
  });
}());
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Tue 19 Jul 2016, 15:38

Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 19 Jul 2016, 20:57

Hmm.. I looked over it and I can't see how it would cause an error with the toolbar, because it's already checking to make sure both the editor and toolbar are defined. Is the error on your forum right now ? If so, could you provide me a link the where it's occurring, it'd be 1000 times easier to debug.
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Wed 20 Jul 2016, 14:12

You can try by yourself. I sent you a PM with the details for account with admin rights.
So, install the plugins I named like you want to and look, whether you can find the bugs. Actually I deleted all this scripts to prevent the bugs.

For me and my co admin the error occurs not every time. Sometimes you have to reload the page multiple times to see the bug in the console and in the forum (toolbar disappears and the widgets below the forum appear somewhere else).
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Wed 20 Jul 2016, 15:46

Alright, thanks. I'll try to look over this sometime tomorrow since I'm currently busy working on translation functionality for FAE today.
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Wed 20 Jul 2016, 15:48

Ok, no problem. Thanks for your support. Smile
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Thu 21 Jul 2016, 14:24

Bump to remind you. Problems through toolbar.replace 1f601
@Ange Tuteur
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 22 Jul 2016, 11:08

@schiggysboard I'm sorry, but for some reason the account credentials you gave me don't seem to work -- I can't log in.. Think

Am I logging into the wrong forum ? Shocked
--> http://www.schiggysboard.com/login


EDIT :
Disregard that, I entered them in the wrong order. Face palm
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 22 Jul 2016, 11:19

I installed the emotiuser script, but thus far I haven't encountered anything, yet. I do however notice that there's a constant error on your forum which appears to be caused by something you install in the overall_header. Go to Admin Panel > Template > General > overall_header

Find and remove this code :
Code:
<script src="http://www.schiggysboard.com/h21-statusupdater"></script><div id="LGstatus"></div><script>status_box.init('profile_field_13_11')</script>
It might not be all minified like that, so just try searching for "LGstatus".

Let's try clearing this error up first before fully testing, because it may be affecting a few things on your forum. Think
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Fri 22 Jul 2016, 11:59

Thank you, @Ange Tuteur. I will delete this script this day or maybe tomorrow as soon as I'm in front of the computer.

Even if I don't understand how this error related to my actual problem from start post. scratch

Too bad, it's a nice feature developed by LG from avacweb.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 22 Jul 2016, 12:44

There's a chance it could be conflicting with your other scripts, plus in the current condition it doesn't even work or display from what I'm seeing. Think

It's causing these two erreurs :
Problems through toolbar.replace Captur20
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Fri 22 Jul 2016, 13:46

@Ange Tuteur I removed this script in overall_header. After reloading the page multiple times, the error from start post occurs again.

Please have a look at my forum. The script is still removed from template. "EmotiUser" is placed in javascript management, but deactivated again. The account I gave you is still in action.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 22 Jul 2016, 15:14

Does the error occur in a certain page ? If so could you provide me with the links ? It's just really weird that I can't seem to get the error to happen for the life of me, I feel like I might not be looking in the right place.. Think
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Fri 22 Jul 2016, 15:30

@Ange Tuteur I get the error in every page, but most times I test it in forum's index page. I reload the page, sometimes up to ten times and suddenly the toolbar (the one with "Welchome XY" and so on) disappears, the widgets below the forum move to another place and rhe error message in console appears.

Is it possible that chrome's and firefox's console show different errors/ messages? I can't believe, but maybe an idea.
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Mon 25 Jul 2016, 11:17

bump :/ @Ange Tuteur
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 25 Jul 2016, 12:35

Hey,

I'm sorry, but I still cannot see the problem you've mentioned. I reloaded the index about 50 times on Firefox and each time the page loaded like it usually does. I seriously do not know why I cannot see the error. Think
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Mon 25 Jul 2016, 13:02

Hmm .. is there maybe a possibility that the scripts like EmojiUser don't have the content/ line
Code:
toolbar.replace
?
Or do they strictly need this part to work? @Ange Tuteur
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 25 Jul 2016, 13:08

instead of replace you can do it like this :
Code:
toolbar = toolbar + ',button_name';

or like this :
Code:
toolbar += ',button_name';

This method however will place the button at the end of the toolbar.
schiggysboard
schiggysboard

Gender : Male
Posts : 79
Points : 3936
Reputation : 20
Language : German, English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.schiggysboard.com/

Postschiggysboard Thu 28 Jul 2016, 13:34

Hey @Ange Tuteur, how do I have to replace it? I tried it, but the result was either a blank editor toolbar or a normal editor toolbar without the EmotiUser button.
I tried it like the following with both options you posted one post above:
Code:
toolbar = toolbar + ',button_name';(/date/, 'emotiuser,date');
(with and without the semicolon before the bracket)

Also I tried it without this part:
Code:
(/date/, 'emotiuser,date');
Sponsored content

PostSponsored content

Page 1 of 2 1, 2  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