jquery-benignware-rails 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitmodules +3 -0
- data/lib/jquery-benignware-rails/version.rb +1 -1
- data/vendor/assets/javascripts/benignware/jquery.checkView.min.js +1 -1
- data/vendor/assets/javascripts/benignware/jquery.checkview.js +41 -72
- data/vendor/assets/javascripts/benignware/jquery.responsive-text.js +106 -0
- data/vendor/assets/javascripts/benignware/jquery.responsive-text.min.js +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWQxZTdlYWEzMTllM2U5MDVhMTQzZmUyMzY0OTU2MDBmMTI4NDVjOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWY4NDZlNzdmMzUzZDAxNjBhNWNmM2M4Yzk1OGYyNmJhMGNhNDU4ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2MwZmVhYzI1Mzk5ZDQ5M2ZlYzkxYzM2ODkxZWViNWQ0MDU5N2QyNzU5NzYx
|
10
|
+
MDRkMDcyZmZhNTcyMGZkNTcyZTg1NjUzZmQyMzE3Y2I5MWZlODcxZTVkZTNl
|
11
|
+
MzMwNDZhM2YxMDZhZTRhM2JjNGU5NTgwY2I2ZmVjYmViNTI5NDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzdhOTk5YjQ1NTI3ODNkYmM4M2YyMmI4NjNkYThmMjIzNTdlMWMxMTE0OGQ1
|
14
|
+
ZTI2YmQ3MDY3Nzc5YjBkOWY5NGM2NGI3YjdhZGI0YWIzOGMwMjg1NTU4MWU4
|
15
|
+
ODg1YzViOWI1ZjQ3NmNmMzIzYWFhMmYwNTU5MDA2M2U4NDQ3NzM=
|
data/.gitmodules
CHANGED
@@ -16,3 +16,6 @@
|
|
16
16
|
[submodule "submodules/jquery-scroll-to"]
|
17
17
|
path = submodules/jquery-scroll-to
|
18
18
|
url = https://github.com/benignware/jquery-scroll-to.git
|
19
|
+
[submodule "modules/jquery-touchclick"]
|
20
|
+
path = modules/jquery-touchclick
|
21
|
+
url = https://github.com/benignware/jquery-touchclick
|
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
(function(
|
2
|
+
(function(e,b){var d="checkview";var f={buttonTag:"span",buttonClass:"btn btn-default btn-xs btn-mini btn-checkview",iconClass:"glyphicon glyphicon-ok icon-ok",submitOnKeyEnter:true};var a=function c(k,t){var g="click";var h=this;var o=k.ownerDocument;var r=e(k);k.tabIndex="-1";k.style.position="absolute";k.style.width="0";k.style.height="0";var m=e(k).next();var j=e(k).prev();var q=m&&m.tagName=="input"&&m.type=="hidden"?m:j&&j.tagName=="input"&&j.type=="hidden"?j:null;var n,p;var n=r.parents("."+t.buttonClass)[0];if(!n){n=o.createElement(t.buttonTag||"span");k.parentNode.insertBefore(n,k)}var p=e(n);n.tabIndex="0";n.className=t.buttonClass;n.style.display="inline-block";n.style.cursor="pointer";var i=o.createElement("i");i.className=t.iconClass;n.appendChild(i);function s(){if(!k.value){k.value="on"}k.style.visibility="hidden";n.appendChild(k);i.style.verticalAlign="top";var u;p.bind("keypress",function(x){if(x.which==32){k.checked=!k.checked;h.invalidate()}if(x.which==13&&t.submitOnKeyEnter){if(k.form){k.form.submit()}}});r.bind("change",function(x){h.invalidate();b.clearTimeout(w)});var w=null;function v(){k.checked=!k.checked;e(k).trigger("change")}e(b).bind("resize",function(){h.invalidate()});this.invalidate()}function l(){var v=e(n);if(k.checked){v.addClass("checked")}else{v.removeClass("checked")}var u=e(["margin-left"]);var w={};u.each(function(){var x=r.css(this);if(x){w[this]=x}});v.css(w);i.style.visibility=k.checked?"":"hidden";i.style.position="relative";i.style.left=((e(n).width()-e(i).width())/2)+"px";i.style.top=((e(n).height()-e(i).height())/2)+"px"}this.setChecked=function(u){k.checked=u;if(u){r.attr("checked","checked")}else{r.removeAttr("checked")}this.invalidate()};this.isChecked=function(){return e(k).is(":checked")};this.invalidate=function(){l.call(this)};s.call(this)};e.fn[d]=function(g){g=e.extend({},f,g);return this.each(function(){if(!e(this).data(d)){e(this).data(d,new a(this,g))}return e(this)})}})(jQuery,window);
|
@@ -1,42 +1,24 @@
|
|
1
1
|
|
2
2
|
(function ( $, window) {
|
3
|
-
|
4
|
-
console.info ('init checkview plugin');
|
5
3
|
|
6
|
-
var pluginName = '
|
4
|
+
var pluginName = 'checkview';
|
7
5
|
|
8
6
|
var defaults = {
|
9
|
-
|
10
|
-
'
|
11
|
-
'
|
7
|
+
'buttonTag': 'span',
|
8
|
+
'buttonClass': 'btn btn-default btn-xs btn-mini btn-checkview',
|
9
|
+
'iconClass': 'glyphicon glyphicon-ok icon-ok',
|
10
|
+
'submitOnKeyEnter': true
|
12
11
|
};
|
13
|
-
|
14
|
-
// TODO: replace with jquery has
|
15
|
-
function isChildOf(child, parent) {
|
16
|
-
if (parent == child) return false;
|
17
|
-
var c = child;
|
18
|
-
try {
|
19
|
-
while (c) {
|
20
|
-
if (child.ownerDocument != null && c == child.ownerDocument.documentElement) return false;
|
21
|
-
if (c.parentNode == parent) return true;
|
22
|
-
if (c.parentNode == null) return false;
|
23
|
-
c = c.parentNode;
|
24
|
-
}
|
25
|
-
} catch (e) {
|
26
|
-
//console.error(e);
|
27
|
-
}
|
28
|
-
return false;
|
29
|
-
}
|
30
|
-
|
12
|
+
|
31
13
|
var pluginClass = function CheckView(element, options) {
|
32
|
-
|
14
|
+
|
33
15
|
var eventType = 'click';
|
34
16
|
|
35
|
-
var
|
17
|
+
var checkView = this;
|
36
18
|
|
37
19
|
var doc = element.ownerDocument;
|
38
20
|
|
39
|
-
var $
|
21
|
+
var $element = $(element);
|
40
22
|
element.tabIndex = "-1";
|
41
23
|
|
42
24
|
element.style.position = 'absolute';
|
@@ -49,30 +31,27 @@
|
|
49
31
|
: previousElement && previousElement.tagName == "input" && previousElement.type == "hidden" ? previousElement
|
50
32
|
: null;
|
51
33
|
|
52
|
-
var containerView
|
34
|
+
var containerView, $containerView;
|
35
|
+
|
36
|
+
var containerView = $element.parents("." + options.buttonClass)[0];
|
53
37
|
if (!containerView) {
|
54
|
-
containerView = doc.createElement('span');
|
38
|
+
containerView = doc.createElement(options.buttonTag || 'span');
|
55
39
|
element.parentNode.insertBefore(containerView, element);
|
56
40
|
}
|
41
|
+
var $containerView = $(containerView);
|
57
42
|
|
58
43
|
containerView.tabIndex = "0";
|
59
|
-
containerView.className = options.
|
44
|
+
containerView.className = options.buttonClass;
|
60
45
|
containerView.style.display = 'inline-block';
|
61
|
-
containerView.style.lineHeight = "0";
|
62
46
|
containerView.style.cursor = "pointer";
|
63
47
|
|
64
48
|
var checkmarkIcon = doc.createElement('i');
|
65
|
-
checkmarkIcon.style.margin = "0";
|
66
49
|
checkmarkIcon.className = options.iconClass;
|
67
50
|
containerView.appendChild(checkmarkIcon);
|
51
|
+
|
68
52
|
|
69
53
|
// private methods
|
70
54
|
|
71
|
-
function toggleCheckbox() {
|
72
|
-
element.checked = !element.checked;
|
73
|
-
checkboxView.invalidate();
|
74
|
-
}
|
75
|
-
|
76
55
|
function init() {
|
77
56
|
|
78
57
|
if (!element.value) {
|
@@ -85,53 +64,34 @@
|
|
85
64
|
|
86
65
|
var $label;
|
87
66
|
|
88
|
-
$
|
67
|
+
$containerView.bind('keypress', function(event) {
|
89
68
|
|
90
69
|
if (event.which == 32) {
|
91
70
|
element.checked = !element.checked;
|
92
|
-
|
71
|
+
checkView.invalidate();
|
93
72
|
}
|
94
73
|
|
95
|
-
if (event.which == 13 && options.
|
74
|
+
if (event.which == 13 && options.submitOnKeyEnter) {
|
96
75
|
if (element.form) {
|
97
76
|
element.form.submit();
|
98
77
|
}
|
99
78
|
}
|
100
79
|
|
101
80
|
});
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
checkboxView.invalidate();
|
81
|
+
|
82
|
+
$element.bind('change', function(event) {
|
83
|
+
checkView.invalidate();
|
106
84
|
window.clearTimeout(toggleClickTimeoutId);
|
107
85
|
});
|
108
|
-
|
109
|
-
$(containerView).parents('label').bind("click", function(event) {
|
110
|
-
if (event.target != element && event.target != containerView && !isChildOf(event.target, containerView)) {
|
111
|
-
event.stopImmediatePropagation();
|
112
|
-
$(containerView).trigger('click');
|
113
|
-
}
|
114
|
-
});
|
115
86
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
}
|
122
|
-
|
123
|
-
$(containerView).bind("click", function(event) {
|
124
|
-
if (event.target != element) {
|
125
|
-
window.clearTimeout(toggleClickTimeoutId);
|
126
|
-
toggleClickTimeoutId = window.setTimeout(function() {
|
127
|
-
toggleClick();
|
128
|
-
}, 100);
|
129
|
-
event.preventDefault();
|
130
|
-
};
|
131
|
-
});
|
87
|
+
var toggleClickTimeoutId = null;
|
88
|
+
function toggleClick() {
|
89
|
+
element.checked = !element.checked;
|
90
|
+
$(element).trigger('change');
|
91
|
+
}
|
132
92
|
|
133
93
|
$(window).bind('resize', function() {
|
134
|
-
|
94
|
+
checkView.invalidate();
|
135
95
|
});
|
136
96
|
|
137
97
|
this.invalidate();
|
@@ -139,11 +99,20 @@
|
|
139
99
|
};
|
140
100
|
|
141
101
|
function layout() {
|
102
|
+
var $containerView = $(containerView);
|
142
103
|
if (element.checked) {
|
143
|
-
$
|
104
|
+
$containerView.addClass('checked');
|
144
105
|
} else {
|
145
|
-
$
|
106
|
+
$containerView.removeClass('checked');
|
146
107
|
}
|
108
|
+
var $copyStyles = $(['margin-left']);
|
109
|
+
var css = {};
|
110
|
+
$copyStyles.each(function() {
|
111
|
+
var value = $element.css(this);
|
112
|
+
if (value) css[this] = value;
|
113
|
+
});
|
114
|
+
$containerView.css(css);
|
115
|
+
|
147
116
|
checkmarkIcon.style.visibility = element.checked ? '' : 'hidden';
|
148
117
|
checkmarkIcon.style.position = 'relative';
|
149
118
|
checkmarkIcon.style.left = (($(containerView).width() - $(checkmarkIcon).width()) / 2) + 'px';
|
@@ -155,9 +124,9 @@
|
|
155
124
|
this.setChecked = function(bool) {
|
156
125
|
element.checked = bool;
|
157
126
|
if (bool) {
|
158
|
-
$
|
127
|
+
$element.attr('checked', 'checked');
|
159
128
|
} else {
|
160
|
-
$
|
129
|
+
$element.removeAttr('checked');
|
161
130
|
}
|
162
131
|
this.invalidate();
|
163
132
|
};
|
@@ -0,0 +1,106 @@
|
|
1
|
+
|
2
|
+
// Ensure private scope + aliases
|
3
|
+
(function ( $, window) {
|
4
|
+
|
5
|
+
|
6
|
+
/**
|
7
|
+
* jQuery-Plugin for viewport based font-sizing
|
8
|
+
*
|
9
|
+
* viewport-based font-scaling
|
10
|
+
*
|
11
|
+
*/
|
12
|
+
|
13
|
+
var pluginName = 'responsiveText';
|
14
|
+
|
15
|
+
var defaults = {
|
16
|
+
'fontSize': '',
|
17
|
+
'minFontSize': '12px',
|
18
|
+
'maxFontSize': '',
|
19
|
+
'bindResize': true
|
20
|
+
};
|
21
|
+
|
22
|
+
var pluginClass = function ResponsiveText(element, options) {
|
23
|
+
|
24
|
+
var responsiveText = this;
|
25
|
+
|
26
|
+
|
27
|
+
// private methods
|
28
|
+
|
29
|
+
/* returns font-size in pixels */
|
30
|
+
function parseFontSize(string) {
|
31
|
+
if (!string) {
|
32
|
+
return 0;
|
33
|
+
}
|
34
|
+
var fontSize = 0;
|
35
|
+
|
36
|
+
var matches = string.match(/^(\d+(?:\.\d+)?)(.*)$/);
|
37
|
+
|
38
|
+
var value = matches ? matches[1] : "";
|
39
|
+
var unit = matches ? matches[2] : "";
|
40
|
+
|
41
|
+
switch (unit) {
|
42
|
+
|
43
|
+
case 'vw':
|
44
|
+
fontSize = $(window).innerWidth() / 100 * value;
|
45
|
+
break;
|
46
|
+
|
47
|
+
case 'vh':
|
48
|
+
fontSize = $(window).innerHeight() / 100 * value;
|
49
|
+
break;
|
50
|
+
|
51
|
+
default:
|
52
|
+
$(element).css('fontSize', value + unit);
|
53
|
+
fontSize = parseFloat($(element).css('fontSize'));
|
54
|
+
}
|
55
|
+
|
56
|
+
return !isNaN(fontSize) ? fontSize : 0;
|
57
|
+
}
|
58
|
+
|
59
|
+
function init() {
|
60
|
+
|
61
|
+
if (options.bindResize) {
|
62
|
+
$(window).bind('resize', function() {
|
63
|
+
responsiveText.invalidate();
|
64
|
+
});
|
65
|
+
}
|
66
|
+
|
67
|
+
this.invalidate();
|
68
|
+
}
|
69
|
+
|
70
|
+
// public methods
|
71
|
+
|
72
|
+
this.invalidate = function() {
|
73
|
+
var fontSize = parseFontSize(options.fontSize);
|
74
|
+
var minFontSize = parseFontSize(options.minFontSize);
|
75
|
+
var maxFontSize = parseFontSize(options.maxFontSize);
|
76
|
+
fontSize = minFontSize ? Math.max(fontSize, minFontSize) : fontSize;
|
77
|
+
fontSize = maxFontSize ? Math.min(fontSize, maxFontSize) : fontSize;
|
78
|
+
$(element).css('fontSize', fontSize + "px");
|
79
|
+
};
|
80
|
+
|
81
|
+
init.call(this);
|
82
|
+
|
83
|
+
};
|
84
|
+
|
85
|
+
|
86
|
+
// bootstrap plugin
|
87
|
+
|
88
|
+
$.fn[pluginName] = function(options) {
|
89
|
+
|
90
|
+
options = $.extend({}, defaults, options);
|
91
|
+
|
92
|
+
return this.each(function() {
|
93
|
+
|
94
|
+
if (!$(this).data(pluginName)) {
|
95
|
+
|
96
|
+
$(this).data(pluginName, new pluginClass(this, options));
|
97
|
+
|
98
|
+
}
|
99
|
+
|
100
|
+
return $(this);
|
101
|
+
|
102
|
+
});
|
103
|
+
|
104
|
+
};
|
105
|
+
|
106
|
+
})( jQuery, window );
|
@@ -0,0 +1,2 @@
|
|
1
|
+
|
2
|
+
(function(d,b){var c="responsiveText";var f={fontSize:"",minFontSize:"12px",maxFontSize:"",bindResize:true};var a=function e(i,h){var j=this;function g(l){if(!l){return 0}var p=0;var o=l.match(/^(\d+(?:\.\d+)?)(.*)$/);var n=o?o[1]:"";var m=o?o[2]:"";switch(m){case"vw":p=d(b).innerWidth()/100*n;break;case"vh":p=d(b).innerHeight()/100*n;break;default:d(i).css("fontSize",n+m);p=parseFloat(d(i).css("fontSize"))}return !isNaN(p)?p:0}function k(){if(h.bindResize){d(b).bind("resize",function(){j.invalidate()})}this.invalidate()}this.invalidate=function(){var n=g(h.fontSize);var m=g(h.minFontSize);var l=g(h.maxFontSize);n=m?Math.max(n,m):n;n=l?Math.min(n,l):n;d(i).css("fontSize",n+"px")};k.call(this)};d.fn[c]=function(g){g=d.extend({},f,g);return this.each(function(){if(!d(this).data(c)){d(this).data(c,new a(this,g))}return d(this)})}})(jQuery,window);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-benignware-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rexblack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -52,6 +52,8 @@ files:
|
|
52
52
|
- vendor/assets/javascripts/benignware/jquery.checkview.js
|
53
53
|
- vendor/assets/javascripts/benignware/jquery.nativepicker.js
|
54
54
|
- vendor/assets/javascripts/benignware/jquery.nativepicker.min.js
|
55
|
+
- vendor/assets/javascripts/benignware/jquery.responsive-text.js
|
56
|
+
- vendor/assets/javascripts/benignware/jquery.responsive-text.min.js
|
55
57
|
- vendor/assets/javascripts/benignware/jquery.responsiveText.js
|
56
58
|
- vendor/assets/javascripts/benignware/jquery.responsiveText.min.js
|
57
59
|
- vendor/assets/javascripts/benignware/jquery.scroll-to.js
|