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.
The forum of the forums
2 posters

    Adding font to forum, scrip code problem.

    avatar
    Yuushishio
    Forumember


    Posts : 117
    Reputation : 4
    Language : English

    Adding font to forum, scrip code problem. Empty Adding font to forum, scrip code problem.

    Post by Yuushishio March 10th 2016, 2:24 am

    My forum: http://www.1000sunny.net/
    ver: phpbb3

    I add some font from google font to my forum following this tip
    The JS using in my page is

    Code:
    WebFontConfig = {
        google: { families: [ 'Lobster::latin,vietnamese' ],  [ 'Alegreya+Sans::latin,vietnamese' ]
                [ 'Alegreya+Sans+SC::latin,vietnamese' ], [ 'Tinos::latin,vietnamese' ], [ 'Andika::latin,vietnamese' ], [ 'Arimo::latin,vietnamese' ], [ 'Chonburi::latin,vietnamese' ],  [ 'Cousine::latin,vietnamese' ],  [ 'EB+Garamond::latin,vietnamese' ],  [ 'Itim::latin,vietnamese' ],  [ 'Kanit::latin,vietnamese' ],  [ 'Notica+Text::latin,vietnamese' ],  [ 'Noto+Serif::latin,vietnamese' ],  [ 'Open+Sans::latin,vietnamese' ],  [ 'Open+Sans+Condensed::latin,vietnamese' ],  [ 'Patrick+Hand::latin,vietnamese' ]      }
      };

      (function() {
        var wf = document.createElement('script');
        wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
        wf.type = 'text/javascript';
        wf.async = 'true';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(wf, s);
      })(); 

    It did succeed adding font to forum, but it caused another big problem, it disable many other Javascript code such as these
    https://help.forumotion.com/t133635-display-the-avatar-of-a-member-on-the-toolbar
    https://help.forumotion.com/t144004-add-twitter-emoji-to-the-editor
    https://help.forumotion.com/t140086-how-to-install-and-use-font-awesome
    https://help.forumotion.com/t131191-add-a-word-counter-to-the-editor
    https://help.forumotion.com/t143414-add-the-chatbox-to-your-toolbar

    Can someone help me find out the conflict...
    Van-Helsing
    Van-Helsing
    Hyperactive


    Male Posts : 2431
    Reputation : 116
    Language : English, Greek

    Adding font to forum, scrip code problem. Empty Re: Adding font to forum, scrip code problem.

    Post by Van-Helsing March 14th 2016, 3:08 am

    Hello,
    I found an error on your forum:

    Adding font to forum, scrip code problem. SMrAQgk

    it is in a javascript which located in a template (probably viewtopic_body). The javascript which have the problem is the following:

    Code:

    <script type="text/javascript">

    /***********************************************
    * Floating Top Bar script- 漏 Dynamic Drive (www.dynamicdrive.com)
    * Sliding routine by Roy Whittle (http://www.javascript-fx.com/)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
    var startX = 30 //set x offset of bar in pixels
    var startY = 5 //set y offset of bar in pixels
    var verticalpos="fromtop" //enter "fromtop" or "frombottom"

    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = "";
    if (document路cookie.length > 0) {
    offset = document路cookie.indexOf(search)
    if (offset != -1) {
    offset += search.length
    end = document路cookie.indexOf(";", offset);
    if (end == -1) end = document路cookie.length;
    returnvalue=unescape(document路cookie.substring(offset, end))
    }
    }
    return returnvalue;
    }

    function closebar(){
    if (persistclose)
    document路cookie="remainclosed=1"
    document.getElementById("topbar").style.visibility="hidden"
    }

    function staticbar(){
      barheight=document.getElementById("topbar").offsetHeight
      var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
      var d = document;
      function ml(id){
          var el=d.getElementById(id);
          if (!persistclose || persistclose && get_cookie("remainclosed")=="")
          el.style.visibility="visible"
          if(d.layers)el.style=el;
          el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
          el.x = startX;
          if (verticalpos=="fromtop")
          el.y = startY;
          else{
          el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
          el.y -= startY;
          }
          return el;
      }
      window.stayTopLeft=function(){
          if (verticalpos=="fromtop"){
          var pY = ns ? pageYOffset : iecompattest().scrollTop;
          ftlObj.y += (pY + startY - ftlObj.y)/8;
          }
          else{
          var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
          ftlObj.y += (pY - startY - ftlObj.y)/8;
          }
          ftlObj.sP(ftlObj.x, ftlObj.y);
          setTimeout("stayTopLeft()", 10);
      }
      ftlObj = ml("topbar");
      stayTopLeft();
    }

    if (window.addEventListener)
    window.addEventListener("load", staticbar, false)
    else if (window.attachEvent)
    window.attachEvent("onload", staticbar)
    else if (document.getElementById)
    window.onload=staticbar
    </script>

    at line 236 there is an invalid character (路) which may conflicts the other javascripts.

    Code:

    returnvalue=unescape(document路cookie.substring(offset, end))

      Current date/time is September 22nd 2024, 3:30 pm