sharkey-web 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.md +19 -0
  5. data/README.md +188 -0
  6. data/Rakefile +8 -0
  7. data/bin/sharkey-web +9 -0
  8. data/config.ru +3 -0
  9. data/lib/sharkey.rb +12 -0
  10. data/lib/sharkey/app.rb +526 -0
  11. data/lib/sharkey/importerexporter.rb +79 -0
  12. data/lib/sharkey/models.rb +295 -0
  13. data/lib/sharkey/public/css/loading.gif +0 -0
  14. data/lib/sharkey/public/css/magicsuggest.css +232 -0
  15. data/lib/sharkey/public/css/nprogress.css +74 -0
  16. data/lib/sharkey/public/css/styles.css +263 -0
  17. data/lib/sharkey/public/css/ui.fancytree.css +545 -0
  18. data/lib/sharkey/public/data/sentences.txt +5 -0
  19. data/lib/sharkey/public/fonts/Quadrata.eot +0 -0
  20. data/lib/sharkey/public/fonts/Quadrata.svg +613 -0
  21. data/lib/sharkey/public/fonts/Quadrata.ttf +0 -0
  22. data/lib/sharkey/public/fonts/Quadrata.woff +0 -0
  23. data/lib/sharkey/public/fonts/Quadrata.zip +0 -0
  24. data/lib/sharkey/public/images/loader.gif +0 -0
  25. data/lib/sharkey/public/images/sharkey-logo.png +0 -0
  26. data/lib/sharkey/public/images/sharkey.png +0 -0
  27. data/lib/sharkey/public/js/ajaxmanager.js +67 -0
  28. data/lib/sharkey/public/js/keybindings.js +92 -0
  29. data/lib/sharkey/public/js/lib/bootstrap.min.js +6 -0
  30. data/lib/sharkey/public/js/lib/jquery-1.9.1.min.js +5 -0
  31. data/lib/sharkey/public/js/lib/jquery-ui.js +16150 -0
  32. data/lib/sharkey/public/js/lib/jquery.bootstrap-autohidingnavbar.js +213 -0
  33. data/lib/sharkey/public/js/lib/jquery.fancytree-all.js +6424 -0
  34. data/lib/sharkey/public/js/lib/jquery.tagcloud.js +92 -0
  35. data/lib/sharkey/public/js/lib/magicsuggest.js +1468 -0
  36. data/lib/sharkey/public/js/lib/mousetrap.min.js +9 -0
  37. data/lib/sharkey/public/js/lib/nprogress.js +476 -0
  38. data/lib/sharkey/public/js/page-add-link-autofill.js +102 -0
  39. data/lib/sharkey/public/js/page-add-link.js +156 -0
  40. data/lib/sharkey/public/js/page-categories.js +348 -0
  41. data/lib/sharkey/public/js/page-edit-link.js +103 -0
  42. data/lib/sharkey/public/js/page-links.js +54 -0
  43. data/lib/sharkey/public/js/page-settings.js +93 -0
  44. data/lib/sharkey/public/js/page-tagcloud.js +35 -0
  45. data/lib/sharkey/public/js/page-tags.js +287 -0
  46. data/lib/sharkey/public/js/scripts.js +147 -0
  47. data/lib/sharkey/public/themes/amelia/style.css +7 -0
  48. data/lib/sharkey/public/themes/bootstrap/style.css +5785 -0
  49. data/lib/sharkey/public/themes/cerulean/style.css +7 -0
  50. data/lib/sharkey/public/themes/cosmo/style.css +7 -0
  51. data/lib/sharkey/public/themes/cyborg/style.css +7 -0
  52. data/lib/sharkey/public/themes/darkly/style.css +7 -0
  53. data/lib/sharkey/public/themes/facebook-like/README.md +6 -0
  54. data/lib/sharkey/public/themes/facebook-like/style.css +6085 -0
  55. data/lib/sharkey/public/themes/flatly/style.css +7 -0
  56. data/lib/sharkey/public/themes/fonts/glyphicons-halflings-regular.eot +0 -0
  57. data/lib/sharkey/public/themes/fonts/glyphicons-halflings-regular.svg +229 -0
  58. data/lib/sharkey/public/themes/fonts/glyphicons-halflings-regular.ttf +0 -0
  59. data/lib/sharkey/public/themes/fonts/glyphicons-halflings-regular.woff +0 -0
  60. data/lib/sharkey/public/themes/holo-like/README.md +5 -0
  61. data/lib/sharkey/public/themes/holo-like/style.css +5997 -0
  62. data/lib/sharkey/public/themes/journal/style.css +7 -0
  63. data/lib/sharkey/public/themes/lumen/style.css +7 -0
  64. data/lib/sharkey/public/themes/readable/style.css +7 -0
  65. data/lib/sharkey/public/themes/simplex/style.css +7 -0
  66. data/lib/sharkey/public/themes/slate/style.css +7 -0
  67. data/lib/sharkey/public/themes/spacelab/style.css +7 -0
  68. data/lib/sharkey/public/themes/superhero/style.css +7 -0
  69. data/lib/sharkey/public/themes/united/style.css +7 -0
  70. data/lib/sharkey/public/themes/yeti/style.css +7 -0
  71. data/lib/sharkey/setting.rb +74 -0
  72. data/lib/sharkey/version.rb +5 -0
  73. data/lib/sharkey/views/404.slim +4 -0
  74. data/lib/sharkey/views/about.slim +7 -0
  75. data/lib/sharkey/views/add_link.slim +157 -0
  76. data/lib/sharkey/views/categories.slim +101 -0
  77. data/lib/sharkey/views/category.slim +22 -0
  78. data/lib/sharkey/views/centered.slim +49 -0
  79. data/lib/sharkey/views/dashboard.slim +107 -0
  80. data/lib/sharkey/views/dashboard_index.slim +26 -0
  81. data/lib/sharkey/views/edit_link.slim +121 -0
  82. data/lib/sharkey/views/help.slim +74 -0
  83. data/lib/sharkey/views/keybindings.slim +58 -0
  84. data/lib/sharkey/views/link.slim +30 -0
  85. data/lib/sharkey/views/links.slim +22 -0
  86. data/lib/sharkey/views/navbar.slim +68 -0
  87. data/lib/sharkey/views/settings.slim +74 -0
  88. data/lib/sharkey/views/settings_index.slim +220 -0
  89. data/lib/sharkey/views/single_category.slim +37 -0
  90. data/lib/sharkey/views/single_link.slim +95 -0
  91. data/lib/sharkey/views/single_tag.slim +33 -0
  92. data/lib/sharkey/views/tag.slim +22 -0
  93. data/lib/sharkey/views/tagcloud.slim +54 -0
  94. data/lib/sharkey/views/tags.slim +99 -0
  95. data/sharkey-web.gemspec +44 -0
  96. metadata +324 -0
