rdoc-babel 1.1.1 → 1.2.0

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.
@@ -1,152 +0,0 @@
1
- /*
2
- * Rik Lomas quicksearch
3
- * riklomas-quicksearch-7824f76
4
- * http://github.com/riklomas/quicksearch
5
- */
6
-
7
- jQuery(function ($) {
8
- $.fn.quicksearch = function (target, opt) {
9
-
10
- var timeout, cache, rowcache, jq_results, val = '', e = this, options = $.extend({
11
- delay: 100,
12
- selector: null,
13
- stripeRows: null,
14
- loader: null,
15
- noResults: '',
16
- bind: 'keyup',
17
- onBefore: function () {
18
- return;
19
- },
20
- onAfter: function () {
21
- return;
22
- },
23
- show: function () {
24
- this.style.display = "";
25
- },
26
- hide: function () {
27
- this.style.display = "none";
28
- }
29
- }, opt);
30
-
31
- this.go = function () {
32
-
33
- var i = 0, noresults = true, vals = val.toLowerCase().split(' ');
34
-
35
- var rowcache_length = rowcache.length;
36
- for (var i = 0; i < rowcache_length; i++)
37
- {
38
- if (this.test(vals, cache[i]) || val == "") {
39
- options.show.apply(rowcache[i]);
40
- noresults = false;
41
- } else {
42
- options.hide.apply(rowcache[i]);
43
- }
44
- }
45
-
46
- if (noresults) {
47
- this.results(false);
48
- } else {
49
- this.results(true);
50
- this.stripe();
51
- }
52
-
53
- this.loader(false);
54
- options.onAfter();
55
-
56
- return this;
57
- };
58
-
59
- this.stripe = function () {
60
-
61
- if (typeof options.stripeRows === "object" && options.stripeRows !== null)
62
- {
63
- var joined = options.stripeRows.join(' ');
64
- var stripeRows_length = options.stripeRows.length;
65
-
66
- jq_results.not(':hidden').each(function (i) {
67
- $(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]);
68
- });
69
- }
70
-
71
- return this;
72
- };
73
-
74
- this.strip_html = function (input) {
75
- var output = input.replace(new RegExp('<[^<]+\>', 'g'), "");
76
- output = $.trim(output.toLowerCase());
77
- return output;
78
- };
79
-
80
- this.results = function (bool) {
81
- if (typeof options.noResults === "string" && options.noResults !== "") {
82
- if (bool) {
83
- $(options.noResults).hide();
84
- } else {
85
- $(options.noResults).show();
86
- }
87
- }
88
- return this;
89
- };
90
-
91
- this.loader = function (bool) {
92
- if (typeof options.loader === "string" && options.loader !== "") {
93
- (bool) ? $(options.loader).show() : $(options.loader).hide();
94
- }
95
- return this;
96
- };
97
-
98
- this.test = function (vals, t) {
99
- for (var i = 0; i < vals.length; i += 1) {
100
- if (t.indexOf(vals[i]) === -1) {
101
- return false;
102
- }
103
- }
104
- return true;
105
- };
106
-
107
- this.cache = function () {
108
-
109
- jq_results = $(target);
110
-
111
- if (typeof options.noResults === "string" && options.noResults !== "") {
112
- jq_results = jq_results.not(options.noResults);
113
- }
114
-
115
- var t = (typeof options.selector === "string") ? jq_results.find(options.selector) : $(target).not(options.noResults);
116
- cache = t.map(function () {
117
- return e.strip_html(this.innerHTML);
118
- });
119
-
120
- rowcache = jq_results.map(function () {
121
- return this;
122
- });
123
-
124
- return this.go();
125
- };
126
-
127
- this.trigger = function () {
128
- this.loader(true);
129
- options.onBefore();
130
-
131
- window.clearTimeout(timeout);
132
- timeout = window.setTimeout(function () {
133
- e.go();
134
- }, options.delay);
135
-
136
- return this;
137
- };
138
-
139
- this.cache();
140
- this.results(true);
141
- this.stripe();
142
- this.loader(false);
143
-
144
- return this.each(function () {
145
- $(this).bind(options.bind, function () {
146
- val = $(this).val();
147
- e.trigger();
148
- });
149
- });
150
-
151
- };
152
- });