webfont-select-rails 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +19 -0
- data/README.md +48 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/webfont-select-rails.rb +4 -0
- data/vendor/assets/javascript/webfont.select.js +2 -0
- data/vendor/assets/javascript/webfont.select.js.map +1 -0
- data/vendor/assets/javascript/webfontloader.js +18 -0
- data/vendor/assets/stylesheets/webfont.select.css +41 -0
- data/webfont-select-rails.gemspec +31 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 61eb5078be17da0f486411f897d9caf35eda3fbb
|
4
|
+
data.tar.gz: 6fa280faa38359c71115e64f1dfd861ae7250043
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2469b6b728e9bba77a31d3673386230ea6b1c80b9c63ed1b6a43e3a44546e7c2fe94384e7d7ba1dc56991a313b298fb19a09d971659b26283fea83579aa347b8
|
7
|
+
data.tar.gz: 8a5d7d9657bf05c353228cdf1583b028dd5bb35425871b60096fd940260c10b235d1723ad8f64fa4fbc8c2b7fa6fb29034770b4665cb22f4e0d41079019e6f9a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright © 2016 [Nicholas Ollis](http://ollis.me), http://ollis.me
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# WebfontSelect::Rails
|
2
|
+
|
3
|
+
This is a rails gem for the [Webfont-Select jQuery UI Widget](https://github.com/nicollis/webfont-select).
|
4
|
+
Please see its project page for details and use.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'webfont-select-rails'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install webfont-select-rails
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
1. make sure you have both jQuery and jQuery UI running in your app.
|
25
|
+
|
26
|
+
2. add the following to your application.js file
|
27
|
+
- require webfontloader.js
|
28
|
+
- require webfont.select.js
|
29
|
+
|
30
|
+
3. add the following to your application.css file
|
31
|
+
- require webfont.select.css
|
32
|
+
|
33
|
+
4. see [Webfont-Select jQuery UI Widget](https://github.com/nicollis/webfont-select) for usage and calls
|
34
|
+
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nicollis/webfont-select-rails.
|
39
|
+
|
40
|
+
## Changelog
|
41
|
+
|
42
|
+
* 2016-10-24 -- v0.1.4 -- Initial public release with tested Google support
|
43
|
+
|
44
|
+
## Author
|
45
|
+
|
46
|
+
Copyright (c) 2016 [Nicholas Ollis](http://ollis.me).
|
47
|
+
Released under the MIT License.
|
48
|
+
See LICENSE.txt for license info.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "webfont/select/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
!function($){var t;return t={},$.widget("webfont.wfselect",{options:{fonts:{google:{families:["Droid Sans","Signika"]}},merge_list:!1},_create:function(){var t,n,e,i;e=this,n=this.options,t=this.element,i=n.fonts||this.options.fonts,t.addClass("webfont-input").attr("readonly","readonly").wrap($("<div/>").addClass("webfont-wrapper")),this.wrapper=t.closest(".webfont-wrappers"),t.after(e._createFontList(i,this.options.merge_list).hide()),e._selectFontByName(t.val()),e.toggle=$("<div/>").addClass("ui-icon ui-icon-triangle-1-s").insertAfter(t),e._bindHandlers()},_createFontList:function(t,n){var e,i;return null==n&&(n=!1),this.fontList=$("<ul/>").addClass("webfont-list"),i=this,e=this._createFontObjects(t,n),$.each(e,function(t,n){$("<li/>").html(n.font).data("font_name",n.font).data("font_type",n.type).css(i._fontToStyle(n.font)).appendTo(i.fontList)}),this.fontList},_createFontObjects:function(t,n){var e;return null==n&&(n=!1),e=[],$.each(t,function(t,n){var i;i=n.families.map(function(n){return{font:n,type:t}}),e=e.concat(i)}),n&&(e=e.sort(function(t,n){return t.font>n.font})),e},_fontToStyle:function(t){var n;return n=t.split(":"),{"font-family":this._readableFontName(n[0]),"font-weight":n[1]||400}},_readableFontName:function(t){return t.replace(/[\+|:]/g," ")},_selectFontByName:function(t){var n,e;return n=this.fontList.find("li"),e=$.grep(n,function(n,e){return $(n).data("font_name")===t}),!!e.length&&(this._selectFontListItem($(e).first()),!0)},_selectFontListItem:function(t){var n,e,i;return t.hasClass("selected")?null:(this.fontList.find("li.selected").removeClass("selected"),t=$(t).addClass("selected"),n=t.data("font_name"),e=t.data("font_type"),i=this._fontToStyle(n),this.element.css(i),this.element.val()!==n&&this.element.val(n).trigger("change"),this._trigger("change",null,i),this._loadFonts([{font:n,type:e}]),void this._toggleFontList(!1))},_loadFonts:function(n){var e,i;return e=$.grep(n,function(e){return t[n.font]},!0),e.length?(i={},$.each(e,function(n,e){t[e.font]=!0,Object.keys(i).indexOf(e.type)===-1&&(i[e.type]={}),Object.keys(i[e.type]).indexOf("families")===-1&&(i[e.type].families=[]),i[e.type].families.push(e.font)}),void WebFont.load(i)):null},_loadVisibleFonts:function(){var t,n,e,i,o,s;return this.fontList.is(":visible")?(s=this,o=this.fontList.scrollTop(),i=this.fontList.height(),e=o+i,t=this.fontList.find("li"),n=[],$.each(t,function(t,e){var o,s;e=$(e),s=e.position().top,o=s+e.outerHeight(),o>=0&&s<i&&n.push({font:e.data("font_name"),type:e.data("font_type")})}),void this._loadFonts(n)):null},_toggleFontList:function(t){var n;t?(this.wrapper.css({"z-index":999999}),this.fontList.show(),this._loadVisibleFonts(),n=this.fontList.find("li.selected"),n.length&&this.fontList.scrollTop(n.position().top)):(this.wrapper.css({"z-index":"auto"}),this.fontList.hide())},_bindHandlers:function(){var t,n,e;e=this,t=null,$("html").bind("click.webfont",function(t){e._toggleFontList(!1)}),n=function(t){e._toggleFontList(!0),t.stopPropagation()},this.element.bind("click.webfont",n),this.toggle.bind("click.webfont",n),this.fontList.bind("scroll.webfont",function(n){window.clearTimeout(t),t=window.setTimeout(function(){e._loadVisibleFonts()},250)}).bind("click.webfont",function(t){var n;return n=$(t.target),n.is("li")?void e._selectFontListItem(n):null})},destory:function(){this.fontList.remove(),this.toggle.remove(),this.element.removeClass("webfont-input").removeAttr("readonly").unbind("click.webfont").unwrap(),$("html").unbind("click.webfont"),$.Widget.prototype.destory.call(this)}})}(jQuery);
|
2
|
+
//# sourceMappingURL=./webfont.select.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["src/coffeescript/webfont.select.coffee"],"names":["$","loadedFonts","widget","options","fonts","google","families","merge_list","_create","element","self","useFonts","this","addClass","attr","wrap","wrapper","closest","after","_createFontList","hide","_selectFontByName","val","toggle","insertAfter","_bindHandlers","fonts_options","merge","fontList","_createFontObjects","each","index","font","html","data","type","css","_fontToStyle","appendTo","fonts_list","key","families_object","t","map","concat","sort","a","b","fontName","font_and_weight","split","font-family","_readableFontName","font-weight","font_name","replace","name","match","find","grep","li","i","length","_selectFontListItem","first","font_type","styles","hasClass","removeClass","trigger","_trigger","_loadFonts","_toggleFontList","font_array","source","Object","keys","indexOf","push","WebFont","load","_loadVisibleFonts","fontsToLoad","list_bottom","list_height","list_top","is","scrollTop","height","font_bottom","font_top","position","top","outerHeight","bool","selectedFont","z-index","show","loadTimeout","open_font_list","bind","event","stopPropagation","window","clearTimeout","setTimeout","target","destory","remove","removeAttr","unbind","unwrap","Widget","prototype","call","jQuery"],"mappings":"CAAA,SAAEA,GACA,GAAAC,SAAAA,MACAD,EAAEE,OAAO,oBACPC,SAEEC,OACEC,QACEC,UAAW,aAAc,aAO7BC,YAAY,GAGdC,QAAS,WACP,GAAAC,GAAAN,EAAAO,EAAAC,CAAAD,GAAOE,KACPT,EAAUS,KAACT,QACXM,EAAUG,K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,EACA,OADAA,GAAS1G,EAAEqG,EAAMK,QACbA,EAAOpB,GAAG,UAEd5E,GAAKqD,oBAAoB2C,GADhB,QAKbC,QAAS,WACP/F,KAACgB,SAASgF,SACVhG,KAACW,OAAOqF,SACRhG,KAACH,QACI2D,YAAY,iBACZyC,WAAW,YACXC,OAAO,iBACPC,SACL/G,EAAE,QAAQ8G,OAAO,iBACjB9G,EAAEgH,OAAOC,UAAUN,QAAQO,KAAKtG,UAGpCuG","file":"webfont.select.js"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/* Web Font Loader v1.6.26 - (c) Adobe Systems, Google. License: Apache 2.0 */(function(){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function p(a,b,c){p=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return p.apply(null,arguments)}var q=Date.now||function(){return+new Date};function ca(a,b){this.a=a;this.m=b||a;this.c=this.m.document}var da=!!window.FontFace;function t(a,b,c,d){b=a.c.createElement(b);if(c)for(var e in c)c.hasOwnProperty(e)&&("style"==e?b.style.cssText=c[e]:b.setAttribute(e,c[e]));d&&b.appendChild(a.c.createTextNode(d));return b}function u(a,b,c){a=a.c.getElementsByTagName(b)[0];a||(a=document.documentElement);a.insertBefore(c,a.lastChild)}function v(a){a.parentNode&&a.parentNode.removeChild(a)}
|
2
|
+
function w(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),e=0;e<b.length;e+=1){for(var f=!1,g=0;g<d.length;g+=1)if(b[e]===d[g]){f=!0;break}f||d.push(b[e])}b=[];for(e=0;e<d.length;e+=1){f=!1;for(g=0;g<c.length;g+=1)if(d[e]===c[g]){f=!0;break}f||b.push(d[e])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function y(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return!0;return!1}
|
3
|
+
function z(a){if("string"===typeof a.f)return a.f;var b=a.m.location.protocol;"about:"==b&&(b=a.a.location.protocol);return"https:"==b?"https:":"http:"}function ea(a){return a.m.location.hostname||a.a.location.hostname}
|
4
|
+
function A(a,b,c){function d(){k&&e&&f&&(k(g),k=null)}b=t(a,"link",{rel:"stylesheet",href:b,media:"all"});var e=!1,f=!0,g=null,k=c||null;da?(b.onload=function(){e=!0;d()},b.onerror=function(){e=!0;g=Error("Stylesheet failed to load");d()}):setTimeout(function(){e=!0;d()},0);u(a,"head",b)}
|
5
|
+
function B(a,b,c,d){var e=a.c.getElementsByTagName("head")[0];if(e){var f=t(a,"script",{src:b}),g=!1;f.onload=f.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),f.onload=f.onreadystatechange=null,"HEAD"==f.parentNode.tagName&&e.removeChild(f))};e.appendChild(f);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return f}return null};function C(){this.a=0;this.c=null}function D(a){a.a++;return function(){a.a--;E(a)}}function F(a,b){a.c=b;E(a)}function E(a){0==a.a&&a.c&&(a.c(),a.c=null)};function G(a){this.a=a||"-"}G.prototype.c=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.a)};function H(a,b){this.c=a;this.f=4;this.a="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.a=c[1],this.f=parseInt(c[2],10))}function fa(a){return I(a)+" "+(a.f+"00")+" 300px "+J(a.c)}function J(a){var b=[];a=a.split(/,\s*/);for(var c=0;c<a.length;c++){var d=a[c].replace(/['"]/g,"");-1!=d.indexOf(" ")||/^\d/.test(d)?b.push("'"+d+"'"):b.push(d)}return b.join(",")}function K(a){return a.a+a.f}function I(a){var b="normal";"o"===a.a?b="oblique":"i"===a.a&&(b="italic");return b}
|
6
|
+
function ga(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function ha(a,b){this.c=a;this.f=a.m.document.documentElement;this.h=b;this.a=new G("-");this.j=!1!==b.events;this.g=!1!==b.classes}function ia(a){a.g&&w(a.f,[a.a.c("wf","loading")]);L(a,"loading")}function M(a){if(a.g){var b=y(a.f,a.a.c("wf","active")),c=[],d=[a.a.c("wf","loading")];b||c.push(a.a.c("wf","inactive"));w(a.f,c,d)}L(a,"inactive")}function L(a,b,c){if(a.j&&a.h[b])if(c)a.h[b](c.c,K(c));else a.h[b]()};function ja(){this.c={}}function ka(a,b,c){var d=[],e;for(e in b)if(b.hasOwnProperty(e)){var f=a.c[e];f&&d.push(f(b[e],c))}return d};function N(a,b){this.c=a;this.f=b;this.a=t(this.c,"span",{"aria-hidden":"true"},this.f)}function O(a){u(a.c,"body",a.a)}function P(a){return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+J(a.c)+";"+("font-style:"+I(a)+";font-weight:"+(a.f+"00")+";")};function Q(a,b,c,d,e,f){this.g=a;this.j=b;this.a=d;this.c=c;this.f=e||3E3;this.h=f||void 0}Q.prototype.start=function(){var a=this.c.m.document,b=this,c=q(),d=new Promise(function(d,e){function k(){q()-c>=b.f?e():a.fonts.load(fa(b.a),b.h).then(function(a){1<=a.length?d():setTimeout(k,25)},function(){e()})}k()}),e=new Promise(function(a,d){setTimeout(d,b.f)});Promise.race([e,d]).then(function(){b.g(b.a)},function(){b.j(b.a)})};function R(a,b,c,d,e,f,g){this.v=a;this.B=b;this.c=c;this.a=d;this.s=g||"BESbswy";this.f={};this.w=e||3E3;this.u=f||null;this.o=this.j=this.h=this.g=null;this.g=new N(this.c,this.s);this.h=new N(this.c,this.s);this.j=new N(this.c,this.s);this.o=new N(this.c,this.s);a=new H(this.a.c+",serif",K(this.a));a=P(a);this.g.a.style.cssText=a;a=new H(this.a.c+",sans-serif",K(this.a));a=P(a);this.h.a.style.cssText=a;a=new H("serif",K(this.a));a=P(a);this.j.a.style.cssText=a;a=new H("sans-serif",K(this.a));a=
|
7
|
+
P(a);this.o.a.style.cssText=a;O(this.g);O(this.h);O(this.j);O(this.o)}var S={D:"serif",C:"sans-serif"},T=null;function U(){if(null===T){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);T=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return T}R.prototype.start=function(){this.f.serif=this.j.a.offsetWidth;this.f["sans-serif"]=this.o.a.offsetWidth;this.A=q();la(this)};
|
8
|
+
function ma(a,b,c){for(var d in S)if(S.hasOwnProperty(d)&&b===a.f[S[d]]&&c===a.f[S[d]])return!0;return!1}function la(a){var b=a.g.a.offsetWidth,c=a.h.a.offsetWidth,d;(d=b===a.f.serif&&c===a.f["sans-serif"])||(d=U()&&ma(a,b,c));d?q()-a.A>=a.w?U()&&ma(a,b,c)&&(null===a.u||a.u.hasOwnProperty(a.a.c))?V(a,a.v):V(a,a.B):na(a):V(a,a.v)}function na(a){setTimeout(p(function(){la(this)},a),50)}function V(a,b){setTimeout(p(function(){v(this.g.a);v(this.h.a);v(this.j.a);v(this.o.a);b(this.a)},a),0)};function W(a,b,c){this.c=a;this.a=b;this.f=0;this.o=this.j=!1;this.s=c}var X=null;W.prototype.g=function(a){var b=this.a;b.g&&w(b.f,[b.a.c("wf",a.c,K(a).toString(),"active")],[b.a.c("wf",a.c,K(a).toString(),"loading"),b.a.c("wf",a.c,K(a).toString(),"inactive")]);L(b,"fontactive",a);this.o=!0;oa(this)};
|
9
|
+
W.prototype.h=function(a){var b=this.a;if(b.g){var c=y(b.f,b.a.c("wf",a.c,K(a).toString(),"active")),d=[],e=[b.a.c("wf",a.c,K(a).toString(),"loading")];c||d.push(b.a.c("wf",a.c,K(a).toString(),"inactive"));w(b.f,d,e)}L(b,"fontinactive",a);oa(this)};function oa(a){0==--a.f&&a.j&&(a.o?(a=a.a,a.g&&w(a.f,[a.a.c("wf","active")],[a.a.c("wf","loading"),a.a.c("wf","inactive")]),L(a,"active")):M(a.a))};function pa(a){this.j=a;this.a=new ja;this.h=0;this.f=this.g=!0}pa.prototype.load=function(a){this.c=new ca(this.j,a.context||this.j);this.g=!1!==a.events;this.f=!1!==a.classes;qa(this,new ha(this.c,a),a)};
|
10
|
+
function ra(a,b,c,d,e){var f=0==--a.h;(a.f||a.g)&&setTimeout(function(){var a=e||null,k=d||null||{};if(0===c.length&&f)M(b.a);else{b.f+=c.length;f&&(b.j=f);var h,m=[];for(h=0;h<c.length;h++){var l=c[h],n=k[l.c],r=b.a,x=l;r.g&&w(r.f,[r.a.c("wf",x.c,K(x).toString(),"loading")]);L(r,"fontloading",x);r=null;null===X&&(X=window.FontFace?(x=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent))?42<parseInt(x[1],10):!0:!1);X?r=new Q(p(b.g,b),p(b.h,b),b.c,l,b.s,n):r=new R(p(b.g,b),p(b.h,b),b.c,l,b.s,a,
|
11
|
+
n);m.push(r)}for(h=0;h<m.length;h++)m[h].start()}},0)}function qa(a,b,c){var d=[],e=c.timeout;ia(b);var d=ka(a.a,c,a.c),f=new W(a.c,b,e);a.h=d.length;b=0;for(c=d.length;b<c;b++)d[b].load(function(b,d,c){ra(a,f,b,d,c)})};function sa(a,b){this.c=a;this.a=b}function ta(a,b,c){var d=z(a.c);a=(a.a.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return d+"//"+a+"/"+b+".js"+(c?"?v="+c:"")}
|
12
|
+
sa.prototype.load=function(a){function b(){if(f["__mti_fntLst"+d]){var c=f["__mti_fntLst"+d](),e=[],h;if(c)for(var m=0;m<c.length;m++){var l=c[m].fontfamily;void 0!=c[m].fontStyle&&void 0!=c[m].fontWeight?(h=c[m].fontStyle+c[m].fontWeight,e.push(new H(l,h))):e.push(new H(l))}a(e)}else setTimeout(function(){b()},50)}var c=this,d=c.a.projectId,e=c.a.version;if(d){var f=c.c.m;B(this.c,ta(c,d,e),function(e){e?a([]):(f["__MonotypeConfiguration__"+d]=function(){return c.a},b())}).id="__MonotypeAPIScript__"+
|
13
|
+
d}else a([])};function ua(a,b){this.c=a;this.a=b}ua.prototype.load=function(a){var b,c,d=this.a.urls||[],e=this.a.families||[],f=this.a.testStrings||{},g=new C;b=0;for(c=d.length;b<c;b++)A(this.c,d[b],D(g));var k=[];b=0;for(c=e.length;b<c;b++)if(d=e[b].split(":"),d[1])for(var h=d[1].split(","),m=0;m<h.length;m+=1)k.push(new H(d[0],h[m]));else k.push(new H(d[0]));F(g,function(){a(k,f)})};function va(a,b,c){a?this.c=a:this.c=b+wa;this.a=[];this.f=[];this.g=c||""}var wa="//fonts.googleapis.com/css";function xa(a,b){for(var c=b.length,d=0;d<c;d++){var e=b[d].split(":");3==e.length&&a.f.push(e.pop());var f="";2==e.length&&""!=e[1]&&(f=":");a.a.push(e.join(f))}}
|
14
|
+
function ya(a){if(0==a.a.length)throw Error("No fonts to load!");if(-1!=a.c.indexOf("kit="))return a.c;for(var b=a.a.length,c=[],d=0;d<b;d++)c.push(a.a[d].replace(/ /g,"+"));b=a.c+"?family="+c.join("%7C");0<a.f.length&&(b+="&subset="+a.f.join(","));0<a.g.length&&(b+="&text="+encodeURIComponent(a.g));return b};function za(a){this.f=a;this.a=[];this.c={}}
|
15
|
+
var Aa={latin:"BESbswy","latin-ext":"\u00e7\u00f6\u00fc\u011f\u015f",cyrillic:"\u0439\u044f\u0416",greek:"\u03b1\u03b2\u03a3",khmer:"\u1780\u1781\u1782",Hanuman:"\u1780\u1781\u1782"},Ba={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},Ca={i:"i",italic:"i",n:"n",normal:"n"},
|
16
|
+
Da=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
|
17
|
+
function Ea(a){for(var b=a.f.length,c=0;c<b;c++){var d=a.f[c].split(":"),e=d[0].replace(/\+/g," "),f=["n4"];if(2<=d.length){var g;var k=d[1];g=[];if(k)for(var k=k.split(","),h=k.length,m=0;m<h;m++){var l;l=k[m];if(l.match(/^[\w-]+$/)){var n=Da.exec(l.toLowerCase());if(null==n)l="";else{l=n[2];l=null==l||""==l?"n":Ca[l];n=n[1];if(null==n||""==n)n="4";else var r=Ba[n],n=r?r:isNaN(n)?"4":n.substr(0,1);l=[l,n].join("")}}else l="";l&&g.push(l)}0<g.length&&(f=g);3==d.length&&(d=d[2],g=[],d=d?d.split(","):
|
18
|
+
g,0<d.length&&(d=Aa[d[0]])&&(a.c[e]=d))}a.c[e]||(d=Aa[e])&&(a.c[e]=d);for(d=0;d<f.length;d+=1)a.a.push(new H(e,f[d]))}};function Fa(a,b){this.c=a;this.a=b}var Ga={Arimo:!0,Cousine:!0,Tinos:!0};Fa.prototype.load=function(a){var b=new C,c=this.c,d=new va(this.a.api,z(c),this.a.text),e=this.a.families;xa(d,e);var f=new za(e);Ea(f);A(c,ya(d),D(b));F(b,function(){a(f.a,f.c,Ga)})};function Ha(a,b){this.c=a;this.a=b}Ha.prototype.load=function(a){var b=this.a.id,c=this.c.m;b?B(this.c,(this.a.api||"https://use.typekit.net")+"/"+b+".js",function(b){if(b)a([]);else if(c.Typekit&&c.Typekit.config&&c.Typekit.config.fn){b=c.Typekit.config.fn;for(var e=[],f=0;f<b.length;f+=2)for(var g=b[f],k=b[f+1],h=0;h<k.length;h++)e.push(new H(g,k[h]));try{c.Typekit.load({events:!1,classes:!1,async:!0})}catch(m){}a(e)}},2E3):a([])};function Ia(a,b){this.c=a;this.f=b;this.a=[]}Ia.prototype.load=function(a){var b=this.f.id,c=this.c.m,d=this;b?(c.__webfontfontdeckmodule__||(c.__webfontfontdeckmodule__={}),c.__webfontfontdeckmodule__[b]=function(b,c){for(var g=0,k=c.fonts.length;g<k;++g){var h=c.fonts[g];d.a.push(new H(h.name,ga("font-weight:"+h.weight+";font-style:"+h.style)))}a(d.a)},B(this.c,z(this.c)+(this.f.api||"//f.fontdeck.com/s/css/js/")+ea(this.c)+"/"+b+".js",function(b){b&&a([])})):a([])};var Y=new pa(window);Y.a.c.custom=function(a,b){return new ua(b,a)};Y.a.c.fontdeck=function(a,b){return new Ia(b,a)};Y.a.c.monotype=function(a,b){return new sa(b,a)};Y.a.c.typekit=function(a,b){return new Ha(b,a)};Y.a.c.google=function(a,b){return new Fa(b,a)};var Z={load:p(Y.load,Y)};"function"===typeof define&&define.amd?define(function(){return Z}):"undefined"!==typeof module&&module.exports?module.exports=Z:(window.WebFont=Z,window.WebFontConfig&&Y.load(window.WebFontConfig));}());
|
@@ -0,0 +1,41 @@
|
|
1
|
+
.webfont-wrapper {
|
2
|
+
position: relative;
|
3
|
+
display: inline-block; }
|
4
|
+
.webfont-wrapper .ui-icon {
|
5
|
+
cursor: pointer;
|
6
|
+
position: absolute;
|
7
|
+
top: 6px;
|
8
|
+
right: 6px; }
|
9
|
+
|
10
|
+
.webfont-input, .gwf-list {
|
11
|
+
font-size: 18px;
|
12
|
+
line-height: 1em; }
|
13
|
+
|
14
|
+
.webfont-input {
|
15
|
+
cursor: pointer;
|
16
|
+
border: 1px solid #ccc;
|
17
|
+
width: 12em;
|
18
|
+
height: 1.5em;
|
19
|
+
padding: 0 1.5em 0 0.5em; }
|
20
|
+
|
21
|
+
.webfont-list {
|
22
|
+
background: #fff;
|
23
|
+
color: #000;
|
24
|
+
border: 1px solid #ccc;
|
25
|
+
margin: 0;
|
26
|
+
padding: 0;
|
27
|
+
list-style-type: none;
|
28
|
+
width: 14em;
|
29
|
+
max-height: 12em;
|
30
|
+
overflow-x: hidden;
|
31
|
+
overflow-y: auto;
|
32
|
+
position: absolute;
|
33
|
+
top: 0;
|
34
|
+
left: 0; }
|
35
|
+
.webfont-list li {
|
36
|
+
cursor: pointer;
|
37
|
+
white-space: nowrap;
|
38
|
+
padding: 0.25em 0.5em; }
|
39
|
+
.webfont-list li.selected {
|
40
|
+
background: #339;
|
41
|
+
color: #fff; }
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "webfont-select-rails"
|
7
|
+
spec.version = "0.1.4"
|
8
|
+
spec.authors = ["Nic Ollis"]
|
9
|
+
spec.email = ["nic@ollis.me"]
|
10
|
+
|
11
|
+
spec.summary = %q{Rails plugin for jQueryUI wideget WebFont-Select}
|
12
|
+
spec.description = %q{Rails plugin for jQueryUI wideget WebFont-Select.}
|
13
|
+
spec.homepage = "https://github.com/nicollis/webfont-select-rails"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webfont-select-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nic Ollis
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Rails plugin for jQueryUI wideget WebFont-Select.
|
56
|
+
email:
|
57
|
+
- nic@ollis.me
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/webfont-select-rails.rb
|
72
|
+
- vendor/assets/javascript/webfont.select.js
|
73
|
+
- vendor/assets/javascript/webfont.select.js.map
|
74
|
+
- vendor/assets/javascript/webfontloader.js
|
75
|
+
- vendor/assets/stylesheets/webfont.select.css
|
76
|
+
- webfont-select-rails.gemspec
|
77
|
+
homepage: https://github.com/nicollis/webfont-select-rails
|
78
|
+
licenses: []
|
79
|
+
metadata:
|
80
|
+
allowed_push_host: https://rubygems.org
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.5.1
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Rails plugin for jQueryUI wideget WebFont-Select
|
101
|
+
test_files: []
|