").css({position: "relative", height: input.css("height")})
221 | );
222 | clone = input
223 | .clone()
224 | .attr("tabindex", -1)
225 | .removeAttr("id name placeholder")
226 | .addClass("hint")
227 | .insertBefore(input);
228 | clone.css({
229 | position: "absolute",
230 | });
231 | }
232 |
233 | var hint = "";
234 | if (typeof word !== "undefined") {
235 | var value = input.val();
236 | hint = value + word.substr(value.split(/ |\n/).pop().length);
237 | }
238 |
239 | clone.val(hint);
240 | }
241 |
242 | // Hint by selecting part of the suggested word.
243 | function select(word) {
244 | var input = this;
245 | var value = input.val();
246 | if (word) {
247 | input.val(
248 | value
249 | + word.substr(value.split(/ |\n/).pop().length)
250 | );
251 |
252 | // Select hint.
253 | input[0].selectionStart = value.length;
254 | }
255 | }
256 | })(jQuery);
257 |
--------------------------------------------------------------------------------
/src/client.js:
--------------------------------------------------------------------------------
1 | var _ = require("lodash");
2 | var Chan = require("./models/chan");
3 | var crypto = require("crypto");
4 | var fs = require("fs");
5 | var identd = require("./identd");
6 | var log = require("./log");
7 | var net = require("net");
8 | var Msg = require("./models/msg");
9 | var Network = require("./models/network");
10 | var slate = require("slate-irc");
11 | var tls = require("tls");
12 | var Helper = require("./helper");
13 |
14 | module.exports = Client;
15 |
16 | var id = 0;
17 | var events = [
18 | "ctcp",
19 | "error",
20 | "invite",
21 | "join",
22 | "kick",
23 | "mode",
24 | "motd",
25 | "message",
26 | "link",
27 | "names",
28 | "nick",
29 | "notice",
30 | "part",
31 | "quit",
32 | "topic",
33 | "welcome",
34 | "whois"
35 | ];
36 | var inputs = [
37 | "action",
38 | "connect",
39 | "invite",
40 | "join",
41 | "kick",
42 | "mode",
43 | "msg",
44 | "nick",
45 | "notice",
46 | "part",
47 | "quit",
48 | "raw",
49 | "services",
50 | "topic",
51 | "whois"
52 | ];
53 |
54 | function Client(sockets, name, config) {
55 | _.merge(this, {
56 | activeChannel: -1,
57 | config: config,
58 | id: id++,
59 | name: name,
60 | networks: [],
61 | sockets: sockets
62 | });
63 | var client = this;
64 | crypto.randomBytes(48, function(err, buf) {
65 | client.token = buf.toString("hex");
66 | });
67 | if (config) {
68 | var delay = 0;
69 | (config.networks || []).forEach(function(n) {
70 | setTimeout(function() {
71 | client.connect(n);
72 | }, delay);
73 | delay += 1000;
74 | });
75 | }
76 | }
77 |
78 | Client.prototype.emit = function(event, data) {
79 | if (this.sockets !== null) {
80 | this.sockets.in(this.id).emit(event, data);
81 | }
82 | var config = this.config || {};
83 | if (config.log === true) {
84 | if (event === "msg") {
85 | var target = this.find(data.chan);
86 | if (target) {
87 | var chan = target.chan.name;
88 | if (target.chan.type === Chan.Type.LOBBY) {
89 | chan = target.network.host;
90 | }
91 | log.write(
92 | this.name,
93 | target.network.host,
94 | chan,
95 | data.msg
96 | );
97 | }
98 | }
99 | }
100 | };
101 |
102 | Client.prototype.find = function(id) {
103 | var network = null;
104 | var chan = null;
105 | for (var i in this.networks) {
106 | var n = this.networks[i];
107 | chan = _.find(n.channels, {id: id});
108 | if (chan) {
109 | network = n;
110 | break;
111 | }
112 | }
113 | if (network && chan) {
114 | return {
115 | network: network,
116 | chan: chan
117 | };
118 | } else {
119 | return false;
120 | }
121 | };
122 |
123 | Client.prototype.connect = function(args) {
124 | var config = Helper.getConfig();
125 | var client = this;
126 | var server = {
127 | name: args.name || "",
128 | host: args.host || "irc.freenode.org",
129 | port: args.port || (args.tls ? 6697 : 6667),
130 | rejectUnauthorized: false
131 | };
132 |
133 | if (config.bind) {
134 | server.localAddress = config.bind;
135 | if (args.tls) {
136 | var socket = net.connect(server);
137 | server.socket = socket;
138 | }
139 | }
140 |
141 | var stream = args.tls ? tls.connect(server) : net.connect(server);
142 |
143 | stream.on("error", function(e) {
144 | console.log("Client#connect():\n" + e);
145 | stream.end();
146 | var msg = new Msg({
147 | type: Msg.Type.ERROR,
148 | text: "Connection error."
149 | });
150 | client.emit("msg", {
151 | msg: msg
152 | });
153 | });
154 |
155 | var nick = args.nick || "shout-user";
156 | var username = args.username || nick.replace(/[^a-zA-Z0-9]/g, "");
157 | var realname = args.realname || "Shout User";
158 |
159 | var irc = slate(stream);
160 | identd.hook(stream, username);
161 |
162 | if (args.password) {
163 | irc.pass(args.password);
164 | }
165 |
166 | irc.me = nick;
167 | irc.nick(nick);
168 | irc.user(username, realname);
169 |
170 | var network = new Network({
171 | name: server.name,
172 | host: server.host,
173 | port: server.port,
174 | tls: !!args.tls,
175 | password: args.password,
176 | username: username,
177 | realname: realname,
178 | commands: args.commands
179 | });
180 |
181 | network.irc = irc;
182 |
183 | client.networks.push(network);
184 | client.emit("network", {
185 | network: network
186 | });
187 |
188 | events.forEach(function(plugin) {
189 | var path = "./plugins/irc-events/" + plugin;
190 | require(path).apply(client, [
191 | irc,
192 | network
193 | ]);
194 | });
195 |
196 | irc.once("welcome", function() {
197 | var delay = 1000;
198 | var commands = args.commands;
199 | if (Array.isArray(commands)) {
200 | commands.forEach(function(cmd) {
201 | setTimeout(function() {
202 | client.input({
203 | target: network.channels[0].id,
204 | text: cmd
205 | });
206 | }, delay);
207 | delay += 1000;
208 | });
209 | }
210 | setTimeout(function() {
211 | irc.write("PING " + network.host);
212 | }, delay);
213 | });
214 |
215 | irc.once("pong", function() {
216 | var join = (args.join || "");
217 | if (join) {
218 | join = join.replace(/\,/g, " ").split(/\s+/g);
219 | irc.join(join);
220 | }
221 | });
222 | };
223 |
224 | Client.prototype.input = function(data) {
225 | var client = this;
226 | var text = data.text.trim();
227 | var target = client.find(data.target);
228 | if (text.charAt(0) !== "/") {
229 | text = "/say " + text;
230 | }
231 | var args = text.split(" ");
232 | var cmd = args.shift().replace("/", "").toLowerCase();
233 | _.each(inputs, function(plugin) {
234 | try {
235 | var path = "./plugins/inputs/" + plugin;
236 | var fn = require(path);
237 | fn.apply(client, [
238 | target.network,
239 | target.chan,
240 | cmd,
241 | args
242 | ]);
243 | } catch (e) {
244 | console.log(path + ": " + e);
245 | }
246 | });
247 | };
248 |
249 | Client.prototype.more = function(data) {
250 | var client = this;
251 | var target = client.find(data.target);
252 | if (!target) {
253 | return;
254 | }
255 | var chan = target.chan;
256 | var count = chan.messages.length - (data.count || 0);
257 | var messages = chan.messages.slice(Math.max(0, count - 100), count);
258 | client.emit("more", {
259 | chan: chan.id,
260 | messages: messages
261 | });
262 | };
263 |
264 | Client.prototype.open = function(data) {
265 | var target = this.find(data);
266 | if (target) {
267 | target.chan.unread = 0;
268 | this.activeChannel = target.chan.id;
269 | }
270 | };
271 |
272 | Client.prototype.sort = function(data) {
273 | var self = this;
274 |
275 | var type = data.type;
276 | var order = data.order || [];
277 | var sorted = [];
278 |
279 | switch (type) {
280 | case "networks":
281 | _.each(order, function(i) {
282 | var find = _.find(self.networks, {id: i});
283 | if (find) {
284 | sorted.push(find);
285 | }
286 | });
287 | self.networks = sorted;
288 | break;
289 |
290 | case "channels":
291 | var target = data.target;
292 | var network = _.find(self.networks, {id: target});
293 | if (!network) {
294 | return;
295 | }
296 | _.each(order, function(i) {
297 | var find = _.find(network.channels, {id: i});
298 | if (find) {
299 | sorted.push(find);
300 | }
301 | });
302 | network.channels = sorted;
303 | break;
304 | }
305 | };
306 |
307 | Client.prototype.quit = function() {
308 | var sockets = this.sockets.sockets;
309 | var room = sockets.adapter.rooms[this.id] || [];
310 | for (var user in room) {
311 | var socket = sockets.adapter.nsp.connected[user];
312 | if (socket) {
313 | socket.disconnect();
314 | }
315 | }
316 | this.networks.forEach(function(network) {
317 | var irc = network.irc;
318 | if (network.connected) {
319 | irc.quit();
320 | } else {
321 | irc.stream.end();
322 | }
323 | });
324 | };
325 |
326 | var timer;
327 | Client.prototype.save = function(force) {
328 | var client = this;
329 | var config = Helper.getConfig();
330 |
331 | if (config.public) {
332 | return;
333 | }
334 |
335 | if (!force) {
336 | clearTimeout(timer);
337 | timer = setTimeout(function() {
338 | client.save(true);
339 | }, 1000);
340 | return;
341 | }
342 |
343 | var name = this.name;
344 | var path = Helper.HOME + "/users/" + name + ".json";
345 |
346 | var networks = _.map(
347 | this.networks,
348 | function(n) {
349 | return n.export();
350 | }
351 | );
352 |
353 | var json = {};
354 | fs.readFile(path, "utf-8", function(err, data) {
355 | if (err) {
356 | console.log(err);
357 | return;
358 | }
359 |
360 | try {
361 | json = JSON.parse(data);
362 | json.networks = networks;
363 | } catch (e) {
364 | console.log(e);
365 | return;
366 | }
367 |
368 | fs.writeFile(
369 | path,
370 | JSON.stringify(json, null, " "),
371 | {mode: "0777"},
372 | function(err) {
373 | if (err) {
374 | console.log(err);
375 | }
376 | }
377 | );
378 | });
379 | };
380 |
--------------------------------------------------------------------------------
/client/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
Shout
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | ">
25 |
26 |
27 |
28 |
36 |
42 |
43 |
44 |
45 |
83 |
167 |
168 |
171 |
172 |
173 |
174 |
Settings
175 |
176 |
177 |
Messages
178 |
179 |
180 |
184 |
185 |
186 |
190 |
191 |
192 |
196 |
197 |
198 |
202 |
203 |
204 |
208 |
209 |
210 |
214 |
215 |
216 |
Visual Aids
217 |
218 |
219 |
223 |
224 | <% if (typeof prefetch === "undefined" || prefetch !== false) { %>
225 |
226 |
Links and URLs
227 |
228 |
229 |
233 |
234 |
235 |
239 |
240 | <% } %>
241 |
242 |
Notifications
243 |
244 |
245 |
249 |
250 |
251 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
267 |
268 |
269 |
About Shout
270 |
271 |
272 |
273 | You're currently running version <%= version %>
274 | Check for updates
275 |
276 |
277 |
278 |
279 |
280 |
281 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
--------------------------------------------------------------------------------
/client/css/fonts/Open-Sans-300/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/client/css/fonts/Open-Sans-700/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/client/css/fonts/Open-Sans-regular/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/client/js/libs/jquery/tse.js:
--------------------------------------------------------------------------------
1 | /**
2 | * TrackpadScrollEmulator
3 | * Version: 1.0.6
4 | * Author: Jonathan Nicol @f6design
5 | * https://github.com/jnicol/trackpad-scroll-emulator
6 | *
7 | * The MIT License
8 | *
9 | * Copyright (c) 2012-2014 Jonathan Nicol
10 | *
11 | * Permission is hereby granted, free of charge, to any person obtaining a copy
12 | * of this software and associated documentation files (the "Software"), to deal
13 | * in the Software without restriction, including without limitation the rights
14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | * copies of the Software, and to permit persons to whom the Software is
16 | * furnished to do so, subject to the following conditions:
17 | *
18 | * The above copyright notice and this permission notice shall be included in
19 | * all copies or substantial portions of the Software.
20 | *
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 | * THE SOFTWARE.
28 | */
29 | ;(function($) {
30 | var pluginName = 'TrackpadScrollEmulator';
31 |
32 | function Plugin(element, options) {
33 | var el = element;
34 | var $el = $(element);
35 | var $scrollContentEl;
36 | var $contentEl = $el.find('.tse-content');
37 | var $scrollbarEl;
38 | var $dragHandleEl;
39 | var dragOffset;
40 | var flashTimeout;
41 | var pageJumpMultp = 7/8;
42 | var scrollDirection = 'vert';
43 | var scrollOffsetAttr = 'scrollTop';
44 | var sizeAttr = 'height';
45 | var offsetAttr = 'top';
46 |
47 | options = $.extend({}, $.fn[pluginName].defaults, options);
48 |
49 | /**
50 | * Initialize plugin
51 | */
52 | function init() {
53 | if ($el.hasClass('horizontal')){
54 | scrollDirection = 'horiz';
55 | scrollOffsetAttr = 'scrollLeft';
56 | sizeAttr = 'width';
57 | offsetAttr = 'left';
58 | }
59 |
60 | $el.prepend('
');
61 | $scrollbarEl = $el.find('.tse-scrollbar');
62 | $dragHandleEl = $el.find('.drag-handle');
63 |
64 | if (options.wrapContent) {
65 | $contentEl.wrap('
');
66 | }
67 | $scrollContentEl = $el.find('.tse-scroll-content');
68 |
69 | resizeScrollContent();
70 |
71 | if (options.autoHide) {
72 | $el.on('mouseenter', flashScrollbar);
73 | }
74 |
75 | $dragHandleEl.on('mousedown', startDrag);
76 | $scrollbarEl.on('mousedown', jumpScroll);
77 | $scrollContentEl.on('scroll', onScrolled);
78 |
79 | resizeScrollbar();
80 |
81 | $(window).on('resize', function() {
82 | recalculate();
83 | });
84 |
85 | if (!options.autoHide) {
86 | showScrollbar();
87 | }
88 | }
89 |
90 | /**
91 | * Start scrollbar handle drag
92 | */
93 | function startDrag(e) {
94 | // Preventing the event's default action stops text being
95 | // selectable during the drag.
96 | e.preventDefault();
97 |
98 | var self = $(this);
99 | self.trigger('startDrag');
100 |
101 | // Measure how far the user's mouse is from the top of the scrollbar drag handle.
102 | var eventOffset = e.pageY;
103 | if (scrollDirection === 'horiz') {
104 | eventOffset = e.pageX;
105 | }
106 | dragOffset = eventOffset - $dragHandleEl.offset()[offsetAttr];
107 |
108 | $(document).on('mousemove', drag);
109 | $(document).on('mouseup', function() {
110 | endDrag.call(self);
111 | });
112 | }
113 |
114 | /**
115 | * Drag scrollbar handle
116 | */
117 | function drag(e) {
118 | e.preventDefault();
119 |
120 | // Calculate how far the user's mouse is from the top/left of the scrollbar (minus the dragOffset).
121 | var eventOffset = e.pageY;
122 | if (scrollDirection === 'horiz') {
123 | eventOffset = e.pageX;
124 | }
125 | var dragPos = eventOffset - $scrollbarEl.offset()[offsetAttr] - dragOffset;
126 | // Convert the mouse position into a percentage of the scrollbar height/width.
127 | var dragPerc = dragPos / $scrollbarEl[sizeAttr]();
128 | // Scroll the content by the same percentage.
129 | var scrollPos = dragPerc * $contentEl[sizeAttr]();
130 |
131 | $scrollContentEl[scrollOffsetAttr](scrollPos);
132 | }
133 |
134 | /**
135 | * End scroll handle drag
136 | */
137 | function endDrag() {
138 | $(this).trigger('endDrag');
139 | $(document).off('mousemove', drag);
140 | $(document).off('mouseup', endDrag);
141 | }
142 |
143 | /**
144 | * Scroll in the same manner as the PAGE UP/DOWN keys
145 | */
146 | function jumpScroll(e) {
147 | // If the drag handle element was pressed, don't do anything here.
148 | if (e.target === $dragHandleEl[0]) {
149 | return;
150 | }
151 |
152 | // The content will scroll by 7/8 of a page.
153 | var jumpAmt = pageJumpMultp * $scrollContentEl[sizeAttr]();
154 |
155 | // Calculate where along the scrollbar the user clicked.
156 | var eventOffset = (scrollDirection === 'vert') ? e.originalEvent.layerY : e.originalEvent.layerX;
157 |
158 | // Get the position of the top (or left) of the drag handle.
159 | var dragHandleOffset = $dragHandleEl.position()[offsetAttr];
160 |
161 | // Determine which direction to scroll.
162 | var scrollPos = (eventOffset < dragHandleOffset) ? $scrollContentEl[scrollOffsetAttr]() - jumpAmt : $scrollContentEl[scrollOffsetAttr]() + jumpAmt;
163 |
164 | $scrollContentEl[scrollOffsetAttr](scrollPos);
165 | }
166 |
167 | /**
168 | * Scroll callback
169 | */
170 | function onScrolled(e) {
171 | flashScrollbar();
172 | }
173 |
174 | /**
175 | * Resize scrollbar
176 | */
177 | function resizeScrollbar() {
178 | var contentSize = $contentEl[sizeAttr]();
179 | var scrollOffset = $scrollContentEl[scrollOffsetAttr](); // Either scrollTop() or scrollLeft().
180 | var scrollbarSize = $scrollbarEl[sizeAttr]();
181 | var scrollbarRatio = scrollbarSize / contentSize;
182 |
183 | // Calculate new height/position of drag handle.
184 | // Offset of 2px allows for a small top/bottom or left/right margin around handle.
185 | var handleOffset = Math.round(scrollbarRatio * scrollOffset) + 2;
186 | var handleSize = Math.floor(scrollbarRatio * (scrollbarSize - 2)) - 2;
187 |
188 | if (scrollbarSize < contentSize) {
189 | if (scrollDirection === 'vert'){
190 | $dragHandleEl.css({'top': handleOffset, 'height': handleSize});
191 | } else {
192 | $dragHandleEl.css({'left': handleOffset, 'width': handleSize});
193 | }
194 | $scrollbarEl.show();
195 | } else {
196 | $scrollbarEl.hide();
197 | }
198 | }
199 |
200 | /**
201 | * Flash scrollbar visibility
202 | */
203 | function flashScrollbar() {
204 | resizeScrollbar();
205 | showScrollbar();
206 | }
207 |
208 | /**
209 | * Show scrollbar
210 | */
211 | function showScrollbar() {
212 | $dragHandleEl.addClass('visible');
213 |
214 | if (!options.autoHide) {
215 | return;
216 | }
217 | if(typeof flashTimeout === 'number') {
218 | window.clearTimeout(flashTimeout);
219 | }
220 | flashTimeout = window.setTimeout(function() {
221 | hideScrollbar();
222 | }, 1000);
223 | }
224 |
225 | /**
226 | * Hide Scrollbar
227 | */
228 | function hideScrollbar() {
229 | $dragHandleEl.removeClass('visible');
230 | if(typeof flashTimeout === 'number') {
231 | window.clearTimeout(flashTimeout);
232 | }
233 | }
234 |
235 | /**
236 | * Resize content element
237 | */
238 | function resizeScrollContent() {
239 | if (scrollDirection === 'vert'){
240 | $scrollContentEl.width($el.width()+scrollbarWidth());
241 | $scrollContentEl.height($el.height());
242 | } else {
243 | $scrollContentEl.width($el.width());
244 | $scrollContentEl.height($el.height()+scrollbarWidth());
245 | $contentEl.height($el.height());
246 | }
247 | }
248 |
249 | /**
250 | * Calculate scrollbar width
251 | *
252 | * Original function by Jonathan Sharp:
253 | * http://jdsharp.us/jQuery/minute/calculate-scrollbar-width.php
254 | * Updated to work in Chrome v25.
255 | */
256 | function scrollbarWidth() {
257 | // Append a temporary scrolling element to the DOM, then measure
258 | // the difference between between its outer and inner elements.
259 | var tempEl = $('