av01d / fontpicker-jquery-plugin

A component to quickly choose fonts from Google Web Fonts, custom fonts you (the web developer) provide, as well as system fonts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Fonts cannot be applied on second page load.

androidacy-user opened this issue · comments

The plugin works great on first page load.

However on second I get the error fontType is not defined.

I'm not sure if this is some weird issue with caching or what.

I can't reproduce on the demo page: https://av01d.github.io/fontpicker-jquery-plugin/index.html
Can you make a fiddle or other demo that shows the bug?
Also: what browser did you use?

I can only reproduce with the minified version from this repository. Minifying the normal version via YUI works fine.

I'm not sure if GitHub is mangling it on download or what (I used wget to download directly from GitHub on my server) but the end result seems to be 200+ lines, lol.

Assuming it was some weird screwup somewhere and closing.

Believe I had exactly this issue too. Added var before fontType, also fontFamily and font in the minified version inside function getFavorites - which explain it works FIRST time when there are no favorites but gives error when there are. This code at line 5981 in the non minified version:

tmp = fonts[f].split(':'), fontType = tmp[0], fontFamily = tmp[1], font = this.allFonts[fontType][fontFamily];

(sorry to comment on a closed issue, but I believe this is still an "open issue" as I just downloaded the most recent version, installed the minified code and got the error after the initial selection of a font - when there is a favorite cookie to process in getFavorites)

Thanks for betting back to me! Yes, there was indeed an issue with some undeclared variables, which caused havoc in the minified version (due to use strict).
All has now been fixed, properly. Thanks!