yopass 2.2.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gemspec +4 -4
  3. data/Dockerfile +9 -14
  4. data/Gemfile +2 -1
  5. data/Gemfile.lock +3 -2
  6. data/README.md +41 -17
  7. data/lib/public/create-secret.html +32 -0
  8. data/lib/public/css/bootstrap.min.css +5 -0
  9. data/lib/public/display-secret.html +34 -0
  10. data/lib/public/fonts/glyphicons-halflings-regular.eot +0 -0
  11. data/lib/public/fonts/glyphicons-halflings-regular.svg +288 -0
  12. data/lib/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  13. data/lib/public/fonts/glyphicons-halflings-regular.woff +0 -0
  14. data/lib/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
  15. data/lib/public/index.html +49 -0
  16. data/lib/public/js/angular-route.min.js +15 -0
  17. data/lib/public/js/angular.js +250 -0
  18. data/lib/public/js/app.js +65 -0
  19. data/lib/yopass.rb +75 -80
  20. data/spec/yopass_spec.rb +22 -15
  21. metadata +25 -52
  22. data/CHANGELOG.md +0 -39
  23. data/Procfile +0 -1
  24. data/conf/config.ru +0 -3
  25. data/conf/yopass.yaml +0 -10
  26. data/lib/static/flash/clippy.swf +0 -0
  27. data/lib/static/js/jquery.address.js +0 -598
  28. data/lib/static/js/jquery.js +0 -8829
  29. data/lib/static/packaged/css/font.css +0 -36
  30. data/lib/static/packaged/css/semantic.css +0 -17804
  31. data/lib/static/packaged/css/semantic.min.css +0 -14
  32. data/lib/static/packaged/fonts/basic.icons.eot +0 -0
  33. data/lib/static/packaged/fonts/basic.icons.svg +0 -450
  34. data/lib/static/packaged/fonts/basic.icons.ttf +0 -0
  35. data/lib/static/packaged/fonts/basic.icons.woff +0 -0
  36. data/lib/static/packaged/fonts/icons.eot +0 -0
  37. data/lib/static/packaged/fonts/icons.otf +0 -0
  38. data/lib/static/packaged/fonts/icons.svg +0 -399
  39. data/lib/static/packaged/fonts/icons.ttf +0 -0
  40. data/lib/static/packaged/fonts/icons.woff +0 -0
  41. data/lib/static/packaged/fonts/sans/OpenSans-Bold.ttf +0 -0
  42. data/lib/static/packaged/fonts/sans/OpenSans-Light.ttf +0 -0
  43. data/lib/static/packaged/fonts/sans/OpenSans.ttf +0 -0
  44. data/lib/static/packaged/fonts/sans/OpenSansLight-Italic.ttf +0 -0
  45. data/lib/static/packaged/fonts/sans/SourceSansPro-Bold.ttf +0 -0
  46. data/lib/static/packaged/fonts/sans/SourceSansPro-Regular.ttf +0 -0
  47. data/lib/static/packaged/images/loader-large-inverted.gif +0 -0
  48. data/lib/static/packaged/images/loader-large.gif +0 -0
  49. data/lib/static/packaged/images/loader-medium-inverted.gif +0 -0
  50. data/lib/static/packaged/images/loader-medium.gif +0 -0
  51. data/lib/static/packaged/images/loader-mini-inverted.gif +0 -0
  52. data/lib/static/packaged/images/loader-mini.gif +0 -0
  53. data/lib/static/packaged/images/loader-small-inverted.gif +0 -0
  54. data/lib/static/packaged/images/loader-small.gif +0 -0
  55. data/lib/static/packaged/javascript/semantic.js +0 -11944
  56. data/lib/static/packaged/javascript/semantic.min.js +0 -16
  57. data/lib/static/yopass.css +0 -23
  58. data/lib/static/yopass.js +0 -23
  59. data/lib/views/404.erb +0 -43
  60. data/lib/views/footer.erb +0 -9
  61. data/lib/views/get_secret.erb +0 -31
  62. data/lib/views/header.erb +0 -27
  63. data/lib/views/index.erb +0 -117
  64. data/lib/views/secret_url.erb +0 -87
  65. data/yopass.god +0 -11
