Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chengyin/WhatFont-Bookmarklet
The core of WhatFont Tool
https://github.com/chengyin/WhatFont-Bookmarklet
Last synced: 15 days ago
JSON representation
The core of WhatFont Tool
- Host: GitHub
- URL: https://github.com/chengyin/WhatFont-Bookmarklet
- Owner: chengyin
- License: ncsa
- Created: 2011-02-05T21:14:49.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2017-05-27T21:17:13.000Z (over 7 years ago)
- Last Synced: 2024-08-01T05:23:25.419Z (3 months ago)
- Language: JavaScript
- Homepage: http://chengyinliu.com/whatfont.html
- Size: 69.3 KB
- Stars: 485
- Watchers: 19
- Forks: 75
- Open Issues: 18
-
Metadata Files:
- Readme: README.mkd
- License: LICENSE
Awesome Lists containing this project
README
WhatFont
========WhatFont is a JavaScript script to detect what font in the stack is being used on any elements of a web page.
Here in the repo is the core component with out wrappers, the wrapped Chrome/Safari extensions are available at [`http://chengyinliu.com/whatfont.html`](http://chengyinliu.com/whatfont.html).
How to Use
----------`whatfont_core.js` is the core script. It adds `_whatFont()` into the global scope. WhatFont then runs in a closure created by the `_whatFont()` function.
An controller object is returned by `whatFont()` function. The controller will be used to set up the dependencies (jQuery and stylesheet) and initialize WhatFont.
This controller has the following functions:
* `setJQuery(jQ)`
WhatFont requires jQuery (v1.5.2), if jQuery has already been loaded into the global scope, the script finds it automatically. Otherwise `setJQuery(jQ)` needs to be called to set up jQuery object.
* `setCSSURL(url)`
WhatFont injects its stylesheet file into the webpage. The script comes with a default URL setting, if you want to change the setting, calling this function.
* `getVer()`
Return the version of WhatFont.
* `init()`
Initialize WhatFont and inject to the current `document`.
* `restore()`
Remove WhatFont from current `document`.
Example
-------
wf = _whatFont();
wf.setjQuery(jQuery); // Setup jQuery
wf.init(); // Load WhatFont
wf.restore(); // Remove WhatFont