kamishibai 0.6.2
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 +1 -0
- data/LICENSE +29 -0
- data/README.md +91 -0
- data/bin/kamishibai +59 -0
- data/changelogs.txt +6 -0
- data/images/reading.jpg +0 -0
- data/images/settings.jpg +0 -0
- data/images/view_browse.jpg +0 -0
- data/images/view_dir.jpg +0 -0
- data/kamishibai.gemspec +31 -0
- data/lib/kamishibai.rb +35 -0
- data/lib/kamishibai/book.rb +97 -0
- data/lib/kamishibai/config.rb +90 -0
- data/lib/kamishibai/database.rb +330 -0
- data/lib/kamishibai/functions.rb +332 -0
- data/lib/kamishibai/patches.rb +58 -0
- data/lib/kamishibai/version.rb +7 -0
- data/lib/kamishibai/webserver.rb +502 -0
- data/lib/kamishibai/webserver_cmds.rb +26 -0
- data/lib/kamishibai/webserver_config.rb +91 -0
- data/lib/kamishibai/webserver_filemanager.rb +29 -0
- data/lib/kamishibai/webserver_tablet.rb +259 -0
- data/lib/kamishibai/workers.rb +39 -0
- data/public/css/browse.css +390 -0
- data/public/css/config.css +3 -0
- data/public/css/reader.css +119 -0
- data/public/css/styles.css +30 -0
- data/public/css/tablet_browse.css +247 -0
- data/public/css/tablet_reader.css +323 -0
- data/public/css/tablet_reader_input.css +191 -0
- data/public/images/ajax-loader.gif +0 -0
- data/public/images/delete.png +0 -0
- data/public/images/folder-mini-up.png +0 -0
- data/public/images/folder-mini.png +0 -0
- data/public/images/spinner.gif +0 -0
- data/public/images/trash-empty-mini.png +0 -0
- data/public/images/trash-full-mini.png +0 -0
- data/public/js/browse.js +391 -0
- data/public/js/config.js +190 -0
- data/public/js/reader.js +497 -0
- data/public/js/swipeview-k.js +478 -0
- data/public/js/tablet3.js +241 -0
- data/public/js/tablet3_browse.js +173 -0
- data/public/js/tablet3_reader.js +534 -0
- data/public/js/utilities.js +170 -0
- data/public/lang/k-cn.json +82 -0
- data/public/lang/k-en.json +82 -0
- data/public/lang/k-ja.json +82 -0
- data/public/vendor/css/bootstrap-slider.css +252 -0
- data/public/vendor/css/bootstrap-theme.css +476 -0
- data/public/vendor/css/bootstrap-theme.css.map +1 -0
- data/public/vendor/css/bootstrap-theme.min.css +5 -0
- data/public/vendor/css/bootstrap.css +6584 -0
- data/public/vendor/css/bootstrap.css.map +1 -0
- data/public/vendor/css/bootstrap.min.css +5 -0
- data/public/vendor/css/jquery-ui-1.10.0.custom.css +1614 -0
- data/public/vendor/css/jquery.mobile-1.3.1.min.css +3 -0
- data/public/vendor/css/jqueryFileTree.css +91 -0
- data/public/vendor/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/vendor/fonts/glyphicons-halflings-regular.svg +288 -0
- data/public/vendor/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/vendor/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/vendor/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/public/vendor/images/application.png +0 -0
- data/public/vendor/images/code.png +0 -0
- data/public/vendor/images/css.png +0 -0
- data/public/vendor/images/db.png +0 -0
- data/public/vendor/images/dim.png +0 -0
- data/public/vendor/images/directory.png +0 -0
- data/public/vendor/images/doc.png +0 -0
- data/public/vendor/images/file.png +0 -0
- data/public/vendor/images/film.png +0 -0
- data/public/vendor/images/flash.png +0 -0
- data/public/vendor/images/folder_open.png +0 -0
- data/public/vendor/images/grey.png +0 -0
- data/public/vendor/images/html.png +0 -0
- data/public/vendor/images/icons-18-black.png +0 -0
- data/public/vendor/images/icons-18-white.png +0 -0
- data/public/vendor/images/icons-36-black.png +0 -0
- data/public/vendor/images/icons-36-white.png +0 -0
- data/public/vendor/images/java.png +0 -0
- data/public/vendor/images/linux.png +0 -0
- data/public/vendor/images/music.png +0 -0
- data/public/vendor/images/pdf.png +0 -0
- data/public/vendor/images/php.png +0 -0
- data/public/vendor/images/picture.png +0 -0
- data/public/vendor/images/ppt.png +0 -0
- data/public/vendor/images/psd.png +0 -0
- data/public/vendor/images/ruby.png +0 -0
- data/public/vendor/images/script.png +0 -0
- data/public/vendor/images/spinner.gif +0 -0
- data/public/vendor/images/txt.png +0 -0
- data/public/vendor/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/vendor/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/vendor/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/vendor/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/vendor/images/ui-bg_flat_30_cccccc_40x100.png +0 -0
- data/public/vendor/images/ui-bg_flat_50_5c5c5c_40x100.png +0 -0
- data/public/vendor/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/public/vendor/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/vendor/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_20_555555_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_40_0078a3_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_40_ffc73d_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/public/vendor/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/vendor/images/ui-bg_gloss-wave_25_333333_500x100.png +0 -0
- data/public/vendor/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/vendor/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/public/vendor/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/vendor/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/vendor/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/vendor/images/ui-bg_highlight-soft_80_eeeeee_1x100.png +0 -0
- data/public/vendor/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/public/vendor/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/public/vendor/images/ui-bg_inset-soft_25_000000_1x100.png +0 -0
- data/public/vendor/images/ui-bg_inset-soft_30_f58400_1x100.png +0 -0
- data/public/vendor/images/ui-icons_217bc0_256x240.png +0 -0
- data/public/vendor/images/ui-icons_222222_256x240.png +0 -0
- data/public/vendor/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/vendor/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/vendor/images/ui-icons_454545_256x240.png +0 -0
- data/public/vendor/images/ui-icons_469bdd_256x240.png +0 -0
- data/public/vendor/images/ui-icons_4b8e0b_256x240.png +0 -0
- data/public/vendor/images/ui-icons_6da8d5_256x240.png +0 -0
- data/public/vendor/images/ui-icons_888888_256x240.png +0 -0
- data/public/vendor/images/ui-icons_a83300_256x240.png +0 -0
- data/public/vendor/images/ui-icons_cccccc_256x240.png +0 -0
- data/public/vendor/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/vendor/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/public/vendor/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/vendor/images/ui-icons_f9bd01_256x240.png +0 -0
- data/public/vendor/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/vendor/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/vendor/images/xls.png +0 -0
- data/public/vendor/images/zip.png +0 -0
- data/public/vendor/js/bootstrap-slider.js +1550 -0
- data/public/vendor/js/bootstrap.js +2317 -0
- data/public/vendor/js/bootstrap.min.js +7 -0
- data/public/vendor/js/jquery-2.1.4.js +9210 -0
- data/public/vendor/js/jquery-2.1.4.min.js +4 -0
- data/public/vendor/js/jquery-2.1.4.min.map +1 -0
- data/public/vendor/js/jquery-ui-1.10.2.custom.min.js +7 -0
- data/public/vendor/js/jquery.cookie.js +72 -0
- data/public/vendor/js/jquery.hammer.min.js +7 -0
- data/public/vendor/js/jquery.lazyload.min.js +15 -0
- data/public/vendor/js/jquery.localize.js +180 -0
- data/public/vendor/js/jquery.mobile-1.3.1.min.js +7 -0
- data/public/vendor/js/jquery.scrollTo-1.4.3.1.js +218 -0
- data/public/vendor/js/jqueryFileTree.js +95 -0
- data/public/vendor/js/swipeview.js +471 -0
- data/views/browse.haml +97 -0
- data/views/config.haml +115 -0
- data/views/layout.haml +12 -0
- data/views/login.haml +51 -0
- data/views/reader.haml +70 -0
- data/views/statistics.haml +108 -0
- data/views/tablet3.haml +80 -0
- metadata +334 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*
|
|
2
|
+
styling range input
|
|
3
|
+
https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
|
|
4
|
+
*/
|
|
5
|
+
/* Applying base CSS styles */
|
|
6
|
+
input[type=range] {
|
|
7
|
+
-webkit-appearance: none; /* Hides the slider so that custom slider can be made */
|
|
8
|
+
width: 100%; /* Specific width is required for Firefox. */
|
|
9
|
+
}
|
|
10
|
+
input[type=range]::-webkit-slider-thumb {
|
|
11
|
+
-webkit-appearance: none;
|
|
12
|
+
}
|
|
13
|
+
input[type=range]:focus {
|
|
14
|
+
outline: none; /* Removes the blue border. You should probably do some kind of focus styling for accessibility reasons though. */
|
|
15
|
+
}
|
|
16
|
+
/* Styling the Thumb */
|
|
17
|
+
input[type=range]::-webkit-slider-thumb {
|
|
18
|
+
-webkit-appearance: none;
|
|
19
|
+
border: 1px solid #000000;
|
|
20
|
+
height: 36px;
|
|
21
|
+
width: 16px;
|
|
22
|
+
border-radius: 3px;
|
|
23
|
+
background: #ffffff;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
margin-top: -14px; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
|
|
26
|
+
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; /* Add cool effects to your sliders! */
|
|
27
|
+
}
|
|
28
|
+
input[type=range]::-moz-range-thumb {
|
|
29
|
+
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
|
|
30
|
+
border: 1px solid #000000;
|
|
31
|
+
height: 36px;
|
|
32
|
+
width: 16px;
|
|
33
|
+
border-radius: 3px;
|
|
34
|
+
background: #ffffff;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
}
|
|
37
|
+
/* styling the track */
|
|
38
|
+
input[type=range]::-webkit-slider-runnable-track {
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 8.4px;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
|
|
43
|
+
background: #3071a9;
|
|
44
|
+
border-radius: 1.3px;
|
|
45
|
+
border: 0.2px solid #010101;
|
|
46
|
+
}
|
|
47
|
+
input[type=range]:focus::-webkit-slider-runnable-track {
|
|
48
|
+
background: #367ebd;
|
|
49
|
+
}
|
|
50
|
+
input[type=range]::-moz-range-track {
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 8.4px;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
|
|
55
|
+
background: #3071a9;
|
|
56
|
+
border-radius: 1.3px;
|
|
57
|
+
border: 0.2px solid #010101;
|
|
58
|
+
}
|
|
59
|
+
/* end styling range input */
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
styling radio input
|
|
63
|
+
http://schinckel.net/2012/01/23/styling-radio-buttons-like-a-segmented-button/
|
|
64
|
+
*/
|
|
65
|
+
.segmented-button {
|
|
66
|
+
padding: 12px;
|
|
67
|
+
}
|
|
68
|
+
.segmented-button input[type="radio"] {
|
|
69
|
+
width: 0px;
|
|
70
|
+
height: 0px;
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
.segmented-button label {
|
|
74
|
+
/*display: -moz-inline-box;
|
|
75
|
+
-moz-box-orient: vertical;*/
|
|
76
|
+
display: inline-block;
|
|
77
|
+
vertical-align: middle;
|
|
78
|
+
*vertical-align: auto;
|
|
79
|
+
/* -moz-border-radius: 4px;
|
|
80
|
+
-webkit-border-radius: 4px;
|
|
81
|
+
-o-border-radius: 4px;
|
|
82
|
+
-ms-border-radius: 4px;
|
|
83
|
+
-khtml-border-radius: 4px;*/
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
text-shadow: white;
|
|
86
|
+
/* background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e4e4e4));
|
|
87
|
+
background: -webkit-linear-gradient(#ffffff, #e4e4e4);
|
|
88
|
+
background: -moz-linear-gradient(#ffffff, #e4e4e4);
|
|
89
|
+
background: -o-linear-gradient(#ffffff, #e4e4e4);
|
|
90
|
+
background: -ms-linear-gradient(#ffffff, #e4e4e4);*/
|
|
91
|
+
background: linear-gradient(#111, #2D2D2D);
|
|
92
|
+
border: 1px solid #111;
|
|
93
|
+
color: #FFF;
|
|
94
|
+
padding: 5px 24px;
|
|
95
|
+
padding-bottom: 3px;
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
font-family: Helvetica;
|
|
99
|
+
/* -moz-border-radius: 0px;
|
|
100
|
+
-webkit-border-radius: 0px;
|
|
101
|
+
-o-border-radius: 0px;
|
|
102
|
+
-ms-border-radius: 0px;
|
|
103
|
+
-khtml-border-radius: 0px;*/
|
|
104
|
+
border-radius: 0px;
|
|
105
|
+
margin-right: -5px;
|
|
106
|
+
}
|
|
107
|
+
.segmented-button label {
|
|
108
|
+
*display: inline;
|
|
109
|
+
}
|
|
110
|
+
.segmented-button label:hover2 {
|
|
111
|
+
/*-moz-box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
|
|
112
|
+
-webkit-box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
|
|
113
|
+
-o-box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);*/
|
|
114
|
+
box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
|
|
115
|
+
color: #333333;
|
|
116
|
+
}
|
|
117
|
+
.segmented-button label:active, .segmented-button label.active {
|
|
118
|
+
/* background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #e4e4e4), color-stop(100%, #ffffff));
|
|
119
|
+
background: -webkit-linear-gradient(#e4e4e4, #ffffff);
|
|
120
|
+
background: -moz-linear-gradient(#e4e4e4, #ffffff);
|
|
121
|
+
background: -o-linear-gradient(#e4e4e4, #ffffff);
|
|
122
|
+
background: -ms-linear-gradient(#e4e4e4, #ffffff);*/
|
|
123
|
+
background: linear-gradient(#e4e4e4, #ffffff);
|
|
124
|
+
}
|
|
125
|
+
.segmented-button label:disabled, .segmented-button label.disabled {
|
|
126
|
+
/*background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #efefef));
|
|
127
|
+
background: -webkit-linear-gradient(#ffffff, #efefef);
|
|
128
|
+
background: -moz-linear-gradient(#ffffff, #efefef);
|
|
129
|
+
background: -o-linear-gradient(#ffffff, #efefef);
|
|
130
|
+
background: -ms-linear-gradient(#ffffff, #efefef);*/
|
|
131
|
+
background: linear-gradient(#ffffff, #efefef);
|
|
132
|
+
cursor: default;
|
|
133
|
+
color: #b2b2b2;
|
|
134
|
+
border-color: #cccccc;
|
|
135
|
+
/* -moz-box-shadow: none;
|
|
136
|
+
-webkit-box-shadow: none;
|
|
137
|
+
-o-box-shadow: none;*/
|
|
138
|
+
box-shadow: none;
|
|
139
|
+
}
|
|
140
|
+
.segmented-button label.first {
|
|
141
|
+
/* -moz-border-radius-topleft: 4px;
|
|
142
|
+
-webkit-border-top-left-radius: 4px;
|
|
143
|
+
-o-border-top-left-radius: 4px;
|
|
144
|
+
-ms-border-top-left-radius: 4px;
|
|
145
|
+
-khtml-border-top-left-radius: 4px;*/
|
|
146
|
+
border-top-left-radius: 4px;
|
|
147
|
+
/*-moz-border-radius-bottomleft: 4px;
|
|
148
|
+
-webkit-border-bottom-left-radius: 4px;
|
|
149
|
+
-o-border-bottom-left-radius: 4px;
|
|
150
|
+
-ms-border-bottom-left-radius: 4px;
|
|
151
|
+
-khtml-border-bottom-left-radius: 4px;*/
|
|
152
|
+
border-bottom-left-radius: 4px;
|
|
153
|
+
}
|
|
154
|
+
.segmented-button label.last {
|
|
155
|
+
/* -moz-border-radius-topright: 4px;
|
|
156
|
+
-webkit-border-top-right-radius: 4px;
|
|
157
|
+
-o-border-top-right-radius: 4px;
|
|
158
|
+
-ms-border-top-right-radius: 4px;
|
|
159
|
+
-khtml-border-top-right-radius: 4px;*/
|
|
160
|
+
border-top-right-radius: 4px;
|
|
161
|
+
/*-moz-border-radius-bottomright: 4px;
|
|
162
|
+
-webkit-border-bottom-right-radius: 4px;
|
|
163
|
+
-o-border-bottom-right-radius: 4px;
|
|
164
|
+
-ms-border-bottom-right-radius: 4px;
|
|
165
|
+
-khtml-border-bottom-right-radius: 4px;*/
|
|
166
|
+
border-bottom-right-radius: 4px;
|
|
167
|
+
}
|
|
168
|
+
.segmented-button input:checked + label, .segmented-button label.selected {
|
|
169
|
+
/*background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #e4e4e4), color-stop(100%, #ffffff));
|
|
170
|
+
background: -webkit-linear-gradient(#e4e4e4, #ffffff);
|
|
171
|
+
background: -moz-linear-gradient(#e4e4e4, #ffffff);
|
|
172
|
+
background: -o-linear-gradient(#e4e4e4, #ffffff);
|
|
173
|
+
background: -ms-linear-gradient(#e4e4e4, #ffffff);*/
|
|
174
|
+
background: linear-gradient(#5393C5, #6FACD5);
|
|
175
|
+
}
|
|
176
|
+
.segmented-button input:disabled + label {
|
|
177
|
+
/*background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #efefef));
|
|
178
|
+
background: -webkit-linear-gradient(#ffffff, #efefef);
|
|
179
|
+
background: -moz-linear-gradient(#ffffff, #efefef);
|
|
180
|
+
background: -o-linear-gradient(#ffffff, #efefef);
|
|
181
|
+
background: -ms-linear-gradient(#ffffff, #efefef);*/
|
|
182
|
+
background: linear-gradient(#ffffff, #efefef);
|
|
183
|
+
cursor: default;
|
|
184
|
+
color: #b2b2b2;
|
|
185
|
+
border-color: #cccccc;
|
|
186
|
+
/*-moz-box-shadow: none;
|
|
187
|
+
-webkit-box-shadow: none;
|
|
188
|
+
-o-box-shadow: none;*/
|
|
189
|
+
box-shadow: none;
|
|
190
|
+
}
|
|
191
|
+
/* end styling radio input */
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/public/js/browse.js
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
License: refer to LICENSE file
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// global variables
|
|
7
|
+
var hasTouch = 'ontouchstart' in window; //find out if device is touch device or not
|
|
8
|
+
var items_in_row = 0; // number of items in a row (inside #container)
|
|
9
|
+
var lastbook = getHashParams()['lastbook'];
|
|
10
|
+
if (!lastbook) lastbook = '';
|
|
11
|
+
var isBookSelectMode = false;
|
|
12
|
+
var isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i)
|
|
13
|
+
var primary_list;
|
|
14
|
+
var last_window_width = window.innerWidth;
|
|
15
|
+
var isDeleteMode = false;
|
|
16
|
+
|
|
17
|
+
// set the last browse selected on cookie
|
|
18
|
+
$.cookie(uport() + '.lastbrowse', '/browse/', { path: '/' });
|
|
19
|
+
|
|
20
|
+
// detect os
|
|
21
|
+
var OSName="Unknown OS";
|
|
22
|
+
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
|
|
23
|
+
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
|
|
24
|
+
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
|
|
25
|
+
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
//window.console||(console={log:function(){}});
|
|
29
|
+
// add support to console.log if the browser doesn't support it
|
|
30
|
+
if (!console.log) {
|
|
31
|
+
console = {
|
|
32
|
+
log:function(str) {
|
|
33
|
+
window.console.log(str);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function homepage() {
|
|
39
|
+
// get dir from hash
|
|
40
|
+
var hashes = getHashParams();
|
|
41
|
+
var dir = hashes['dir'].split('/');
|
|
42
|
+
|
|
43
|
+
dir.pop();
|
|
44
|
+
|
|
45
|
+
window.location.hash = 'dir=' + dir.join('/')
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function exe_order_by(str) {
|
|
50
|
+
// toggle the order button
|
|
51
|
+
$('.nav-collapse').collapse('toggle');
|
|
52
|
+
|
|
53
|
+
$.cookie(uport() + '.order_by', str, { path: '/' });
|
|
54
|
+
|
|
55
|
+
reload_dir_lists( getHashParams()['dir'], $('#searchbox').val() );
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function reload_sources() {
|
|
59
|
+
var ul = $('#ul-sources');
|
|
60
|
+
ul.empty();
|
|
61
|
+
|
|
62
|
+
$.getScript('/list_sources', function() {
|
|
63
|
+
for (i in sources) {
|
|
64
|
+
ul.append('<li><a tabindex="-1" href="#dir=' + sources[i] + '" rel="' + sources[i] + '">' + i + ' <i class="icon-bookmark"></i> ' + sources[i] + '</a></li>');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function func_set_last_selected_item( str ) {
|
|
70
|
+
$.cookie(uport() + '.last_selected_item', str, { path: '/' });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function reload_dir_lists(dir_path, keyword) {
|
|
74
|
+
// set default to name for order_by
|
|
75
|
+
var order_by = 'name';
|
|
76
|
+
var co = $.cookie(uport() + '.order_by');
|
|
77
|
+
if ( co ) {
|
|
78
|
+
switch ( co ) {
|
|
79
|
+
case 'name':
|
|
80
|
+
case 'size':
|
|
81
|
+
case 'date':
|
|
82
|
+
order_by = co;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
$.cookie(uport() + '.order_by', order_by, { path: '/' }) ;
|
|
87
|
+
|
|
88
|
+
// set the last path selected on cookie
|
|
89
|
+
$.cookie(uport() + '.lastpath', dir_path, { path: '/' });
|
|
90
|
+
|
|
91
|
+
var el = $('#dir_lists');
|
|
92
|
+
el.empty();
|
|
93
|
+
|
|
94
|
+
$.post('/lists_dir', { dir: dir_path, keyword: keyword, order_by: order_by }, function(data) {
|
|
95
|
+
el.append(data);
|
|
96
|
+
|
|
97
|
+
// make li evenly horizontally filled
|
|
98
|
+
var window_width = $(window).innerWidth();
|
|
99
|
+
var li_width = $('.updir').eq(0).innerWidth();
|
|
100
|
+
var num = parseInt(window_width / li_width);
|
|
101
|
+
num = parseInt(window_width / num);
|
|
102
|
+
$('.directory, .file').css('width', num +'px');
|
|
103
|
+
|
|
104
|
+
// set container top height
|
|
105
|
+
container_height_refresh();
|
|
106
|
+
|
|
107
|
+
// replace all links to desktop reader
|
|
108
|
+
if (!hasTouch) {
|
|
109
|
+
for (i in el.find('LI A')) {
|
|
110
|
+
var el_a = el.find('LI A').eq(i);
|
|
111
|
+
if (el_a.parent().hasClass('file')) {
|
|
112
|
+
el_a.attr('href', el_a.attr('href').replace(/reader2/,'reader') );
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// make images load only when scrolled into view
|
|
118
|
+
$("img.lazy").lazyload({
|
|
119
|
+
//effect : "fadeIn",
|
|
120
|
+
threshold : 500
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// get to the last selected item
|
|
124
|
+
var el_lsi = $('span:contains("' + $.cookie(uport() + '.last_selected_item') + '")').parent();
|
|
125
|
+
if (el_lsi.length == 1) {
|
|
126
|
+
$(el_lsi).addClass('last-selected-item');
|
|
127
|
+
$(document).scrollTo( el_lsi, {offset: - $('.navbar-inner').height() } );
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// apply click event for directory and file, so it will be focused next time
|
|
131
|
+
$('li.directory > a, li.file > a').click( function() {
|
|
132
|
+
func_set_last_selected_item( $(this).text() );
|
|
133
|
+
});
|
|
134
|
+
$('.updir > a').click( function() {
|
|
135
|
+
func_set_last_selected_item( getHashParams()['dir'].split('/').pop() );
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// make sure files are deleteable if in delete mode
|
|
139
|
+
if (isDeleteMode) {
|
|
140
|
+
delete_enable();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// trigger scroll event, so the img.lazy show thumbnails
|
|
144
|
+
$(window).scroll();
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function delete_book(bookcode) {
|
|
149
|
+
// send delete bookcode command to server
|
|
150
|
+
$.post('/delete_book', { bookcode: bookcode });
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function toggleDelete( el ) {
|
|
154
|
+
var bookcode = el.attr('bookcode');
|
|
155
|
+
|
|
156
|
+
var el = $('[bookcode=' + bookcode + ']');
|
|
157
|
+
|
|
158
|
+
if (el.children('.countdown').length < 1) {
|
|
159
|
+
el.prepend("<div class='countdown'><p>Z</p></div>");
|
|
160
|
+
|
|
161
|
+
countdownDelete( el, 6 );
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
var timer = el.attr('timer');
|
|
165
|
+
clearTimeout( timer );
|
|
166
|
+
|
|
167
|
+
el.children('.countdown').remove();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function countdownDelete(el, time) {
|
|
172
|
+
time = time - 1;
|
|
173
|
+
|
|
174
|
+
if (time > 0) {
|
|
175
|
+
// count down reduce by 1
|
|
176
|
+
el.children('.countdown').children('p').text(time);
|
|
177
|
+
|
|
178
|
+
var timer = setTimeout( function() {
|
|
179
|
+
countdownDelete(el, time);
|
|
180
|
+
}, 1000);
|
|
181
|
+
|
|
182
|
+
el.attr('timer', timer);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// count down over, now delete book
|
|
186
|
+
el.removeAttr('timer');
|
|
187
|
+
|
|
188
|
+
var bookcode = el.attr('bookcode');
|
|
189
|
+
delete_book(bookcode);
|
|
190
|
+
|
|
191
|
+
el.fadeOut( "slow", function() {
|
|
192
|
+
// show trash if doesn't exist, change trash icon to full
|
|
193
|
+
var t = $('#trash');
|
|
194
|
+
|
|
195
|
+
if (t.length <= 0) {
|
|
196
|
+
var li_link = getHashParams()['dir'] + '/Trash/';
|
|
197
|
+
var li_trash = '<li class="directory collapsed trash" id="trash"><a href="#dir=' + li_link + '"><img src="/images/trash-full-mini.png" /><span>Trash</span></a></li>'
|
|
198
|
+
$('#ul-lists').append(li_trash);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
var img = t.find('img').attr('src').split('/').pop();
|
|
202
|
+
|
|
203
|
+
if (img == 'trash-empty-mini.png') {
|
|
204
|
+
t.find('img').attr('src', '/images/trash-full-mini.png');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function delete_enable() {
|
|
212
|
+
isDeleteMode = true;
|
|
213
|
+
|
|
214
|
+
$('.nav-collapse').collapse('toggle');
|
|
215
|
+
|
|
216
|
+
var el = $('#btnDeleteDisable');
|
|
217
|
+
el.removeClass('hidden');
|
|
218
|
+
el.show();
|
|
219
|
+
|
|
220
|
+
// replace click event to toggle delete
|
|
221
|
+
el = $('li.file > a');
|
|
222
|
+
el.attr('onclick','').unbind('click');
|
|
223
|
+
el.click( function() {
|
|
224
|
+
toggleDelete( $(this) );
|
|
225
|
+
|
|
226
|
+
return false;
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function delete_disable() {
|
|
231
|
+
isDeleteMode = false;
|
|
232
|
+
|
|
233
|
+
$('[timer]').each(function() {
|
|
234
|
+
var timer = $(this).attr('timer');
|
|
235
|
+
clearTimeout( timer );
|
|
236
|
+
|
|
237
|
+
$(this).children('.countdown').remove();
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
var el = $('#btnDeleteDisable');
|
|
241
|
+
el.hide();
|
|
242
|
+
el.addClass('hidden');
|
|
243
|
+
|
|
244
|
+
// restore remember last clicked item
|
|
245
|
+
el = $('li.file > a');
|
|
246
|
+
el.attr('onclick','').unbind('click');
|
|
247
|
+
el.click( function() {
|
|
248
|
+
func_set_last_selected_item( $(this).text() );
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
function container_height_refresh() {
|
|
255
|
+
// $('#container').css('top', $('#navtop').outerHeight() - $('#navcollapse').outerHeight() );
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function reload_path_label(dir) {
|
|
259
|
+
// set container top height
|
|
260
|
+
container_height_refresh();
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
$(document).keydown(function(e) {
|
|
264
|
+
/* escape key */
|
|
265
|
+
if (e.keyCode == 27) {
|
|
266
|
+
homepage();
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// change dir on hashchange
|
|
272
|
+
window.addEventListener("hashchange", function() {
|
|
273
|
+
// get dir from hash
|
|
274
|
+
var hashes = getHashParams();
|
|
275
|
+
var dir = hashes['dir'];
|
|
276
|
+
|
|
277
|
+
// stop if dir not defined
|
|
278
|
+
if (dir == undefined) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// get keyword from searchbox
|
|
283
|
+
var keyword = $('#searchbox').val();
|
|
284
|
+
|
|
285
|
+
// save keyword used for search
|
|
286
|
+
$.cookie(uport() + '.lastsearch', keyword, { path: '/' });
|
|
287
|
+
|
|
288
|
+
// update path label
|
|
289
|
+
var dirs = dir.split('/');
|
|
290
|
+
dirs.shift();
|
|
291
|
+
var el = '';
|
|
292
|
+
var ds;
|
|
293
|
+
for (var i = 0; i < dirs.length - 1 ; i++) {
|
|
294
|
+
var li_class = '';
|
|
295
|
+
if (i >= dirs.length) {
|
|
296
|
+
li_class = ' class="active"';
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
ds = '/';
|
|
300
|
+
for (var j = 0; j < i; j++) {
|
|
301
|
+
ds += dirs[j] + '/';
|
|
302
|
+
}
|
|
303
|
+
ds += dirs[i];
|
|
304
|
+
el += '<li' + li_class + '><a href="#dir=' + ds + '">' + dirs[i] + '</a></li>';
|
|
305
|
+
}
|
|
306
|
+
el += '<li' + li_class + '>' + dirs[i] + '</li>';
|
|
307
|
+
$('#path').html(el);
|
|
308
|
+
|
|
309
|
+
// reload the dir list
|
|
310
|
+
reload_dir_lists(dir, keyword);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// page init
|
|
314
|
+
$(function() {
|
|
315
|
+
// load the text localization
|
|
316
|
+
reload_locale();
|
|
317
|
+
|
|
318
|
+
// load sources for menu
|
|
319
|
+
reload_sources();
|
|
320
|
+
|
|
321
|
+
if ($.cookie(uport() + '.lastsearch')) {
|
|
322
|
+
$('#searchbox').val( $.cookie(uport() + '.lastsearch') );
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
$('#searchbox').bind('change', function(e) {
|
|
326
|
+
// get dir from hash
|
|
327
|
+
var hashes = getHashParams();
|
|
328
|
+
var dir = hashes['dir'];
|
|
329
|
+
|
|
330
|
+
// get keyword from searchbox
|
|
331
|
+
var keyword = $('#searchbox').val();
|
|
332
|
+
|
|
333
|
+
// stop if it the search is same as last search
|
|
334
|
+
if (keyword == $.cookie(uport() + '.lastsearch')) return false;
|
|
335
|
+
|
|
336
|
+
// save keyword used for search
|
|
337
|
+
$.cookie(uport() + '.lastsearch', keyword, { path: '/' });
|
|
338
|
+
|
|
339
|
+
// reload the dir list
|
|
340
|
+
reload_dir_lists(dir, keyword);
|
|
341
|
+
});
|
|
342
|
+
$('#searchbox').bind('keyup', function(e) {
|
|
343
|
+
e = e || window.event;
|
|
344
|
+
|
|
345
|
+
if (e.keyCode == 13 || e.keyCode == 27) {
|
|
346
|
+
// enter key || escape key, unfocus the searchbox
|
|
347
|
+
$('#searchbox').blur();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// get dir from hash
|
|
351
|
+
var hashes = getHashParams();
|
|
352
|
+
var dir = hashes['dir'];
|
|
353
|
+
|
|
354
|
+
// get keyword from searchbox
|
|
355
|
+
var keyword = $('#searchbox').val();
|
|
356
|
+
|
|
357
|
+
// stop if it the search is same as last search
|
|
358
|
+
if (keyword == $.cookie(uport() + '.lastsearch')) return false;
|
|
359
|
+
|
|
360
|
+
// save keyword used for search
|
|
361
|
+
$.cookie(uport() + '.lastsearch', keyword, { path: '/' });
|
|
362
|
+
|
|
363
|
+
// reload the dir list
|
|
364
|
+
reload_dir_lists(dir, keyword);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
// load dir and file list
|
|
368
|
+
setTimeout( function() {
|
|
369
|
+
setTimeout(function() {
|
|
370
|
+
// set container top height, make sure it runs after everything
|
|
371
|
+
container_height_refresh();
|
|
372
|
+
}, 100);
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
// set hash to nothing first, then shortly after the correct hash path will be load, so the dir list will be run
|
|
376
|
+
window.location.hash = '';
|
|
377
|
+
|
|
378
|
+
setTimeout(function() {
|
|
379
|
+
if ($.cookie(uport() + '.lastpath')) {
|
|
380
|
+
// load last path remembered
|
|
381
|
+
window.location.hash = '#dir=' + $.cookie(uport() + '.lastpath');
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
// click the first source if there is no lastpath
|
|
385
|
+
window.location.hash = $('#ul-sources').find('LI A').eq(0).attr('href');
|
|
386
|
+
}
|
|
387
|
+
}, 50);
|
|
388
|
+
|
|
389
|
+
}, 500);
|
|
390
|
+
});
|
|
391
|
+
|