grids 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7e74fa1495bc0ebcdc860b0a31cfd6155009902e
4
+ data.tar.gz: f89b40ac8f33987f900a7b6227062d716e92d944
5
+ SHA512:
6
+ metadata.gz: 4b2c2b1926454b0539b2161c17b640b6909d2da02d1b50f6b462143f086f1d393330e62ae46c5541448f3b52c550c89b3971e649a5d1a0b800db47b69f47546c
7
+ data.tar.gz: 00c18c875ec869fb2a47c4032040e9e9205583a92ce399f879bb9e43a2fbc5803e0fff538665d605cc7beeb6ca843b97d277e387f9592e99cd2921fcd1ce51e4
@@ -1,33 +1,36 @@
1
1
  window.grids = new Object unless window.grids?
2
2
 
3
- # new grids.ToWidthFitter(16 / 1024)
4
- class grids.ToWidthFitter
5
- constructor: (@sampleFontToSampleWidth) ->
6
- $(window).resize @newFontSize
7
- @newFontSize()
8
-
9
- newFontSize: =>
10
-
11
- console.log($(window).innerHeight() * @sampleFontToSampleWidth)
12
- $('html').css(fontSize: "#{$(window).innerWidth() * @sampleFontToSampleWidth}px")
13
-
14
- # new grids.ToHeightFitter(16 / 768)
15
- class grids.ToHeightFitter
16
- constructor: (@sampleFontToSampleHeight) ->
17
- $(window).resize @newFontSize
18
- @newFontSize()
19
-
20
- newFontSize: =>
21
- $('html').css(fontSize: "#{$(window).innerHeight() * @sampleFontToSampleHeight}px")
22
-
23
-
24
- # new grids.ToWindowFitter(16 / 768, 1024 / 768)
25
- class grids.ToWindowFitter
26
- constructor: (@sampleFontToSampleHeight, @sampleWidthToSampleHeight) ->
27
- $(window).resize @newFontSize
28
- @newFontSize()
29
-
30
- newFontSize: =>
31
- min = Math.min($(window).innerHeight(), $(window).innerWidth() / @sampleWidthToSampleHeight)
32
- fontSize = min * @sampleFontToSampleHeight
33
- $('html').css(fontSize: "#{fontSize}px")
3
+ grids.fitToConstraints = (constraints)->
4
+ return false if constraints.minWidth? and constraints.minWidth > $(window).width()
5
+ return false if constraints.minHeight? and constraints.minHeight > $(window).height()
6
+ return false if constraints.maxWidth? and constraints.maxWidth < $(window).width()
7
+ return false if constraints.maxHeight? and constraints.maxHeight < $(window).height()
8
+ true
9
+
10
+
11
+ class grids.BaseFitter
12
+ constructor: (@options) ->
13
+ $(window).resize => @setFontSize()
14
+ @setFontSize()
15
+
16
+ setFontSize: ->
17
+ if grids.fitToConstraints(@options)
18
+ fontSize = @newFontSize()
19
+ $('html').css(fontSize: "#{fontSize}px")
20
+ else
21
+ $('html').css(fontSize: "")
22
+
23
+ class grids.ToWidthFitter extends grids.BaseFitter
24
+ constructor: (@sampleFontToSampleWidth, @options = {}) -> super(@options)
25
+ newFontSize: -> $(window).innerWidth() * @sampleFontToSampleWidth
26
+
27
+ class grids.ToHeightFitter extends grids.BaseFitter
28
+ constructor: (@sampleFontToSampleHeight, @options = {}) -> super(@options)
29
+ newFontSize: -> $(window).innerHeight() * @sampleFontToSampleHeight
30
+
31
+ class grids.ToWindowFitter extends grids.BaseFitter
32
+ constructor: (@sampleFontToSampleHeight, @sampleWidthToSampleHeight, @options = {}) ->
33
+ super(@options)
34
+ newFontSize: ->
35
+ min = Math.min($(window).innerHeight() * @sampleWidthToSampleHeight, $(window).innerWidth())
36
+ min * @sampleFontToSampleHeight
@@ -1,3 +1,3 @@
1
1
  module Grids
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grids
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- prerelease:
4
+ version: 1.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Vadim Rastyagaev
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
11
+ date: 2013-03-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: sass
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -55,27 +52,26 @@ files:
55
52
  - spec/spec_helper.rb
56
53
  homepage:
57
54
  licenses: []
55
+ metadata: {}
58
56
  post_install_message:
59
57
  rdoc_options: []
60
58
  require_paths:
61
59
  - lib
62
60
  required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
61
  requirements:
65
- - - ! '>='
62
+ - - '>='
66
63
  - !ruby/object:Gem::Version
67
64
  version: '0'
68
65
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
66
  requirements:
71
- - - ! '>='
67
+ - - '>='
72
68
  - !ruby/object:Gem::Version
73
69
  version: '0'
74
70
  requirements: []
75
71
  rubyforge_project:
76
- rubygems_version: 1.8.23
72
+ rubygems_version: 2.0.0
77
73
  signing_key:
78
- specification_version: 3
74
+ specification_version: 4
79
75
  summary: SASS helpers for grid systems management
80
76
  test_files:
81
77
  - spec/fixtures/application.scss