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.

Adding font to forum, scrip code problem.

Go down

Adding font to forum, scrip code problem.

Post by Yuushishio on 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
http://help.forumotion.com/t133635-display-the-avatar-of-a-member-on-the-toolbar
http://help.forumotion.com/t144004-add-twitter-emoji-to-the-editor
http://help.forumotion.com/t140086-how-to-install-and-use-font-awesome
http://help.forumotion.com/t131191-add-a-word-counter-to-the-editor
http://help.forumotion.com/t143414-add-the-chatbox-to-your-toolbar

Can someone help me find out the conflict...

Yuushishio
Forumember

Posts : 117
Reputation : 4
Language : English

http://sharetheworld.forumvi.com

Back to top Go down

Re: Adding font to forum, scrip code problem.

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

Hello,
I found an error on your forum:



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))
avatar
Van-Helsing
Hyperactive

Male Posts : 2407
Reputation : 111
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Back to top


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