@@ -1,598 +0,0 @@
1
- /*! jQuery Address v1.6 | (c) 2009, 2013 Rostislav Hristov | jquery.org/license */
2
- (function ($) {
3
-
4
- $.address = (function () {
5
-
6
- var _trigger = function(name) {
7
- var e = $.extend($.Event(name), (function() {
8
- var parameters = {},
9
- parameterNames = $.address.parameterNames();
10
- for (var i = 0, l = parameterNames.length; i < l; i++) {
11
- parameters[parameterNames[i]] = $.address.parameter(parameterNames[i]);
12
- }
13
- return {
14
- value: $.address.value(),
15
- path: $.address.path(),
16
- pathNames: $.address.pathNames(),
17
- parameterNames: parameterNames,
18
- parameters: parameters,
19
- queryString: $.address.queryString()
20
- };
21
- }).call($.address));
22
- $($.address).trigger(e);
23
- return e;
24
- },
25
- _array = function(obj) {
26
- return Array.prototype.slice.call(obj);
27
- },
28
- _bind = function(value, data, fn) {
29
- $().bind.apply($($.address), Array.prototype.slice.call(arguments));
30
- return $.address;
31
- },
32
- _unbind = function(value, fn) {
33
- $().unbind.apply($($.address), Array.prototype.slice.call(arguments));
34
- return $.address;
35
- },
36
- _supportsState = function() {
37
- return (_h.pushState && _opts.state !== UNDEFINED);
38
- },
39
- _hrefState = function() {
40
- return ('/' + _l.pathname.replace(new RegExp(_opts.state), '') +
41
- _l.search + (_hrefHash() ? '#' + _hrefHash() : '')).replace(_re, '/');
42
- },
43
- _hrefHash = function() {
44
- var index = _l.href.indexOf('#');
45
- return index != -1 ? _l.href.substr(index + 1) : '';
46
- },
47
- _href = function() {
48
- return _supportsState() ? _hrefState() : _hrefHash();
49
- },
50
- _window = function() {
51
- try {
52
- return top.document !== UNDEFINED && top.document.title !== UNDEFINED ? top : window;
53
- } catch (e) {
54
- return window;
55
- }
56
- },
57
- _js = function() {
58
- return 'javascript';
59
- },
60
- _strict = function(value) {
61
- value = value.toString();
62
- return (_opts.strict && value.substr(0, 1) != '/' ? '/' : '') + value;
63
- },
64
- _cssint = function(el, value) {
65
- return parseInt(el.css(value), 10);
66
- },
67
- _listen = function() {
68
- if (!_silent) {
69
- var hash = _href(),
70
- diff = decodeURI(_value) != decodeURI(hash);
71
- if (diff) {
72
- if (_msie && _version < 7) {
73
- _l.reload();
74
- } else {
75
- if (_msie && !_hashchange && _opts.history) {
76
- _st(_html, 50);
77
- }
78
- _value = hash;
79
- _update(FALSE);
80
- }
81
- }
82
- }
83
- },
84
- _update = function(internal) {
85
- _st(_track, 10);
86
- return _trigger(CHANGE).isDefaultPrevented() ||
87
- _trigger(internal ? INTERNAL_CHANGE : EXTERNAL_CHANGE).isDefaultPrevented();
88
- },
89
- _track = function() {
90
- if (_opts.tracker !== 'null' && _opts.tracker !== NULL) {
91
- var fn = $.isFunction(_opts.tracker) ? _opts.tracker : _t[_opts.tracker],
92
- value = (_l.pathname + _l.search +
93
- ($.address && !_supportsState() ? $.address.value() : ''))
94
- .replace(/\/\//, '/').replace(/^\/$/, '');
95
- if ($.isFunction(fn)) {
96
- fn(value);
97
- } else if ($.isFunction(_t.urchinTracker)) {
98
- _t.urchinTracker(value);
99
- } else if (_t.pageTracker !== UNDEFINED && $.isFunction(_t.pageTracker._trackPageview)) {
100
- _t.pageTracker._trackPageview(value);
101
- } else if (_t._gaq !== UNDEFINED && $.isFunction(_t._gaq.push)) {
102
- _t._gaq.push(['_trackPageview', decodeURI(value)]);
103
- }
104
- }
105
- },
106
- _html = function() {
107
- var src = _js() + ':' + FALSE + ';document.open();document.writeln(\'<html><head><title>' +
108
- _d.title.replace(/\'/g, '\\\'') + '</title><script>var ' + ID + ' = "' + encodeURIComponent(_href()).replace(/\'/g, '\\\'') +
109
- (_d.domain != _l.hostname ? '";document.domain="' + _d.domain : '') +
110
- '";</' + 'script></head></html>\');document.close();';
111
- if (_version < 7) {
112
- _frame.src = src;
113
- } else {
114
- _frame.contentWindow.location.replace(src);
115
- }
116
- },
117
- _options = function() {
118
- if (_url && _qi != -1) {
119
- var i, param, params = _url.substr(_qi + 1).split('&');
120
- for (i = 0; i < params.length; i++) {
121
- param = params[i].split('=');
122
- if (/^(autoUpdate|history|strict|wrap)$/.test(param[0])) {
123
- _opts[param[0]] = (isNaN(param[1]) ? /^(true|yes)$/i.test(param[1]) : (parseInt(param[1], 10) !== 0));
124
- }
125
- if (/^(state|tracker)$/.test(param[0])) {
126
- _opts[param[0]] = param[1];
127
- }
128
- }
129
- _url = NULL;
130
- }
131
- _value = _href();
132
- },
133
- _load = function() {
134
- if (!_loaded) {
135
- _loaded = TRUE;
136
- _options();
137
- $('a[rel*="address:"]').address();
138
- if (_opts.wrap) {
139
- var body = $('body'),
140
- wrap = $('body > *')
141
- .wrapAll('<div style="padding:' +
142
- (_cssint(body, 'marginTop') + _cssint(body, 'paddingTop')) + 'px ' +
143
- (_cssint(body, 'marginRight') + _cssint(body, 'paddingRight')) + 'px ' +
144
- (_cssint(body, 'marginBottom') + _cssint(body, 'paddingBottom')) + 'px ' +
145
- (_cssint(body, 'marginLeft') + _cssint(body, 'paddingLeft')) + 'px;" />')
146
- .parent()
147
- .wrap('<div id="' + ID + '" style="height:100%;overflow:auto;position:relative;' +
148
- (_webkit && !window.statusbar.visible ? 'resize:both;' : '') + '" />');
149
- $('html, body')
150
- .css({
151
- height: '100%',
152
- margin: 0,
153
- padding: 0,
154
- overflow: 'hidden'
155
- });
156
- if (_webkit) {
157
- $('<style type="text/css" />')
158
- .appendTo('head')
159
- .text('#' + ID + '::-webkit-resizer { background-color: #fff; }');
160
- }
161
- }
162
- if (_msie && !_hashchange) {
163
- var frameset = _d.getElementsByTagName('frameset')[0];
164
- _frame = _d.createElement((frameset ? '' : 'i') + 'frame');
165
- _frame.src = _js() + ':' + FALSE;
166
- if (frameset) {
167
- frameset.insertAdjacentElement('beforeEnd', _frame);
168
- frameset[frameset.cols ? 'cols' : 'rows'] += ',0';
169
- _frame.noResize = TRUE;
170
- _frame.frameBorder = _frame.frameSpacing = 0;
171
- } else {
172
- _frame.style.display = 'none';
173
- _frame.style.width = _frame.style.height = 0;
174
- _frame.tabIndex = -1;
175
- _d.body.insertAdjacentElement('afterBegin', _frame);
176
- }
177
- _st(function() {
178
- $(_frame).bind('load', function() {
179
- var win = _frame.contentWindow;
180
- _value = win[ID] !== UNDEFINED ? win[ID] : '';
181
- if (_value != _href()) {
182
- _update(FALSE);
183
- _l.hash = _value;
184
- }
185
- });
186
- if (_frame.contentWindow[ID] === UNDEFINED) {
187
- _html();
188
- }
189
- }, 50);
190
- }
191
- _st(function() {
192
- _trigger('init');
193
- _update(FALSE);
194
- }, 1);
195
- if (!_supportsState()) {
196
- if ((_msie && _version > 7) || (!_msie && _hashchange)) {
197
- if (_t.addEventListener) {
198
- _t.addEventListener(HASH_CHANGE, _listen, FALSE);
199
- } else if (_t.attachEvent) {
200
- _t.attachEvent('on' + HASH_CHANGE, _listen);
201
- }
202
- } else {
203
- _si(_listen, 50);
204
- }
205
- }
206
- if ('state' in window.history) {
207
- $(window).trigger('popstate');
208
- }
209
- }
210
- },
211
- _popstate = function() {
212
- if (decodeURI(_value) != decodeURI(_href())) {
213
- _value = _href();
214
- _update(FALSE);
215
- }
216
- },
217
- _unload = function() {
218
- if (_t.removeEventListener) {
219
- _t.removeEventListener(HASH_CHANGE, _listen, FALSE);
220
- } else if (_t.detachEvent) {
221
- _t.detachEvent('on' + HASH_CHANGE, _listen);
222
- }
223
- },
224
- _uaMatch = function(ua) {
225
- ua = ua.toLowerCase();
226
- var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
227
- /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
228
- /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
229
- /(msie) ([\w.]+)/.exec( ua ) ||
230
- ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
231
- [];
232
- return {
233
- browser: match[ 1 ] || '',
234
- version: match[ 2 ] || '0'
235
- };
236
- },
237
- _detectBrowser = function() {
238
- var browser = {},
239
- matched = _uaMatch(navigator.userAgent);
240
- if (matched.browser) {
241
- browser[matched.browser] = true;
242
- browser.version = matched.version;
243
- }
244
- if (browser.chrome) {
245
- browser.webkit = true;
246
- } else if (browser.webkit) {
247
- browser.safari = true;
248
- }
249
- return browser;
250
- },
251
- UNDEFINED,
252
- NULL = null,
253
- ID = 'jQueryAddress',
254
- STRING = 'string',
255
- HASH_CHANGE = 'hashchange',
256
- INIT = 'init',
257
- CHANGE = 'change',
258
- INTERNAL_CHANGE = 'internalChange',
259
- EXTERNAL_CHANGE = 'externalChange',
260
- TRUE = true,
261
- FALSE = false,
262
- _opts = {
263
- autoUpdate: TRUE,
264
- history: TRUE,
265
- strict: TRUE,
266
- wrap: FALSE
267
- },
268
- _browser = _detectBrowser(),
269
- _version = parseFloat(_browser.version),
270
- _webkit = _browser.webkit || _browser.safari,
271
- _msie = !$.support.opacity,
272
- _t = _window(),
273
- _d = _t.document,
274
- _h = _t.history,
275
- _l = _t.location,
276
- _si = setInterval,
277
- _st = setTimeout,
278
- _re = /\/{2,9}/g,
279
- _agent = navigator.userAgent,
280
- _hashchange = 'on' + HASH_CHANGE in _t,
281
- _frame,
282
- _form,
283
- _url = $('script:last').attr('src'),
284
- _qi = _url ? _url.indexOf('?') : -1,
285
- _title = _d.title,
286
- _silent = FALSE,
287
- _loaded = FALSE,
288
- _juststart = TRUE,
289
- _updating = FALSE,
290
- _listeners = {},
291
- _value = _href();
292
-
293
- if (_msie) {
294
- _version = parseFloat(_agent.substr(_agent.indexOf('MSIE') + 4));
295
- if (_d.documentMode && _d.documentMode != _version) {
296
- _version = _d.documentMode != 8 ? 7 : 8;
297
- }
298
- var pc = _d.onpropertychange;
299
- _d.onpropertychange = function() {
300
- if (pc) {
301
- pc.call(_d);
302
- }
303
- if (_d.title != _title && _d.title.indexOf('#' + _href()) != -1) {
304
- _d.title = _title;
305
- }
306
- };
307
- }
308
-
309
- if (_h.navigationMode) {
310
- _h.navigationMode = 'compatible';
311
- }
312
- if (document.readyState == 'complete') {
313
- var interval = setInterval(function() {
314
- if ($.address) {
315
- _load();
316
- clearInterval(interval);
317
- }
318
- }, 50);
319
- } else {
320
- _options();
321
- $(_load);
322
- }
323
- $(window).bind('popstate', _popstate).bind('unload', _unload);
324
-
325
- return {
326
- bind: function(type, data, fn) {
327
- return _bind.apply(this, _array(arguments));
328
- },
329
- unbind: function(type, fn) {
330
- return _unbind.apply(this, _array(arguments));
331
- },
332
- init: function(data, fn) {
333
- return _bind.apply(this, [INIT].concat(_array(arguments)));
334
- },
335
- change: function(data, fn) {
336
- return _bind.apply(this, [CHANGE].concat(_array(arguments)));
337
- },
338
- internalChange: function(data, fn) {
339
- return _bind.apply(this, [INTERNAL_CHANGE].concat(_array(arguments)));
340
- },
341
- externalChange: function(data, fn) {
342
- return _bind.apply(this, [EXTERNAL_CHANGE].concat(_array(arguments)));
343
- },
344
- baseURL: function() {
345
- var url = _l.href;
346
- if (url.indexOf('#') != -1) {
347
- url = url.substr(0, url.indexOf('#'));
348
- }
349
- if (/\/$/.test(url)) {
350
- url = url.substr(0, url.length - 1);
351
- }
352
- return url;
353
- },
354
- autoUpdate: function(value) {
355
- if (value !== UNDEFINED) {
356
- _opts.autoUpdate = value;
357
- return this;
358
- }
359
- return _opts.autoUpdate;
360
- },
361
- history: function(value) {
362
- if (value !== UNDEFINED) {
363
- _opts.history = value;
364
- return this;
365
- }
366
- return _opts.history;
367
- },
368
- state: function(value) {
369
- if (value !== UNDEFINED) {
370
- _opts.state = value;
371
- var hrefState = _hrefState();
372
- if (_opts.state !== UNDEFINED) {
373
- if (_h.pushState) {
374
- if (hrefState.substr(0, 3) == '/#/') {
375
- _l.replace(_opts.state.replace(/^\/$/, '') + hrefState.substr(2));
376
- }
377
- } else if (hrefState != '/' && hrefState.replace(/^\/#/, '') != _hrefHash()) {
378
- _st(function() {
379
- _l.replace(_opts.state.replace(/^\/$/, '') + '/#' + hrefState);
380
- }, 1);
381
- }
382
- }
383
- return this;
384
- }
385
- return _opts.state;
386
- },
387
- strict: function(value) {
388
- if (value !== UNDEFINED) {
389
- _opts.strict = value;
390
- return this;
391
- }
392
- return _opts.strict;
393
- },
394
- tracker: function(value) {
395
- if (value !== UNDEFINED) {
396
- _opts.tracker = value;
397
- return this;
398
- }
399
- return _opts.tracker;
400
- },
401
- wrap: function(value) {
402
- if (value !== UNDEFINED) {
403
- _opts.wrap = value;
404
- return this;
405
- }
406
- return _opts.wrap;
407
- },
408
- update: function() {
409
- _updating = TRUE;
410
- this.value(_value);
411
- _updating = FALSE;
412
- return this;
413
- },
414
- title: function(value) {
415
- if (value !== UNDEFINED) {
416
- _st(function() {
417
- _title = _d.title = value;
418
- if (_juststart && _frame && _frame.contentWindow && _frame.contentWindow.document) {
419
- _frame.contentWindow.document.title = value;
420
- _juststart = FALSE;
421
- }
422
- }, 50);
423
- return this;
424
- }
425
- return _d.title;
426
- },
427
- value: function(value) {
428
- if (value !== UNDEFINED) {
429
- value = _strict(value);
430
- if (value == '/') {
431
- value = '';
432
- }
433
- if (_value == value && !_updating) {
434
- return;
435
- }
436
- _value = value;
437
- if (_opts.autoUpdate || _updating) {
438
- if (_update(TRUE)) {
439
- return this;
440
- }
441
- if (_supportsState()) {
442
- _h[_opts.history ? 'pushState' : 'replaceState']({}, '',
443
- _opts.state.replace(/\/$/, '') + (_value === '' ? '/' : _value));
444
- } else {
445
- _silent = TRUE;
446
- if (_webkit) {
447
- if (_opts.history) {
448
- _l.hash = '#' + _value;
449
- } else {
450
- _l.replace('#' + _value);
451
- }
452
- } else if (_value != _href()) {
453
- if (_opts.history) {
454
- _l.hash = '#' + _value;
455
- } else {
456
- _l.replace('#' + _value);
457
- }
458
- }
459
- if ((_msie && !_hashchange) && _opts.history) {
460
- _st(_html, 50);
461
- }
462
- if (_webkit) {
463
- _st(function(){ _silent = FALSE; }, 1);
464
- } else {
465
- _silent = FALSE;
466
- }
467
- }
468
- }
469
- return this;
470
- }
471
- return _strict(_value);
472
- },
473
- path: function(value) {
474
- if (value !== UNDEFINED) {
475
- var qs = this.queryString(),
476
- hash = this.hash();
477
- this.value(value + (qs ? '?' + qs : '') + (hash ? '#' + hash : ''));
478
- return this;
479
- }
480
- return _strict(_value).split('#')[0].split('?')[0];
481
- },
482
- pathNames: function() {
483
- var path = this.path(),
484
- names = path.replace(_re, '/').split('/');
485
- if (path.substr(0, 1) == '/' || path.length === 0) {
486
- names.splice(0, 1);
487
- }
488
- if (path.substr(path.length - 1, 1) == '/') {
489
- names.splice(names.length - 1, 1);
490
- }
491
- return names;
492
- },
493
- queryString: function(value) {
494
- if (value !== UNDEFINED) {
495
- var hash = this.hash();
496
- this.value(this.path() + (value ? '?' + value : '') + (hash ? '#' + hash : ''));
497
- return this;
498
- }
499
- var arr = _value.split('?');
500
- return arr.slice(1, arr.length).join('?').split('#')[0];
501
- },
502
- parameter: function(name, value, append) {
503
- var i, params;
504
- if (value !== UNDEFINED) {
505
- var names = this.parameterNames();
506
- params = [];
507
- value = value === UNDEFINED || value === NULL ? '' : value.toString();
508
- for (i = 0; i < names.length; i++) {
509
- var n = names[i],
510
- v = this.parameter(n);
511
- if (typeof v == STRING) {
512
- v = [v];
513
- }
514
- if (n == name) {
515
- v = (value === NULL || value === '') ? [] :
516
- (append ? v.concat([value]) : [value]);
517
- }
518
- for (var j = 0; j < v.length; j++) {
519
- params.push(n + '=' + v[j]);
520
- }
521
- }
522
- if ($.inArray(name, names) == -1 && value !== NULL && value !== '') {
523
- params.push(name + '=' + value);
524
- }
525
- this.queryString(params.join('&'));
526
- return this;
527
- }
528
- value = this.queryString();
529
- if (value) {
530
- var r = [];
531
- params = value.split('&');
532
- for (i = 0; i < params.length; i++) {
533
- var p = params[i].split('=');
534
- if (p[0] == name) {
535
- r.push(p.slice(1).join('='));
536
- }
537
- }
538
- if (r.length !== 0) {
539
- return r.length != 1 ? r : r[0];
540
- }
541
- }
542
- },
543
- parameterNames: function() {
544
- var qs = this.queryString(),
545
- names = [];
546
- if (qs && qs.indexOf('=') != -1) {
547
- var params = qs.split('&');
548
- for (var i = 0; i < params.length; i++) {
549
- var name = params[i].split('=')[0];
550
- if ($.inArray(name, names) == -1) {
551
- names.push(name);
552
- }
553
- }
554
- }
555
- return names;
556
- },
557
- hash: function(value) {
558
- if (value !== UNDEFINED) {
559
- this.value(_value.split('#')[0] + (value ? '#' + value : ''));
560
- return this;
561
- }
562
- var arr = _value.split('#');
563
- return arr.slice(1, arr.length).join('#');
564
- }
565
- };
566
- })();
567
-
568
- $.fn.address = function(fn) {
569
- if (!this.data('address')) {
570
- this.on('click', function(e) {
571
- if (e.shiftKey || e.ctrlKey || e.metaKey || e.which == 2) {
572
- return true;
573
- }
574
- var target = e.currentTarget;
575
- if ($(target).is('a')) {
576
- e.preventDefault();
577
- var value = fn ? fn.call(target) :
578
- /address:/.test($(target).attr('rel')) ? $(target).attr('rel').split('address:')[1].split(' ')[0] :
579
- $.address.state() !== undefined && !/^\/?$/.test($.address.state()) ?
580
- $(target).attr('href').replace(new RegExp('^(.*' + $.address.state() + '|\\.)'), '') :
581
- $(target).attr('href').replace(/^(#\!?|\.)/, '');
582
- $.address.value(value);
583
- }
584
- }).on('submit', function(e) {
585
- var target = e.currentTarget;
586
- if ($(target).is('form')) {
587
- e.preventDefault();
588
- var action = $(target).attr('action'),
589
- value = fn ? fn.call(target) : (action.indexOf('?') != -1 ? action.replace(/&$/, '') : action + '?') +
590
- $(target).serialize();
591
- $.address.value(value);
592
- }
593
- }).data('address', true);
594
- }
595
- return this;
596
- };
597
-
598
- })(jQuery);