selbackup 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.fr.md +12 -2
- data/README.md +12 -2
- data/Rakefile +17 -10
- data/selbackup.gemspec +1 -1
- metadata +1 -35
- data/doc/apple-touch-icon.png +0 -0
- data/doc/classes/Object.html +0 -121
- data/doc/classes/SelBackup.html +0 -1387
- data/doc/created.rid +0 -6
- data/doc/css/github.css +0 -129
- data/doc/css/main.css +0 -333
- data/doc/css/panel.css +0 -384
- data/doc/css/reset.css +0 -48
- data/doc/favicon.ico +0 -0
- data/doc/files/Gemfile.html +0 -84
- data/doc/files/Guardfile.html +0 -147
- data/doc/files/LICENSE.html +0 -86
- data/doc/files/Rakefile.html +0 -101
- data/doc/files/backup-to-s3_rb.html +0 -85
- data/doc/files/lib/selbackup_rb.html +0 -89
- data/doc/files/lib-backup_rb.html +0 -89
- data/doc/files/mv_files_rb.html +0 -89
- data/doc/files/spec/selbackup_spec_rb.html +0 -76
- data/doc/files/test/lib-backup_test_rb.html +0 -76
- data/doc/i/arrows.png +0 -0
- data/doc/i/results_bg.png +0 -0
- data/doc/i/tree_bg.png +0 -0
- data/doc/index.html +0 -13
- data/doc/js/highlight.pack.js +0 -1
- data/doc/js/jquery-1.3.2.min.js +0 -19
- data/doc/js/jquery-effect.js +0 -593
- data/doc/js/main.js +0 -24
- data/doc/js/navigation.js +0 -142
- data/doc/js/search_index.js +0 -1
- data/doc/js/searchdoc.js +0 -449
- data/doc/js/searcher.js +0 -228
- data/doc/panel/index.html +0 -73
- data/doc/panel/links.html +0 -16
- data/doc/panel/tree.js +0 -1
data/doc/js/navigation.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Navigation allows movement using the arrow keys through the search results.
|
|
3
|
-
*
|
|
4
|
-
* When using this library you will need to set scrollIntoView to the
|
|
5
|
-
* appropriate function for your layout. Use scrollInWindow if the container
|
|
6
|
-
* is not scrollable and scrollInElement if the container is a separate
|
|
7
|
-
* scrolling region.
|
|
8
|
-
*/
|
|
9
|
-
Navigation = new function() {
|
|
10
|
-
this.initNavigation = function() {
|
|
11
|
-
var _this = this;
|
|
12
|
-
|
|
13
|
-
$(document).keydown(function(e) {
|
|
14
|
-
_this.onkeydown(e);
|
|
15
|
-
}).keyup(function(e) {
|
|
16
|
-
_this.onkeyup(e);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
this.navigationActive = true;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
this.setNavigationActive = function(state) {
|
|
23
|
-
this.navigationActive = state;
|
|
24
|
-
this.clearMoveTimeout();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this.onkeyup = function(e) {
|
|
28
|
-
if (!this.navigationActive) return;
|
|
29
|
-
|
|
30
|
-
switch(e.keyCode) {
|
|
31
|
-
case 37: //Event.KEY_LEFT:
|
|
32
|
-
case 38: //Event.KEY_UP:
|
|
33
|
-
case 39: //Event.KEY_RIGHT:
|
|
34
|
-
case 40: //Event.KEY_DOWN:
|
|
35
|
-
this.clearMoveTimeout();
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
this.onkeydown = function(e) {
|
|
41
|
-
if (!this.navigationActive) return;
|
|
42
|
-
switch(e.keyCode) {
|
|
43
|
-
case 37: //Event.KEY_LEFT:
|
|
44
|
-
if (this.moveLeft()) e.preventDefault();
|
|
45
|
-
break;
|
|
46
|
-
case 38: //Event.KEY_UP:
|
|
47
|
-
if (e.keyCode == 38 || e.ctrlKey) {
|
|
48
|
-
if (this.moveUp()) e.preventDefault();
|
|
49
|
-
this.startMoveTimeout(false);
|
|
50
|
-
}
|
|
51
|
-
break;
|
|
52
|
-
case 39: //Event.KEY_RIGHT:
|
|
53
|
-
if (this.moveRight()) e.preventDefault();
|
|
54
|
-
break;
|
|
55
|
-
case 40: //Event.KEY_DOWN:
|
|
56
|
-
if (e.keyCode == 40 || e.ctrlKey) {
|
|
57
|
-
if (this.moveDown()) e.preventDefault();
|
|
58
|
-
this.startMoveTimeout(true);
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
case 13: //Event.KEY_RETURN:
|
|
62
|
-
if (this.$current)
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
this.select(this.$current);
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
if (e.ctrlKey && e.shiftKey) this.select(this.$current);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
this.clearMoveTimeout = function() {
|
|
71
|
-
clearTimeout(this.moveTimeout);
|
|
72
|
-
this.moveTimeout = null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
this.startMoveTimeout = function(isDown) {
|
|
76
|
-
if (!$.browser.mozilla && !$.browser.opera) return;
|
|
77
|
-
if (this.moveTimeout) this.clearMoveTimeout();
|
|
78
|
-
var _this = this;
|
|
79
|
-
|
|
80
|
-
var go = function() {
|
|
81
|
-
if (!_this.moveTimeout) return;
|
|
82
|
-
_this[isDown ? 'moveDown' : 'moveUp']();
|
|
83
|
-
_this.moveTimout = setTimeout(go, 100);
|
|
84
|
-
}
|
|
85
|
-
this.moveTimeout = setTimeout(go, 200);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
this.moveRight = function() {
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
this.moveLeft = function() {
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this.move = function(isDown) {
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
this.moveUp = function() {
|
|
98
|
-
return this.move(false);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
this.moveDown = function() {
|
|
102
|
-
return this.move(true);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/*
|
|
106
|
-
* Scrolls to the given element in the scrollable element view.
|
|
107
|
-
*/
|
|
108
|
-
this.scrollInElement = function(element, view) {
|
|
109
|
-
var offset, viewHeight, viewScroll, height;
|
|
110
|
-
offset = element.offsetTop;
|
|
111
|
-
height = element.offsetHeight;
|
|
112
|
-
viewHeight = view.offsetHeight;
|
|
113
|
-
viewScroll = view.scrollTop;
|
|
114
|
-
|
|
115
|
-
if (offset - viewScroll + height > viewHeight) {
|
|
116
|
-
view.scrollTop = offset - viewHeight + height;
|
|
117
|
-
}
|
|
118
|
-
if (offset < viewScroll) {
|
|
119
|
-
view.scrollTop = offset;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/*
|
|
124
|
-
* Scrolls to the given element in the window. The second argument is
|
|
125
|
-
* ignored
|
|
126
|
-
*/
|
|
127
|
-
this.scrollInWindow = function(element, ignored) {
|
|
128
|
-
var offset, viewHeight, viewScroll, height;
|
|
129
|
-
offset = element.offsetTop;
|
|
130
|
-
height = element.offsetHeight;
|
|
131
|
-
viewHeight = window.innerHeight;
|
|
132
|
-
viewScroll = window.scrollY;
|
|
133
|
-
|
|
134
|
-
if (offset - viewScroll + height > viewHeight) {
|
|
135
|
-
window.scrollTo(window.scrollX, offset - viewHeight + height);
|
|
136
|
-
}
|
|
137
|
-
if (offset < viewScroll) {
|
|
138
|
-
window.scrollTo(window.scrollX, offset);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
data/doc/js/search_index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var search_data = {"index":{"searchIndex":["selbackup","bucket()","check_daily()","check_monthly()","check_weekly()","connection()","daily_good?()","delete_file()","directory()","files()","gen_daily_file()","gen_monthly_file()","gen_weekly_file()","give_me_files()","give_me_latest_file()","give_me_recent_file()","monthly_good?()","new()","push_file()","should_monthly?()","should_weekly?()","upload_file()","weekly_good?()","gemfile","license","rakefile"],"longSearchIndex":["selbackup","selbackup#bucket()","selbackup#check_daily()","selbackup#check_monthly()","selbackup#check_weekly()","selbackup#connection()","selbackup#daily_good?()","selbackup#delete_file()","selbackup#directory()","selbackup#files()","selbackup#gen_daily_file()","selbackup#gen_monthly_file()","selbackup#gen_weekly_file()","selbackup#give_me_files()","selbackup#give_me_latest_file()","selbackup#give_me_recent_file()","selbackup#monthly_good?()","selbackup::new()","selbackup#push_file()","selbackup#should_monthly?()","selbackup#should_weekly?()","selbackup#upload_file()","selbackup#weekly_good?()","","",""],"info":[["SelBackup","","classes/SelBackup.html","","<p>SelBackup Class\n<p>Enables connection to s3 server and uploads files\n"],["bucket","SelBackup","classes/SelBackup.html#method-i-bucket","()","<p>Public: Returns the S3 bucket.\n<p>Returns a Fog::Storage::AWS::Directory instance.\n"],["check_daily","SelBackup","classes/SelBackup.html#method-i-check_daily","(filename, nb_day)","<p>Public: daily check algorythm\n<p>filename — String which contains a filename. If you upload '2013-01-01-file.tgz …\n\n"],["check_monthly","SelBackup","classes/SelBackup.html#method-i-check_monthly","(filename, nb_month)","<p>Public: montlhy check algorythm\n<p>filename — String which contains a filename. If you upload '2013-01-01-file.tgz …\n\n"],["check_weekly","SelBackup","classes/SelBackup.html#method-i-check_weekly","(filename, nb_week)","<p>Public: weekly check algorythm\n<p>filename — String which contains a filename. If you upload '2013-01-01-file.tgz …\n\n"],["connection","SelBackup","classes/SelBackup.html#method-i-connection","()","<p>Public: Returns the S3 connection.\n<p>Returns a Fog::Storage::AWS::Real instance.\n"],["daily_good?","SelBackup","classes/SelBackup.html#method-i-daily_good-3F","(directoryFiles, nb_day)","<p>Public: Check daily files number\n<p>directoryFiles — Array of daily files\n\n\n<pre>['file/2013-01-01-daily-file.tgz', ...</pre>\n"],["delete_file","SelBackup","classes/SelBackup.html#method-i-delete_file","(file)","<p>Public: deletes a file\n<p>file — Fog::Storage::AWS::Files file\n\n<p>returns nothing\n"],["directory","SelBackup","classes/SelBackup.html#method-i-directory","(path)","<p>Public: Returns a virtual S3 directory.\n<p>S3 doesn't know such a thing as a directory but it is possible …\n"],["files","SelBackup","classes/SelBackup.html#method-i-files","()","<p>Public: Returns the list of files.\n<p>Returns a Fog::Storage::AWS::Files instances.\n"],["gen_daily_file","SelBackup","classes/SelBackup.html#method-i-gen_daily_file","(file)","<p>Public: gen a daily file\n<p>file — file you want to upload\n\n<p>Returns an hash containing the filename, the key …\n"],["gen_monthly_file","SelBackup","classes/SelBackup.html#method-i-gen_monthly_file","(file)","<p>Public: gen a monthly file\n<p>file — hash containing the key and the body of the weekly file you want to push …\n\n"],["gen_weekly_file","SelBackup","classes/SelBackup.html#method-i-gen_weekly_file","(file)","<p>Public: gen a weekly file\n<p>file — hash containing the key and the body of the daily file you want to push …\n\n"],["give_me_files","SelBackup","classes/SelBackup.html#method-i-give_me_files","(filename, type)","<p>Public: returns lists of file\n<p>filename: “file.tgz” for example\n<p>type: specify if you want daily, …\n"],["give_me_latest_file","SelBackup","classes/SelBackup.html#method-i-give_me_latest_file","(files)","<p>Public: returns latest file\n<p>files: array of AWS object file\n<p>Returns the latest file, based on the date …\n"],["give_me_recent_file","SelBackup","classes/SelBackup.html#method-i-give_me_recent_file","(files)","<p>Public: returns most recent file\n<p>files: array of AWS object file\n<p>Returns the most recent file, based on …\n"],["monthly_good?","SelBackup","classes/SelBackup.html#method-i-monthly_good-3F","(files, nb_month)","<p>Public: Check monthly files number\n<p>files — Array of monthly files\n\n\n<pre>['file/2013-01-01-monthly-file.tgz', 'file/2013-01-02-monthly-file.tgz', ...</pre>\n"],["new","SelBackup","classes/SelBackup.html#method-c-new","(key, secret, bucket, region = 'eu-west-1')","<p>Public: Initialize a new SelBackup instance.\n<p>key — A String representing the AWS ACCESS KEY ID.\n<p>secret — A …\n"],["push_file","SelBackup","classes/SelBackup.html#method-i-push_file","(file)","<p>Public: pushes a file to s3 server\n<p>file — hash containing the key and the body of the file you want to upload …\n\n"],["should_monthly?","SelBackup","classes/SelBackup.html#method-i-should_monthly-3F","(file1, file2)","<p>Public: date diff\n<p>file1 — latest weekly file\n<p>file2 — most recent monthly file\n"],["should_weekly?","SelBackup","classes/SelBackup.html#method-i-should_weekly-3F","(file1, file2)","<p>Public: date diff\n<p>file1 — latest daily file\n<p>file2 — most recent weekly file\n"],["upload_file","SelBackup","classes/SelBackup.html#method-i-upload_file","(file, nb_day = 7, nb_week = 4, nb_month = 3)","<p>Public: upload file algorythm\n<p>file — file you want to upload\n\n<p>Uploads file as daily file and check daily, …\n"],["weekly_good?","SelBackup","classes/SelBackup.html#method-i-weekly_good-3F","(directoryFiles, nb_week)","<p>Public: Check weekly files number\n<p>files — Array of daily files\n\n\n<pre>['file/2013-01-01-weekly-file.tgz', 'file/013-01-02-weekly-2file.tgz', ...</pre>\n"],["Gemfile","","files/Gemfile.html","","<p>source 'rubygems.org'\n<p>gem 'active_support' gem 'fog' gem 'i18n' gem\n'rake' …\n"],["LICENSE","","files/LICENSE.html","","\n<pre>DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\n Version 2, December 2004</pre>\n<p>Copyright (C) 2004 Sam Hocevar …\n"],["Rakefile","","files/Rakefile.html","","<p>require 'rspec/core/rake_task' require './lib/selbackup.rb'\n<p>RSpec::Core::RakeTask.new …\n"]]}}
|
data/doc/js/searchdoc.js
DELETED
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
Searchdoc = {};
|
|
2
|
-
|
|
3
|
-
// navigation.js ------------------------------------------
|
|
4
|
-
|
|
5
|
-
Searchdoc.Navigation = new function() {
|
|
6
|
-
this.initNavigation = function() {
|
|
7
|
-
var _this = this;
|
|
8
|
-
|
|
9
|
-
$(document).keydown(function(e) {
|
|
10
|
-
_this.onkeydown(e);
|
|
11
|
-
}).keyup(function(e) {
|
|
12
|
-
_this.onkeyup(e);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
this.navigationActive = true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
this.setNavigationActive = function(state) {
|
|
19
|
-
this.navigationActive = state;
|
|
20
|
-
this.clearMoveTimeout();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.onkeyup = function(e) {
|
|
25
|
-
if (!this.navigationActive) return;
|
|
26
|
-
switch(e.keyCode) {
|
|
27
|
-
case 37: //Event.KEY_LEFT:
|
|
28
|
-
case 38: //Event.KEY_UP:
|
|
29
|
-
case 39: //Event.KEY_RIGHT:
|
|
30
|
-
case 40: //Event.KEY_DOWN:
|
|
31
|
-
case 73: // i - qwerty
|
|
32
|
-
case 74: // j
|
|
33
|
-
case 75: // k
|
|
34
|
-
case 76: // l
|
|
35
|
-
case 67: // c - dvorak
|
|
36
|
-
case 72: // h
|
|
37
|
-
case 84: // t
|
|
38
|
-
case 78: // n
|
|
39
|
-
this.clearMoveTimeout();
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.onkeydown = function(e) {
|
|
45
|
-
if (!this.navigationActive) return;
|
|
46
|
-
switch(e.keyCode) {
|
|
47
|
-
case 37: //Event.KEY_LEFT:
|
|
48
|
-
case 74: // j (qwerty)
|
|
49
|
-
case 72: // h (dvorak)
|
|
50
|
-
if (this.moveLeft()) e.preventDefault();
|
|
51
|
-
break;
|
|
52
|
-
case 38: //Event.KEY_UP:
|
|
53
|
-
case 73: // i (qwerty)
|
|
54
|
-
case 67: // c (dvorak)
|
|
55
|
-
if (e.keyCode == 38 || e.ctrlKey) {
|
|
56
|
-
if (this.moveUp()) e.preventDefault();
|
|
57
|
-
this.startMoveTimeout(false);
|
|
58
|
-
}
|
|
59
|
-
break;
|
|
60
|
-
case 39: //Event.KEY_RIGHT:
|
|
61
|
-
case 76: // l (qwerty)
|
|
62
|
-
case 78: // n (dvorak)
|
|
63
|
-
if (this.moveRight()) e.preventDefault();
|
|
64
|
-
break;
|
|
65
|
-
case 40: //Event.KEY_DOWN:
|
|
66
|
-
case 75: // k (qwerty)
|
|
67
|
-
case 84: // t (dvorak)
|
|
68
|
-
if (e.keyCode == 40 || e.ctrlKey) {
|
|
69
|
-
if (this.moveDown()) e.preventDefault();
|
|
70
|
-
this.startMoveTimeout(true);
|
|
71
|
-
}
|
|
72
|
-
break;
|
|
73
|
-
case 9: //Event.KEY_TAB:
|
|
74
|
-
case 13: //Event.KEY_RETURN:
|
|
75
|
-
if (this.$current) this.select(this.$current);
|
|
76
|
-
break;
|
|
77
|
-
case 83: // s (qwerty)
|
|
78
|
-
case 79: // o (dvorak)
|
|
79
|
-
if (e.ctrlKey) {
|
|
80
|
-
$('#search').focus();
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
if (e.ctrlKey && e.shiftKey) this.select(this.$current);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
this.clearMoveTimeout = function() {
|
|
89
|
-
clearTimeout(this.moveTimeout);
|
|
90
|
-
this.moveTimeout = null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
this.startMoveTimeout = function(isDown) {
|
|
94
|
-
if (!$.browser.mozilla && !$.browser.opera) return;
|
|
95
|
-
if (this.moveTimeout) this.clearMoveTimeout();
|
|
96
|
-
var _this = this;
|
|
97
|
-
|
|
98
|
-
var go = function() {
|
|
99
|
-
if (!_this.moveTimeout) return;
|
|
100
|
-
_this[isDown ? 'moveDown' : 'moveUp']();
|
|
101
|
-
_this.moveTimout = setTimeout(go, 100);
|
|
102
|
-
}
|
|
103
|
-
this.moveTimeout = setTimeout(go, 200);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
this.moveRight = function() {
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
this.moveLeft = function() {
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
this.move = function(isDown) {
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
this.moveUp = function() {
|
|
116
|
-
return this.move(false);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
this.moveDown = function() {
|
|
120
|
-
return this.move(true);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
// scrollIntoView.js --------------------------------------
|
|
126
|
-
|
|
127
|
-
function scrollIntoView(element, view) {
|
|
128
|
-
var offset, viewHeight, viewScroll, height;
|
|
129
|
-
offset = element.offsetTop;
|
|
130
|
-
height = element.offsetHeight;
|
|
131
|
-
viewHeight = view.offsetHeight;
|
|
132
|
-
viewScroll = view.scrollTop;
|
|
133
|
-
if (offset - viewScroll + height > viewHeight) {
|
|
134
|
-
view.scrollTop = offset - viewHeight + height;
|
|
135
|
-
}
|
|
136
|
-
if (offset < viewScroll) {
|
|
137
|
-
view.scrollTop = offset;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// panel.js -----------------------------------------------
|
|
142
|
-
|
|
143
|
-
Searchdoc.Panel = function(element, data, tree, frame) {
|
|
144
|
-
this.$element = $(element);
|
|
145
|
-
this.$input = $('input', element).eq(0);
|
|
146
|
-
this.$result = $('.result ul', element).eq(0);
|
|
147
|
-
this.frame = frame;
|
|
148
|
-
this.$current = null;
|
|
149
|
-
this.$view = this.$result.parent();
|
|
150
|
-
this.data = data;
|
|
151
|
-
this.searcher = new Searcher(data.index);
|
|
152
|
-
|
|
153
|
-
this.tree = new Searchdoc.Tree($('.tree', element), tree, this);
|
|
154
|
-
this.init();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
|
|
158
|
-
var suid = 1;
|
|
159
|
-
|
|
160
|
-
this.init = function() {
|
|
161
|
-
var _this = this;
|
|
162
|
-
var observer = function() {
|
|
163
|
-
_this.search(_this.$input[0].value);
|
|
164
|
-
};
|
|
165
|
-
this.$input.keyup(observer);
|
|
166
|
-
this.$input.click(observer); // mac's clear field
|
|
167
|
-
|
|
168
|
-
this.searcher.ready(function(results, isLast) {
|
|
169
|
-
_this.addResults(results, isLast);
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
this.$result.click(function(e) {
|
|
173
|
-
_this.$current.removeClass('current');
|
|
174
|
-
_this.$current = $(e.target).closest('li').addClass('current');
|
|
175
|
-
_this.select();
|
|
176
|
-
_this.$input.focus();
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
this.initNavigation();
|
|
180
|
-
this.setNavigationActive(false);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
this.search = function(value, selectFirstMatch) {
|
|
184
|
-
value = jQuery.trim(value).toLowerCase();
|
|
185
|
-
this.selectFirstMatch = selectFirstMatch;
|
|
186
|
-
if (value) {
|
|
187
|
-
this.$element.removeClass('panel_tree').addClass('panel_results');
|
|
188
|
-
this.tree.setNavigationActive(false);
|
|
189
|
-
this.setNavigationActive(true);
|
|
190
|
-
} else {
|
|
191
|
-
this.$element.addClass('panel_tree').removeClass('panel_results');
|
|
192
|
-
this.tree.setNavigationActive(true);
|
|
193
|
-
this.setNavigationActive(false);
|
|
194
|
-
}
|
|
195
|
-
if (value != this.lastQuery) {
|
|
196
|
-
this.lastQuery = value;
|
|
197
|
-
this.firstRun = true;
|
|
198
|
-
this.searcher.find(value);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
this.addResults = function(results, isLast) {
|
|
203
|
-
var target = this.$result.get(0);
|
|
204
|
-
if (this.firstRun && (results.length > 0 || isLast)) {
|
|
205
|
-
this.$current = null;
|
|
206
|
-
this.$result.empty();
|
|
207
|
-
}
|
|
208
|
-
for (var i=0, l = results.length; i < l; i++) {
|
|
209
|
-
target.appendChild(renderItem.call(this, results[i]));
|
|
210
|
-
};
|
|
211
|
-
if (this.firstRun && results.length > 0) {
|
|
212
|
-
this.firstRun = false;
|
|
213
|
-
this.$current = $(target.firstChild);
|
|
214
|
-
this.$current.addClass('current');
|
|
215
|
-
if (this.selectFirstMatch) this.select();
|
|
216
|
-
scrollIntoView(this.$current[0], this.$view[0])
|
|
217
|
-
}
|
|
218
|
-
if (jQuery.browser.msie) this.$element[0].className += '';
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
this.open = function(src) {
|
|
222
|
-
this.frame.location.href = '../' + src;
|
|
223
|
-
if (this.frame.highlight) this.frame.highlight(src);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
this.select = function() {
|
|
227
|
-
this.open(this.$current.data('path'));
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
this.move = function(isDown) {
|
|
231
|
-
if (!this.$current) return;
|
|
232
|
-
var $next = this.$current[isDown ? 'next' : 'prev']();
|
|
233
|
-
if ($next.length) {
|
|
234
|
-
this.$current.removeClass('current');
|
|
235
|
-
$next.addClass('current');
|
|
236
|
-
scrollIntoView($next[0], this.$view[0]);
|
|
237
|
-
this.$current = $next;
|
|
238
|
-
}
|
|
239
|
-
return true;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function renderItem(result) {
|
|
243
|
-
var li = document.createElement('li'),
|
|
244
|
-
html = '', badge = result.badge;
|
|
245
|
-
html += '<h1>' + hlt(result.title);
|
|
246
|
-
if (result.params) html += '<i>' + result.params + '</i>';
|
|
247
|
-
html += '</h1>';
|
|
248
|
-
html += '<p>';
|
|
249
|
-
if (typeof badge != 'undefined') {
|
|
250
|
-
html += '<span class="badge badge_' + (badge % 6 + 1) + '">' + escapeHTML(this.data.badges[badge] || 'unknown') + '</span>';
|
|
251
|
-
}
|
|
252
|
-
html += hlt(result.namespace) + '</p>';
|
|
253
|
-
if (result.snippet) html += '<p class="snippet">' + escapeHTML(result.snippet) + '</p>';
|
|
254
|
-
li.innerHTML = html;
|
|
255
|
-
jQuery.data(li, 'path', result.path);
|
|
256
|
-
return li;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function hlt(html) {
|
|
260
|
-
return escapeHTML(html).replace(/\u0001/g, '<b>').replace(/\u0002/g, '</b>')
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function escapeHTML(html) {
|
|
264
|
-
return html.replace(/[&<>]/g, function(c) {
|
|
265
|
-
return '&#' + c.charCodeAt(0) + ';';
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
// tree.js ------------------------------------------------
|
|
272
|
-
|
|
273
|
-
Searchdoc.Tree = function(element, tree, panel) {
|
|
274
|
-
this.$element = $(element);
|
|
275
|
-
this.$list = $('ul', element);
|
|
276
|
-
this.tree = tree;
|
|
277
|
-
this.panel = panel;
|
|
278
|
-
this.init();
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() {
|
|
282
|
-
this.init = function() {
|
|
283
|
-
var stopper = document.createElement('li');
|
|
284
|
-
stopper.className = 'stopper';
|
|
285
|
-
this.$list[0].appendChild(stopper);
|
|
286
|
-
for (var i=0, l = this.tree.length; i < l; i++) {
|
|
287
|
-
buildAndAppendItem.call(this, this.tree[i], 0, stopper);
|
|
288
|
-
};
|
|
289
|
-
var _this = this;
|
|
290
|
-
this.$list.click(function(e) {
|
|
291
|
-
var $target = $(e.target),
|
|
292
|
-
$li = $target.closest('li');
|
|
293
|
-
if ($target.hasClass('icon')) {
|
|
294
|
-
_this.toggle($li);
|
|
295
|
-
} else {
|
|
296
|
-
_this.select($li);
|
|
297
|
-
}
|
|
298
|
-
})
|
|
299
|
-
|
|
300
|
-
this.initNavigation();
|
|
301
|
-
if (jQuery.browser.msie) document.body.className += '';
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
this.select = function($li) {
|
|
305
|
-
this.highlight($li);
|
|
306
|
-
var path = $li[0].searchdoc_tree_data.path;
|
|
307
|
-
if (path) this.panel.open(path);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
this.highlight = function($li) {
|
|
311
|
-
if (this.$current) this.$current.removeClass('current');
|
|
312
|
-
this.$current = $li.addClass('current');
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
this.toggle = function($li) {
|
|
316
|
-
var closed = !$li.hasClass('closed'),
|
|
317
|
-
children = $li[0].searchdoc_tree_data.children;
|
|
318
|
-
$li.toggleClass('closed');
|
|
319
|
-
for (var i=0, l = children.length; i < l; i++) {
|
|
320
|
-
toggleVis.call(this, $(children[i].li), !closed);
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
this.moveRight = function() {
|
|
325
|
-
if (!this.$current) {
|
|
326
|
-
this.highlight(this.$list.find('li:first'));
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
if (this.$current.hasClass('closed')) {
|
|
330
|
-
this.toggle(this.$current);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
this.moveLeft = function() {
|
|
335
|
-
if (!this.$current) {
|
|
336
|
-
this.highlight(this.$list.find('li:first'));
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
if (!this.$current.hasClass('closed')) {
|
|
340
|
-
this.toggle(this.$current);
|
|
341
|
-
} else {
|
|
342
|
-
var level = this.$current[0].searchdoc_tree_data.level;
|
|
343
|
-
if (level == 0) return;
|
|
344
|
-
var $next = this.$current.prevAll('li.level_' + (level - 1) + ':visible:first');
|
|
345
|
-
this.$current.removeClass('current');
|
|
346
|
-
$next.addClass('current');
|
|
347
|
-
scrollIntoView($next[0], this.$element[0]);
|
|
348
|
-
this.$current = $next;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
this.move = function(isDown) {
|
|
353
|
-
if (!this.$current) {
|
|
354
|
-
this.highlight(this.$list.find('li:first'));
|
|
355
|
-
return true;
|
|
356
|
-
}
|
|
357
|
-
var next = this.$current[0];
|
|
358
|
-
if (isDown) {
|
|
359
|
-
do {
|
|
360
|
-
next = next.nextSibling;
|
|
361
|
-
if (next && next.style && next.style.display != 'none') break;
|
|
362
|
-
} while(next);
|
|
363
|
-
} else {
|
|
364
|
-
do {
|
|
365
|
-
next = next.previousSibling;
|
|
366
|
-
if (next && next.style && next.style.display != 'none') break;
|
|
367
|
-
} while(next);
|
|
368
|
-
}
|
|
369
|
-
if (next && next.className.indexOf('stopper') == -1) {
|
|
370
|
-
this.$current.removeClass('current');
|
|
371
|
-
$(next).addClass('current');
|
|
372
|
-
scrollIntoView(next, this.$element[0]);
|
|
373
|
-
this.$current = $(next);
|
|
374
|
-
}
|
|
375
|
-
return true;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
function toggleVis($li, show) {
|
|
379
|
-
var closed = $li.hasClass('closed'),
|
|
380
|
-
children = $li[0].searchdoc_tree_data.children;
|
|
381
|
-
$li.css('display', show ? '' : 'none')
|
|
382
|
-
if (!show && this.$current && $li[0] == this.$current[0]) {
|
|
383
|
-
this.$current.removeClass('current');
|
|
384
|
-
this.$current = null;
|
|
385
|
-
}
|
|
386
|
-
for (var i=0, l = children.length; i < l; i++) {
|
|
387
|
-
toggleVis.call(this, $(children[i].li), show && !closed);
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
function buildAndAppendItem(item, level, before) {
|
|
392
|
-
var li = renderItem(item, level),
|
|
393
|
-
list = this.$list[0];
|
|
394
|
-
item.li = li;
|
|
395
|
-
list.insertBefore(li, before);
|
|
396
|
-
for (var i=0, l = item[3].length; i < l; i++) {
|
|
397
|
-
buildAndAppendItem.call(this, item[3][i], level + 1, before);
|
|
398
|
-
};
|
|
399
|
-
return li;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function renderItem(item, level) {
|
|
403
|
-
var li = document.createElement('li'),
|
|
404
|
-
cnt = document.createElement('div'),
|
|
405
|
-
h1 = document.createElement('h1'),
|
|
406
|
-
p = document.createElement('p'),
|
|
407
|
-
icon, i;
|
|
408
|
-
|
|
409
|
-
li.appendChild(cnt);
|
|
410
|
-
li.style.paddingLeft = getOffset(level);
|
|
411
|
-
cnt.className = 'content';
|
|
412
|
-
if (!item[1]) li.className = 'empty ';
|
|
413
|
-
cnt.appendChild(h1);
|
|
414
|
-
// cnt.appendChild(p);
|
|
415
|
-
h1.appendChild(document.createTextNode(item[0]));
|
|
416
|
-
// p.appendChild(document.createTextNode(item[4]));
|
|
417
|
-
if (item[2]) {
|
|
418
|
-
i = document.createElement('i');
|
|
419
|
-
i.appendChild(document.createTextNode(item[2]));
|
|
420
|
-
h1.appendChild(i);
|
|
421
|
-
}
|
|
422
|
-
if (item[3].length > 0) {
|
|
423
|
-
icon = document.createElement('div');
|
|
424
|
-
icon.className = 'icon';
|
|
425
|
-
cnt.appendChild(icon);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// user direct assignement instead of $()
|
|
429
|
-
// it's 8x faster
|
|
430
|
-
// $(li).data('path', item[1])
|
|
431
|
-
// .data('children', item[3])
|
|
432
|
-
// .data('level', level)
|
|
433
|
-
// .css('display', level == 0 ? '' : 'none')
|
|
434
|
-
// .addClass('level_' + level)
|
|
435
|
-
// .addClass('closed');
|
|
436
|
-
li.searchdoc_tree_data = {
|
|
437
|
-
path: item[1],
|
|
438
|
-
children: item[3],
|
|
439
|
-
level: level
|
|
440
|
-
}
|
|
441
|
-
li.style.display = level == 0 ? '' : 'none';
|
|
442
|
-
li.className += 'level_' + level + ' closed';
|
|
443
|
-
return li;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
function getOffset(level) {
|
|
447
|
-
return 5 + 18*level + 'px';
|
|
448
|
-
}
|
|
449
|
-
});
|