@@ -0,0 +1,9 @@
1
+ /* mousetrap v1.4.6 craig.is/killing/mice */
2
+ (function(J,r,f){function s(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent("on"+b,d)}function A(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return h[a.which]?h[a.which]:B[a.which]?B[a.which]:String.fromCharCode(a.which).toLowerCase()}function t(a){a=a||{};var b=!1,d;for(d in n)a[d]?b=!0:n[d]=0;b||(u=!1)}function C(a,b,d,c,e,v){var g,k,f=[],h=d.type;if(!l[a])return[];"keyup"==h&&w(a)&&(b=[a]);for(g=0;g<l[a].length;++g)if(k=
3
+ l[a][g],!(!c&&k.seq&&n[k.seq]!=k.level||h!=k.action||("keypress"!=h||d.metaKey||d.ctrlKey)&&b.sort().join(",")!==k.modifiers.sort().join(","))){var m=c&&k.seq==c&&k.level==v;(!c&&k.combo==e||m)&&l[a].splice(g,1);f.push(k)}return f}function K(a){var b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");return b}function x(a,b,d,c){m.stopCallback(b,b.target||b.srcElement,d,c)||!1!==a(b,d)||(b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation?
4
+ b.stopPropagation():b.cancelBubble=!0)}function y(a){"number"!==typeof a.which&&(a.which=a.keyCode);var b=A(a);b&&("keyup"==a.type&&z===b?z=!1:m.handleKey(b,K(a),a))}function w(a){return"shift"==a||"ctrl"==a||"alt"==a||"meta"==a}function L(a,b,d,c){function e(b){return function(){u=b;++n[a];clearTimeout(D);D=setTimeout(t,1E3)}}function v(b){x(d,b,a);"keyup"!==c&&(z=A(b));setTimeout(t,10)}for(var g=n[a]=0;g<b.length;++g){var f=g+1===b.length?v:e(c||E(b[g+1]).action);F(b[g],f,c,a,g)}}function E(a,b){var d,
5
+ c,e,f=[];d="+"===a?["+"]:a.split("+");for(e=0;e<d.length;++e)c=d[e],G[c]&&(c=G[c]),b&&"keypress"!=b&&H[c]&&(c=H[c],f.push("shift")),w(c)&&f.push(c);d=c;e=b;if(!e){if(!p){p={};for(var g in h)95<g&&112>g||h.hasOwnProperty(g)&&(p[h[g]]=g)}e=p[d]?"keydown":"keypress"}"keypress"==e&&f.length&&(e="keydown");return{key:c,modifiers:f,action:e}}function F(a,b,d,c,e){q[a+":"+d]=b;a=a.replace(/\s+/g," ");var f=a.split(" ");1<f.length?L(a,f,b,d):(d=E(a,d),l[d.key]=l[d.key]||[],C(d.key,d.modifiers,{type:d.action},
6
+ c,a,e),l[d.key][c?"unshift":"push"]({callback:b,modifiers:d.modifiers,action:d.action,seq:c,level:e,combo:a}))}var h={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},B={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},H={"~":"`","!":"1",
7
+ "@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},G={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p,l={},q={},n={},D,z=!1,I=!1,u=!1;for(f=1;20>f;++f)h[111+f]="f"+f;for(f=0;9>=f;++f)h[f+96]=f;s(r,"keypress",y);s(r,"keydown",y);s(r,"keyup",y);var m={bind:function(a,b,d){a=a instanceof Array?a:[a];for(var c=0;c<a.length;++c)F(a[c],b,d);return this},
8
+ unbind:function(a,b){return m.bind(a,function(){},b)},trigger:function(a,b){if(q[a+":"+b])q[a+":"+b]({},a);return this},reset:function(){l={};q={};return this},stopCallback:function(a,b){return-1<(" "+b.className+" ").indexOf(" mousetrap ")?!1:"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable},handleKey:function(a,b,d){var c=C(a,b,d),e;b={};var f=0,g=!1;for(e=0;e<c.length;++e)c[e].seq&&(f=Math.max(f,c[e].level));for(e=0;e<c.length;++e)c[e].seq?c[e].level==f&&(g=!0,
9
+ b[c[e].seq]=1,x(c[e].callback,d,c[e].combo,c[e].seq)):g||x(c[e].callback,d,c[e].combo);c="keypress"==d.type&&I;d.type!=u||w(a)||c||t(b);I=g&&"keydown"==d.type}};J.Mousetrap=m;"function"===typeof define&&define.amd&&define(m)})(window,document);
@@ -0,0 +1,476 @@
1
+ /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
2
+ * @license MIT */
3
+
4
+ ;(function(root, factory) {
5
+
6
+ if (typeof define === 'function' && define.amd) {
7
+ define(factory);
8
+ } else if (typeof exports === 'object') {
9
+ module.exports = factory();
10
+ } else {
11
+ root.NProgress = factory();
12
+ }
13
+
14
+ })(this, function() {
15
+ var NProgress = {};
16
+
17
+ NProgress.version = '0.1.6';
18
+
19
+ var Settings = NProgress.settings = {
20
+ minimum: 0.08,
21
+ easing: 'ease',
22
+ positionUsing: '',
23
+ speed: 200,
24
+ trickle: true,
25
+ trickleRate: 0.02,
26
+ trickleSpeed: 800,
27
+ showSpinner: true,
28
+ barSelector: '[role="bar"]',
29
+ spinnerSelector: '[role="spinner"]',
30
+ parent: 'body',
31
+ template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
32
+ };
33
+
34
+ /**
35
+ * Updates configuration.
36
+ *
37
+ * NProgress.configure({
38
+ * minimum: 0.1
39
+ * });
40
+ */
41
+ NProgress.configure = function(options) {
42
+ var key, value;
43
+ for (key in options) {
44
+ value = options[key];
45
+ if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
46
+ }
47
+
48
+ return this;
49
+ };
50
+
51
+ /**
52
+ * Last number.
53
+ */
54
+
55
+ NProgress.status = null;
56
+
57
+ /**
58
+ * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
59
+ *
60
+ * NProgress.set(0.4);
61
+ * NProgress.set(1.0);
62
+ */
63
+
64
+ NProgress.set = function(n) {
65
+ var started = NProgress.isStarted();
66
+
67
+ n = clamp(n, Settings.minimum, 1);
68
+ NProgress.status = (n === 1 ? null : n);
69
+
70
+ var progress = NProgress.render(!started),
71
+ bar = progress.querySelector(Settings.barSelector),
72
+ speed = Settings.speed,
73
+ ease = Settings.easing;
74
+
75
+ progress.offsetWidth; /* Repaint */
76
+
77
+ queue(function(next) {
78
+ // Set positionUsing if it hasn't already been set
79
+ if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
80
+
81
+ // Add transition
82
+ css(bar, barPositionCSS(n, speed, ease));
83
+
84
+ if (n === 1) {
85
+ // Fade out
86
+ css(progress, {
87
+ transition: 'none',
88
+ opacity: 1
89
+ });
90
+ progress.offsetWidth; /* Repaint */
91
+
92
+ setTimeout(function() {
93
+ css(progress, {
94
+ transition: 'all ' + speed + 'ms linear',
95
+ opacity: 0
96
+ });
97
+ setTimeout(function() {
98
+ NProgress.remove();
99
+ next();
100
+ }, speed);
101
+ }, speed);
102
+ } else {
103
+ setTimeout(next, speed);
104
+ }
105
+ });
106
+
107
+ return this;
108
+ };
109
+
110
+ NProgress.isStarted = function() {
111
+ return typeof NProgress.status === 'number';
112
+ };
113
+
114
+ /**
115
+ * Shows the progress bar.
116
+ * This is the same as setting the status to 0%, except that it doesn't go backwards.
117
+ *
118
+ * NProgress.start();
119
+ *
120
+ */
121
+ NProgress.start = function() {
122
+ if (!NProgress.status) NProgress.set(0);
123
+
124
+ var work = function() {
125
+ setTimeout(function() {
126
+ if (!NProgress.status) return;
127
+ NProgress.trickle();
128
+ work();
129
+ }, Settings.trickleSpeed);
130
+ };
131
+
132
+ if (Settings.trickle) work();
133
+
134
+ return this;
135
+ };
136
+
137
+ /**
138
+ * Hides the progress bar.
139
+ * This is the *sort of* the same as setting the status to 100%, with the
140
+ * difference being `done()` makes some placebo effect of some realistic motion.
141
+ *
142
+ * NProgress.done();
143
+ *
144
+ * If `true` is passed, it will show the progress bar even if its hidden.
145
+ *
146
+ * NProgress.done(true);
147
+ */
148
+
149
+ NProgress.done = function(force) {
150
+ if (!force && !NProgress.status) return this;
151
+
152
+ return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
153
+ };
154
+
155
+ /**
156
+ * Increments by a random amount.
157
+ */
158
+
159
+ NProgress.inc = function(amount) {
160
+ var n = NProgress.status;
161
+
162
+ if (!n) {
163
+ return NProgress.start();
164
+ } else {
165
+ if (typeof amount !== 'number') {
166
+ amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
167
+ }
168
+
169
+ n = clamp(n + amount, 0, 0.994);
170
+ return NProgress.set(n);
171
+ }
172
+ };
173
+
174
+ NProgress.trickle = function() {
175
+ return NProgress.inc(Math.random() * Settings.trickleRate);
176
+ };
177
+
178
+ /**
179
+ * Waits for all supplied jQuery promises and
180
+ * increases the progress as the promises resolve.
181
+ *
182
+ * @param $promise jQUery Promise
183
+ */
184
+ (function() {
185
+ var initial = 0, current = 0;
186
+
187
+ NProgress.promise = function($promise) {
188
+ if (!$promise || $promise.state() == "resolved") {
189
+ return this;
190
+ }
191
+
192
+ if (current == 0) {
193
+ NProgress.start();
194
+ }
195
+
196
+ initial++;
197
+ current++;
198
+
199
+ $promise.always(function() {
200
+ current--;
201
+ if (current == 0) {
202
+ initial = 0;
203
+ NProgress.done();
204
+ } else {
205
+ NProgress.set((initial - current) / initial);
206
+ }
207
+ });
208
+
209
+ return this;
210
+ };
211
+
212
+ })();
213
+
214
+ /**
215
+ * (Internal) renders the progress bar markup based on the `template`
216
+ * setting.
217
+ */
218
+
219
+ NProgress.render = function(fromStart) {
220
+ if (NProgress.isRendered()) return document.getElementById('nprogress');
221
+
222
+ addClass(document.documentElement, 'nprogress-busy');
223
+
224
+ var progress = document.createElement('div');
225
+ progress.id = 'nprogress';
226
+ progress.innerHTML = Settings.template;
227
+
228
+ var bar = progress.querySelector(Settings.barSelector),
229
+ perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
230
+ parent = document.querySelector(Settings.parent),
231
+ spinner;
232
+
233
+ css(bar, {
234
+ transition: 'all 0 linear',
235
+ transform: 'translate3d(' + perc + '%,0,0)'
236
+ });
237
+
238
+ if (!Settings.showSpinner) {
239
+ spinner = progress.querySelector(Settings.spinnerSelector);
240
+ spinner && removeElement(spinner);
241
+ }
242
+
243
+ if (parent != document.body) {
244
+ addClass(parent, 'nprogress-custom-parent');
245
+ }
246
+
247
+ parent.appendChild(progress);
248
+ return progress;
249
+ };
250
+
251
+ /**
252
+ * Removes the element. Opposite of render().
253
+ */
254
+
255
+ NProgress.remove = function() {
256
+ removeClass(document.documentElement, 'nprogress-busy');
257
+ removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent')
258
+ var progress = document.getElementById('nprogress');
259
+ progress && removeElement(progress);
260
+ };
261
+
262
+ /**
263
+ * Checks if the progress bar is rendered.
264
+ */
265
+
266
+ NProgress.isRendered = function() {
267
+ return !!document.getElementById('nprogress');
268
+ };
269
+
270
+ /**
271
+ * Determine which positioning CSS rule to use.
272
+ */
273
+
274
+ NProgress.getPositioningCSS = function() {
275
+ // Sniff on document.body.style
276
+ var bodyStyle = document.body.style;
277
+
278
+ // Sniff prefixes
279
+ var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
280
+ ('MozTransform' in bodyStyle) ? 'Moz' :
281
+ ('msTransform' in bodyStyle) ? 'ms' :
282
+ ('OTransform' in bodyStyle) ? 'O' : '';
283
+
284
+ if (vendorPrefix + 'Perspective' in bodyStyle) {
285
+ // Modern browsers with 3D support, e.g. Webkit, IE10
286
+ return 'translate3d';
287
+ } else if (vendorPrefix + 'Transform' in bodyStyle) {
288
+ // Browsers without 3D support, e.g. IE9
289
+ return 'translate';
290
+ } else {
291
+ // Browsers without translate() support, e.g. IE7-8
292
+ return 'margin';
293
+ }
294
+ };
295
+
296
+ /**
297
+ * Helpers
298
+ */
299
+
300
+ function clamp(n, min, max) {
301
+ if (n < min) return min;
302
+ if (n > max) return max;
303
+ return n;
304
+ }
305
+
306
+ /**
307
+ * (Internal) converts a percentage (`0..1`) to a bar translateX
308
+ * percentage (`-100%..0%`).
309
+ */
310
+
311
+ function toBarPerc(n) {
312
+ return (-1 + n) * 100;
313
+ }
314
+
315
+
316
+ /**
317
+ * (Internal) returns the correct CSS for changing the bar's
318
+ * position given an n percentage, and speed and ease from Settings
319
+ */
320
+
321
+ function barPositionCSS(n, speed, ease) {
322
+ var barCSS;
323
+
324
+ if (Settings.positionUsing === 'translate3d') {
325
+ barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
326
+ } else if (Settings.positionUsing === 'translate') {
327
+ barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
328
+ } else {
329
+ barCSS = { 'margin-left': toBarPerc(n)+'%' };
330
+ }
331
+
332
+ barCSS.transition = 'all '+speed+'ms '+ease;
333
+
334
+ return barCSS;
335
+ }
336
+
337
+ /**
338
+ * (Internal) Queues a function to be executed.
339
+ */
340
+
341
+ var queue = (function() {
342
+ var pending = [];
343
+
344
+ function next() {
345
+ var fn = pending.shift();
346
+ if (fn) {
347
+ fn(next);
348
+ }
349
+ }
350
+
351
+ return function(fn) {
352
+ pending.push(fn);
353
+ if (pending.length == 1) next();
354
+ };
355
+ })();
356
+
357
+ /**
358
+ * (Internal) Applies css properties to an element, similar to the jQuery
359
+ * css method.
360
+ *
361
+ * While this helper does assist with vendor prefixed property names, it
362
+ * does not perform any manipulation of values prior to setting styles.
363
+ */
364
+
365
+ var css = (function() {
366
+ var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
367
+ cssProps = {};
368
+
369
+ function camelCase(string) {
370
+ return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
371
+ return letter.toUpperCase();
372
+ });
373
+ }
374
+
375
+ function getVendorProp(name) {
376
+ var style = document.body.style;
377
+ if (name in style) return name;
378
+
379
+ var i = cssPrefixes.length,
380
+ capName = name.charAt(0).toUpperCase() + name.slice(1),
381
+ vendorName;
382
+ while (i--) {
383
+ vendorName = cssPrefixes[i] + capName;
384
+ if (vendorName in style) return vendorName;
385
+ }
386
+
387
+ return name;
388
+ }
389
+
390
+ function getStyleProp(name) {
391
+ name = camelCase(name);
392
+ return cssProps[name] || (cssProps[name] = getVendorProp(name));
393
+ }
394
+
395
+ function applyCss(element, prop, value) {
396
+ prop = getStyleProp(prop);
397
+ element.style[prop] = value;
398
+ }
399
+
400
+ return function(element, properties) {
401
+ var args = arguments,
402
+ prop,
403
+ value;
404
+
405
+ if (args.length == 2) {
406
+ for (prop in properties) {
407
+ value = properties[prop];
408
+ if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
409
+ }
410
+ } else {
411
+ applyCss(element, args[1], args[2]);
412
+ }
413
+ }
414
+ })();
415
+
416
+ /**
417
+ * (Internal) Determines if an element or space separated list of class names contains a class name.
418
+ */
419
+
420
+ function hasClass(element, name) {
421
+ var list = typeof element == 'string' ? element : classList(element);
422
+ return list.indexOf(' ' + name + ' ') >= 0;
423
+ }
424
+
425
+ /**
426
+ * (Internal) Adds a class to an element.
427
+ */
428
+
429
+ function addClass(element, name) {
430
+ var oldList = classList(element),
431
+ newList = oldList + name;
432
+
433
+ if (hasClass(oldList, name)) return;
434
+
435
+ // Trim the opening space.
436
+ element.className = newList.substring(1);
437
+ }
438
+
439
+ /**
440
+ * (Internal) Removes a class from an element.
441
+ */
442
+
443
+ function removeClass(element, name) {
444
+ var oldList = classList(element),
445
+ newList;
446
+
447
+ if (!hasClass(element, name)) return;
448
+
449
+ // Replace the class name.
450
+ newList = oldList.replace(' ' + name + ' ', ' ');
451
+
452
+ // Trim the opening and closing spaces.
453
+ element.className = newList.substring(1, newList.length - 1);
454
+ }
455
+
456
+ /**
457
+ * (Internal) Gets a space separated list of the class names on the element.
458
+ * The list is wrapped with a single space on each end to facilitate finding
459
+ * matches within the list.
460
+ */
461
+
462
+ function classList(element) {
463
+ return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
464
+ }
465
+
466
+ /**
467
+ * (Internal) Removes an element from the DOM.
468
+ */
469
+
470
+ function removeElement(element) {
471
+ element && element.parentNode && element.parentNode.removeChild(element);
472
+ }
473
+
474
+ return NProgress;
475
+ });
476
+