storys 0.0.3 → 0.0.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 +8 -8
- data/app/css/app.css +14 -22
- data/app/css/lib/bootstrap.css +6057 -0
- data/app/css/views.index.css +3 -3
- data/app/css/views.show.css +1 -1
- data/app/fonts/lib/glyphicons-halflings-regular.eot +0 -0
- data/app/fonts/lib/glyphicons-halflings-regular.svg +229 -0
- data/app/fonts/lib/glyphicons-halflings-regular.ttf +0 -0
- data/app/fonts/lib/glyphicons-halflings-regular.woff +0 -0
- data/app/index.html +21 -14
- data/app/js/app.js +0 -5
- data/app/js/controllers.index.js +24 -7
- data/app/js/jquery.twoup.js +45 -20
- data/app/js/lib/bootstrap.js +1992 -0
- data/bin/storys +3 -13
- data/lib/storys/package.rb +69 -0
- data/lib/storys/story.rb +33 -10
- data/lib/storys/update.rb +16 -7
- data/lib/storys/version.rb +1 -1
- data/lib/storys.rb +2 -4
- data/storys.gemspec +0 -1
- metadata +9 -20
- data/lib/storys/storys.rb +0 -18
- data/lib/storys/storys_package.rb +0 -57
- data/lib/storys/template_helper.rb +0 -5
- data/lib/storys/templates/show.html.haml +0 -17
data/app/js/jquery.twoup.js
CHANGED
@@ -12,22 +12,27 @@
|
|
12
12
|
return;
|
13
13
|
}
|
14
14
|
|
15
|
-
twoup.
|
16
|
-
|
17
|
-
|
15
|
+
if(twoup.enabled()) {
|
16
|
+
twoup.content = content = $("<div></div>").css({ "-webkit-column-rule": column_rule, "-moz-column-rule": column_rule, "column-rule": column_rule });
|
17
|
+
twoup.slider = slider = $("<div></div>");
|
18
|
+
twoup.padding = padding = $(this).css({ "overflow": "hidden" });
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
var children = padding.children().detach();
|
21
|
+
padding.append(slider);
|
22
|
+
slider.append(content);
|
23
|
+
content.append(children);
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
$(window).resize(twoup.layout).resize();
|
25
|
+
$(window).resize(twoup.layout).resize();
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
$(window).bind('hashchange', function() {
|
28
|
+
slider.animate({ "margin-left": -((twoup.page() - 1) * scroll_width) + "px" }, 300);
|
29
|
+
}).trigger('hashchange');
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
$(window).bind('hashchange', function() {
|
33
|
+
$("body").animate({ scrollTop: (twoup.page() - 1) * Math.max(0, $(window).height() - 60) }, 300);
|
34
|
+
}).trigger('hashchange');
|
35
|
+
}
|
31
36
|
|
32
37
|
$(window).keydown(function(event) {
|
33
38
|
if(event.keyCode == 32 || event.keyCode == 39) {
|
@@ -45,19 +50,35 @@
|
|
45
50
|
|
46
51
|
twoup.enabled = function() {
|
47
52
|
//at the moment, only WebKit and MSIE10 has proper support for css3 columns AND getting the right width for a column element with overflow
|
48
|
-
|
53
|
+
//at the moment, android and iphone scale the output weirdly, and their CPU can't really handle the multicolums on large pages
|
54
|
+
return ($.browser.webkit || ($.browser.msie && $.browser.version >= 10)) && (!$.browser.android && !$.browser.iphone);
|
49
55
|
}
|
50
56
|
|
51
57
|
twoup.columns = function() {
|
52
|
-
|
58
|
+
if(twoup.enabled()) {
|
59
|
+
return Math.max(1, Math.floor($(window).width() / (18 * padding_width)));
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
return 1;
|
63
|
+
}
|
53
64
|
};
|
54
65
|
|
55
66
|
twoup.column_width = function() {
|
56
|
-
|
67
|
+
if(twoup.enabled()) {
|
68
|
+
return parseInt(content.css("-webkit-column-width") || content.css("-moz-column-width") || content.css("column-width"));
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
return content.width();
|
72
|
+
}
|
57
73
|
};
|
58
74
|
|
59
75
|
twoup.pages = function() {
|
60
|
-
|
76
|
+
if(twoup.enabled()) {
|
77
|
+
return Math.ceil(content_width / scroll_width);
|
78
|
+
}
|
79
|
+
else {
|
80
|
+
return Math.ceil($(document).height() / ($(window).height() - 60));
|
81
|
+
}
|
61
82
|
};
|
62
83
|
|
63
84
|
twoup.bound_page_number = function(number) {
|
@@ -81,18 +102,22 @@
|
|
81
102
|
};
|
82
103
|
|
83
104
|
twoup.layout = function() {
|
105
|
+
if(!twoup.enabled()) return;
|
106
|
+
|
84
107
|
padding_width = parseInt(padding.css("padding-top"));
|
85
108
|
|
86
109
|
var old_columns = columns;
|
87
110
|
columns = twoup.columns();
|
88
111
|
|
89
112
|
var column_gap_width = (padding_width * 2) + parseInt(content.css("-webkit-column-rule-width") || content.css("column-rule-width"));
|
90
|
-
var
|
91
|
-
var
|
113
|
+
var wrapper_width = window.innerWidth;
|
114
|
+
var wrapper_height = window.innerHeight;
|
115
|
+
var inner_width = wrapper_width - (padding_width * 2);
|
116
|
+
var inner_height = wrapper_height - (padding_width * 2);
|
92
117
|
var column_width = Math.floor((inner_width - (column_gap_width * (columns - 1))) / columns);
|
93
118
|
scroll_width = inner_width + column_gap_width;
|
94
119
|
|
95
|
-
padding.css({ "width":
|
120
|
+
padding.css({ "width": wrapper_width + "px", "height": wrapper_height + "px", "overflow": "hidden" });
|
96
121
|
content.css({ "width": inner_width + "px", "height": inner_height + "px", "-webkit-column-width": column_width + "px",
|
97
122
|
"-moz-column-width": column_width + "px", "column-width": column_width + "px", "-webkit-column-gap": column_gap_width + "px",
|
98
123
|
"-moz-column-gap": column_gap_width + "px", "column-gap": column_gap_width + "px" });
|