domainsbot-jquery-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +82 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +27 -0
- data/lib/domainsbot-jquery-rails.rb +6 -0
- data/lib/domainsbot-jquery-rails/version.rb +3 -0
- data/vendor/assets/javascripts/domainsbot-jquery.js +468 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2b7b3ab546d33f2549a9fd95c7c14c4f27d00d92
|
4
|
+
data.tar.gz: 450dfd249c77a294c4be7ceed65b8c269570b881
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c1fa840eadf34bf63966e279cd731356e8780fe7be241a99135f8eca4fbd72195b601b13ba37ac47993c25f27eeb96b7cff26dd7077629652ccdee027a730f0f
|
7
|
+
data.tar.gz: babbbf547f664413e69a73ff666a846211c372393fca66af15fe543a5772aad06ac8d6d35710100f0f02e4c55c63bc4766149a876f945a99447fcf5d7e77dad8
|
data/.document
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionpack (4.0.4)
|
5
|
+
activesupport (= 4.0.4)
|
6
|
+
builder (~> 3.1.0)
|
7
|
+
erubis (~> 2.7.0)
|
8
|
+
rack (~> 1.5.2)
|
9
|
+
rack-test (~> 0.6.2)
|
10
|
+
activesupport (4.0.4)
|
11
|
+
i18n (~> 0.6, >= 0.6.9)
|
12
|
+
minitest (~> 4.2)
|
13
|
+
multi_json (~> 1.3)
|
14
|
+
thread_safe (~> 0.1)
|
15
|
+
tzinfo (~> 0.3.37)
|
16
|
+
addressable (2.3.6)
|
17
|
+
builder (3.1.4)
|
18
|
+
descendants_tracker (0.0.4)
|
19
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
20
|
+
erubis (2.7.0)
|
21
|
+
faraday (0.8.9)
|
22
|
+
multipart-post (~> 1.2.0)
|
23
|
+
git (1.2.6)
|
24
|
+
github_api (0.11.3)
|
25
|
+
addressable (~> 2.3)
|
26
|
+
descendants_tracker (~> 0.0.1)
|
27
|
+
faraday (~> 0.8, < 0.10)
|
28
|
+
hashie (>= 1.2)
|
29
|
+
multi_json (>= 1.7.5, < 2.0)
|
30
|
+
nokogiri (~> 1.6.0)
|
31
|
+
oauth2
|
32
|
+
hashie (2.1.1)
|
33
|
+
highline (1.6.21)
|
34
|
+
i18n (0.6.9)
|
35
|
+
jeweler (2.0.1)
|
36
|
+
builder
|
37
|
+
bundler (>= 1.0)
|
38
|
+
git (>= 1.2.5)
|
39
|
+
github_api
|
40
|
+
highline (>= 1.6.15)
|
41
|
+
nokogiri (>= 1.5.10)
|
42
|
+
rake
|
43
|
+
rdoc
|
44
|
+
json (1.8.1)
|
45
|
+
jwt (0.1.13)
|
46
|
+
multi_json (>= 1.5)
|
47
|
+
mini_portile (0.6.0)
|
48
|
+
minitest (4.7.5)
|
49
|
+
multi_json (1.10.0)
|
50
|
+
multi_xml (0.5.5)
|
51
|
+
multipart-post (1.2.0)
|
52
|
+
nokogiri (1.6.2.1)
|
53
|
+
mini_portile (= 0.6.0)
|
54
|
+
oauth2 (0.9.3)
|
55
|
+
faraday (>= 0.8, < 0.10)
|
56
|
+
jwt (~> 0.1.8)
|
57
|
+
multi_json (~> 1.3)
|
58
|
+
multi_xml (~> 0.5)
|
59
|
+
rack (~> 1.2)
|
60
|
+
rack (1.5.2)
|
61
|
+
rack-test (0.6.2)
|
62
|
+
rack (>= 1.0)
|
63
|
+
railties (4.0.4)
|
64
|
+
actionpack (= 4.0.4)
|
65
|
+
activesupport (= 4.0.4)
|
66
|
+
rake (>= 0.8.7)
|
67
|
+
thor (>= 0.18.1, < 2.0)
|
68
|
+
rake (10.3.1)
|
69
|
+
rdoc (4.1.1)
|
70
|
+
json (~> 1.4)
|
71
|
+
thor (0.19.1)
|
72
|
+
thread_safe (0.3.3)
|
73
|
+
tzinfo (0.3.39)
|
74
|
+
|
75
|
+
PLATFORMS
|
76
|
+
ruby
|
77
|
+
|
78
|
+
DEPENDENCIES
|
79
|
+
bundler (~> 1.0)
|
80
|
+
jeweler (~> 2.0.1)
|
81
|
+
railties (~> 4)
|
82
|
+
rake
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Rubem Nakamura
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# domainsbot-jquery-rails
|
2
|
+
|
3
|
+
domainsbot-jquery-rails wraps the [domainsbot-jquery](https://github.com/DomainsBot/domainsbot-jquery) for simple
|
4
|
+
use with the Rails asset pipeline.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add the following to your Gemfile:
|
9
|
+
|
10
|
+
```
|
11
|
+
gem 'domainsbot-jquery-rails'
|
12
|
+
``
|
13
|
+
|
14
|
+
Add the following directive to your Javascript manifest file (application.js):
|
15
|
+
|
16
|
+
```
|
17
|
+
//= require domainsbot-jquery
|
18
|
+
```
|
19
|
+
|
20
|
+
## Contributing to domainsbot-jquery-rails
|
21
|
+
|
22
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
23
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
24
|
+
* Fork the project.
|
25
|
+
* Start a feature/bugfix branch.
|
26
|
+
* Commit and push until you are happy with your contribution.
|
27
|
+
|
28
|
+
## Copyright
|
29
|
+
|
30
|
+
Copyright (c) 2014 Rubem Nakamura. See LICENSE.txt for
|
31
|
+
further details.
|
32
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
require_relative 'lib/domainsbot-jquery-rails/version'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "domainsbot-jquery-rails"
|
18
|
+
gem.homepage = "http://github.com/rubemz/domainsbot-jquery-rails"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{domainsbot-jquery plugin packaged as a Rails engine}
|
21
|
+
gem.description = %Q{domainsbot-jquery plugin packaged as a Rails engine}
|
22
|
+
gem.email = "rubem.nakamura@gmail.com"
|
23
|
+
gem.authors = ["Rubem Nakamura"]
|
24
|
+
gem.version = DomainsbotJqueryRails::VERSION
|
25
|
+
# dependencies defined in Gemfile
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
@@ -0,0 +1,468 @@
|
|
1
|
+
/*Copyright 2012, DomainsBot Inc. */
|
2
|
+
|
3
|
+
(function ($) {
|
4
|
+
|
5
|
+
var data = [];
|
6
|
+
var maxCounter = 50;
|
7
|
+
var checkDelay = 10;
|
8
|
+
|
9
|
+
var isStart = false;
|
10
|
+
|
11
|
+
var methods = {
|
12
|
+
|
13
|
+
init: function (options) {
|
14
|
+
//checkDelay = options.delay;
|
15
|
+
this.each(function () {
|
16
|
+
|
17
|
+
var dummy ={};
|
18
|
+
dummy.target = $(this);
|
19
|
+
dummy.name = "";
|
20
|
+
dummy.isTyping = false;
|
21
|
+
dummy.notChangedCounter = 0;
|
22
|
+
dummy.onType = options.onType;
|
23
|
+
dummy.onTyped = options.onTyped;
|
24
|
+
data.push(dummy);
|
25
|
+
});
|
26
|
+
isStart = true;
|
27
|
+
setTimeout(CheckTyping, checkDelay);
|
28
|
+
return this;
|
29
|
+
|
30
|
+
},
|
31
|
+
start: function () {
|
32
|
+
|
33
|
+
|
34
|
+
},
|
35
|
+
destroy: function () {
|
36
|
+
data =[];
|
37
|
+
maxCounter = 50;
|
38
|
+
checkDelay = 10;
|
39
|
+
isStart = false;
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
};
|
44
|
+
|
45
|
+
|
46
|
+
$.fn.InstantSearch = function (method) {
|
47
|
+
if (methods[method]) {
|
48
|
+
|
49
|
+
|
50
|
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
51
|
+
} else if (typeof method === 'object' || !method) {
|
52
|
+
return methods.init.apply(this, arguments);
|
53
|
+
} else {
|
54
|
+
$.error('Method ' + method + ' does not exist on jQuery.InstantSearch');
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
|
59
|
+
function CheckTyping() {
|
60
|
+
if (!isStart)
|
61
|
+
return;
|
62
|
+
|
63
|
+
$.each(data, function (index, item) {
|
64
|
+
|
65
|
+
//Changed?
|
66
|
+
var text = item.target.val();
|
67
|
+
|
68
|
+
if (item.name != text) {
|
69
|
+
|
70
|
+
item.isTyping = true;
|
71
|
+
item.notChangedCounter = 0;
|
72
|
+
|
73
|
+
item.name = text;
|
74
|
+
|
75
|
+
// Callback
|
76
|
+
if(item.onType != null)
|
77
|
+
item.onType(text);
|
78
|
+
|
79
|
+
|
80
|
+
}
|
81
|
+
else if (item.notChangedCounter >= 0) {
|
82
|
+
item.notChangedCounter++;
|
83
|
+
}
|
84
|
+
|
85
|
+
if (item.notChangedCounter > maxCounter && item.name != "") {
|
86
|
+
item.isTyping = false;
|
87
|
+
item.notChangedCounter = -1;
|
88
|
+
|
89
|
+
if(item.onTyped != null)
|
90
|
+
item.onTyped(text);
|
91
|
+
|
92
|
+
}
|
93
|
+
|
94
|
+
});
|
95
|
+
|
96
|
+
setTimeout(CheckTyping, checkDelay);
|
97
|
+
|
98
|
+
}
|
99
|
+
})(jQuery);
|
100
|
+
|
101
|
+
(function( $ ) {
|
102
|
+
|
103
|
+
var DomainsBotApi = function(options)
|
104
|
+
{
|
105
|
+
var loader;
|
106
|
+
var checking;
|
107
|
+
|
108
|
+
if(typeof options.urlCheckout == "string")
|
109
|
+
{
|
110
|
+
var defaultDb = "available";
|
111
|
+
|
112
|
+
if(options.parameters != null && options.parameters.database != null)
|
113
|
+
{
|
114
|
+
defaultDb = options.parameters.database.split(" ")[0];
|
115
|
+
}
|
116
|
+
|
117
|
+
var checkoutHash = {};
|
118
|
+
checkoutHash[defaultDb] = options.urlCheckout;
|
119
|
+
options.urlCheckout = checkoutHash;
|
120
|
+
}
|
121
|
+
|
122
|
+
var settings = $.extend( {
|
123
|
+
'urlApi' : 'https://api.domainsbot.com/v4/spinner',
|
124
|
+
'urlAvailability' : 'https://api.domainsbot.com/v4/status',
|
125
|
+
'urlCheckout' : null,
|
126
|
+
'searchTextbox' : null,
|
127
|
+
'searchSubmit' : null,
|
128
|
+
'loading' : null,
|
129
|
+
'checking' : null,
|
130
|
+
'results' : null,
|
131
|
+
'searchParameter' : null,
|
132
|
+
'parameters' : null,
|
133
|
+
'onSuccess' : null,
|
134
|
+
'onError' : null,
|
135
|
+
'onLoading' : null,
|
136
|
+
'onAvailabilitySuccess' : null,
|
137
|
+
'onAvailabilityError' : null,
|
138
|
+
'onCheckout' : null,
|
139
|
+
'autoComplete' : false
|
140
|
+
|
141
|
+
}, options);
|
142
|
+
|
143
|
+
var getDataField = function (fieldName,data)
|
144
|
+
{
|
145
|
+
|
146
|
+
for(var i = 0; i<data.length; i++)
|
147
|
+
{
|
148
|
+
if(data[i].Name == fieldName)
|
149
|
+
return data[i].Data;
|
150
|
+
}
|
151
|
+
return null;
|
152
|
+
};
|
153
|
+
|
154
|
+
var getUrlVars = function ()
|
155
|
+
{
|
156
|
+
var vars = [], hash;
|
157
|
+
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
158
|
+
for(var i = 0; i < hashes.length; i++)
|
159
|
+
{
|
160
|
+
hash = hashes[i].split('=');
|
161
|
+
vars.push(hash[0]);
|
162
|
+
vars[hash[0]] = hash[1];
|
163
|
+
}
|
164
|
+
return vars;
|
165
|
+
};
|
166
|
+
var checkAvailability = function (domain, id, options)
|
167
|
+
{
|
168
|
+
//check if domain not empty
|
169
|
+
if(domain != "")
|
170
|
+
{
|
171
|
+
|
172
|
+
// Built the post string.
|
173
|
+
var postString = "q=" + domain;
|
174
|
+
|
175
|
+
$.ajax({
|
176
|
+
url:options.urlAvailability +"?" + postString + "&auth-token=" + options.parameters["auth-token"] + "&callback=?",
|
177
|
+
dataType: 'jsonp',
|
178
|
+
success:function(response)
|
179
|
+
{
|
180
|
+
if(options.onAvailabilitySuccess != null)
|
181
|
+
{
|
182
|
+
options.onAvailabilitySuccess({ Domain: domain, Index: id, Available: !!(response.status == "available")} );
|
183
|
+
}
|
184
|
+
if(options.urlAvailability != null && options.urlAvailability != "")
|
185
|
+
{
|
186
|
+
|
187
|
+
if(response.status != "available")
|
188
|
+
{
|
189
|
+
$(options.results).find("div[bind='domainsbotDomain'][index='" + id+"']").parent().hide();
|
190
|
+
}
|
191
|
+
else
|
192
|
+
{
|
193
|
+
|
194
|
+
$(options.results).find("div[bind='domainsbotDomain'][index='" + id+"']").hide();
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
}
|
199
|
+
},
|
200
|
+
error: function(response){
|
201
|
+
if(options.onAvailabilityError != null){
|
202
|
+
options.onAvailabilityError (response);
|
203
|
+
}
|
204
|
+
}
|
205
|
+
});
|
206
|
+
}
|
207
|
+
|
208
|
+
};
|
209
|
+
var GetDomains = function (key,options)
|
210
|
+
{
|
211
|
+
var cnt = 0; var i;
|
212
|
+
|
213
|
+
// Define an empty string
|
214
|
+
var postString = "";
|
215
|
+
|
216
|
+
|
217
|
+
// Binds the post string with key term and suggestion
|
218
|
+
postString = "q=" + escape(key);
|
219
|
+
|
220
|
+
for(var index in options.parameters) {
|
221
|
+
postString += "&"+index+"="+escape(options.parameters[index]);
|
222
|
+
}
|
223
|
+
|
224
|
+
|
225
|
+
if(options.results != null)
|
226
|
+
$(options.results).html("");
|
227
|
+
|
228
|
+
if(options.loading != null){
|
229
|
+
$(options.results).append(loader);
|
230
|
+
// Set teh ajax loader image
|
231
|
+
$(loader).css('display','block');
|
232
|
+
}
|
233
|
+
|
234
|
+
if(options.onLoad != null){
|
235
|
+
options.onLoad();
|
236
|
+
}
|
237
|
+
|
238
|
+
$.ajax({
|
239
|
+
url:options.urlApi +"?" + postString + "&callback=?",
|
240
|
+
dataType: 'jsonp',
|
241
|
+
success:function(data)
|
242
|
+
{
|
243
|
+
|
244
|
+
if(data === null || data.error != null){
|
245
|
+
if(options.onError != null){
|
246
|
+
|
247
|
+
options.onError(data.error);
|
248
|
+
}
|
249
|
+
if(options.results != null)
|
250
|
+
{
|
251
|
+
$(options.results).html(data.error.message);
|
252
|
+
}
|
253
|
+
return;
|
254
|
+
}
|
255
|
+
|
256
|
+
if(options.onSuccess != null){
|
257
|
+
options.onSuccess(data);
|
258
|
+
}
|
259
|
+
if(options.results != null){
|
260
|
+
$(options.results).html("");
|
261
|
+
var htmlItem = "";
|
262
|
+
if(data && data.Domains){
|
263
|
+
$.each(data.Domains, function(i,domain){
|
264
|
+
|
265
|
+
htmlItem += "<div >";
|
266
|
+
var database = null;
|
267
|
+
if(domain.Data != null && domain.Data.length > 0)
|
268
|
+
{
|
269
|
+
database = getDataField("database", domain.Data[0]);
|
270
|
+
}
|
271
|
+
|
272
|
+
var url = "";
|
273
|
+
if(options.urlCheckout != null && database != null)
|
274
|
+
{
|
275
|
+
|
276
|
+
url = options.urlCheckout[database].replace("%domain%",domain.DomainName);
|
277
|
+
}
|
278
|
+
|
279
|
+
// cart url
|
280
|
+
htmlItem += "<a href='"+url+"' bind='domainsbotDomainLink' domainName='"+domain.DomainName+"' >"+domain.DomainName+"</a>";
|
281
|
+
|
282
|
+
//console.log(options.checking);
|
283
|
+
|
284
|
+
htmlItem += "<div bind='domainsbotDomain' index='"+i+"' domainName = '"+domain.DomainName+"' >" + ((options.checking != null && ((options.urlAvailability != null && options.urlAvailability != "") || (options.onAvailabilitySuccess != null && options.onAvailabilitySuccess != ""))) ? $(options.checking).clone().css('display','block').wrap('<p>').parent().html() : "" ) +"</div>";
|
285
|
+
|
286
|
+
htmlItem += "</div>";
|
287
|
+
|
288
|
+
});
|
289
|
+
|
290
|
+
}
|
291
|
+
else
|
292
|
+
{
|
293
|
+
if(options.onError != null){
|
294
|
+
options.onError(data);
|
295
|
+
}
|
296
|
+
}
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
$(options.results).html(htmlItem);
|
301
|
+
|
302
|
+
if(options.onCheckout != null)
|
303
|
+
{
|
304
|
+
$(options.results).find("a[bind='domainsbotDomainLink']").click(function(evt)
|
305
|
+
{
|
306
|
+
|
307
|
+
options.onCheckout({ Domain: $(this).attr("domainName")}, evt );
|
308
|
+
});
|
309
|
+
}
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
if((options.urlAvailability != null && options.urlAvailability != "") || (options.onAvailabilitySuccess != null && options.onAvailabilitySuccess != "")){
|
315
|
+
|
316
|
+
for(i = 0; i < data.Domains.length; i++)
|
317
|
+
{
|
318
|
+
checkAvailability(data.Domains[i].DomainName, i, options);
|
319
|
+
}
|
320
|
+
|
321
|
+
}
|
322
|
+
|
323
|
+
|
324
|
+
}
|
325
|
+
},
|
326
|
+
error: function(xhr, ajaxOptions, thrownError)
|
327
|
+
{
|
328
|
+
if(options.onError != null){
|
329
|
+
|
330
|
+
options.onError(thrownError);
|
331
|
+
}
|
332
|
+
else if(options.results != null)
|
333
|
+
{
|
334
|
+
$(options.results).html(thrownError);
|
335
|
+
}
|
336
|
+
|
337
|
+
}
|
338
|
+
});
|
339
|
+
|
340
|
+
|
341
|
+
};
|
342
|
+
|
343
|
+
|
344
|
+
if(settings.searchTextbox != null){
|
345
|
+
// Sets focus the search text box
|
346
|
+
$(settings.searchTextbox).focus();
|
347
|
+
// Enter button
|
348
|
+
// Check for Key down event on Search text box
|
349
|
+
$(settings.searchTextbox).keydown(function(event) {
|
350
|
+
|
351
|
+
// Check if user hits the <enter>
|
352
|
+
if(event.keyCode == 13){
|
353
|
+
// calls to function
|
354
|
+
GetDomains($(settings.searchTextbox).val(),settings);
|
355
|
+
}
|
356
|
+
});
|
357
|
+
|
358
|
+
|
359
|
+
if(settings.results != null && settings.autoComplete)
|
360
|
+
{
|
361
|
+
$(settings.searchTextbox).InstantSearch({
|
362
|
+
onTyped: function(text){
|
363
|
+
if(text != null && text != "")
|
364
|
+
{
|
365
|
+
GetDomains(text,settings);
|
366
|
+
}
|
367
|
+
else
|
368
|
+
{
|
369
|
+
if(options.results != null)
|
370
|
+
$(options.results).html("");
|
371
|
+
}
|
372
|
+
},
|
373
|
+
onType: function(text){
|
374
|
+
if(options.results != null)
|
375
|
+
$(options.results).html("");
|
376
|
+
if(text != null && text != "")
|
377
|
+
{
|
378
|
+
if(options.loading != null){
|
379
|
+
$(options.results).append(loader);
|
380
|
+
// Set teh ajax loader image
|
381
|
+
$(loader).css('display','block');
|
382
|
+
}
|
383
|
+
|
384
|
+
if(options.onLoad != null){
|
385
|
+
options.onLoad();
|
386
|
+
}
|
387
|
+
}
|
388
|
+
|
389
|
+
}
|
390
|
+
});
|
391
|
+
}
|
392
|
+
else if($(settings.searchTextbox).val().length > 0)
|
393
|
+
{
|
394
|
+
GetDomains($(settings.searchTextbox).val(),settings);
|
395
|
+
}
|
396
|
+
|
397
|
+
}
|
398
|
+
|
399
|
+
|
400
|
+
if(settings.loading != null){
|
401
|
+
// Sets variable with ajax loader image
|
402
|
+
$(settings.loading).css('display','none');
|
403
|
+
|
404
|
+
loader = $(settings.loading).clone();
|
405
|
+
|
406
|
+
//this.loader.remove();
|
407
|
+
}
|
408
|
+
|
409
|
+
if(settings.checking != null){
|
410
|
+
// Sets variable with ajax loader image
|
411
|
+
$(settings.checking).css('display','none');
|
412
|
+
|
413
|
+
checking = $(settings.checking).clone();
|
414
|
+
|
415
|
+
//this.checking.remove();
|
416
|
+
}
|
417
|
+
|
418
|
+
|
419
|
+
if(settings.searchSubmit != null && settings.searchTextbox != null){
|
420
|
+
// Check the click event, search btn pressed
|
421
|
+
$(settings.searchSubmit).click(function(){
|
422
|
+
|
423
|
+
//call the function to get result
|
424
|
+
GetDomains($(settings.searchTextbox).val(), settings);
|
425
|
+
});
|
426
|
+
}
|
427
|
+
|
428
|
+
if(settings.searchParameter != null && settings.searchParameter != ""){
|
429
|
+
|
430
|
+
var p = getUrlVars();
|
431
|
+
|
432
|
+
if(p != null && p[settings.searchParameter] != null && p[settings.searchParameter] != ""){
|
433
|
+
console.log(p[settings.searchParameter] );
|
434
|
+
GetDomains(p[settings.searchParameter], settings);
|
435
|
+
}
|
436
|
+
}
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
// Public method
|
442
|
+
this.search = function(key)
|
443
|
+
{
|
444
|
+
GetDomains(key, settings);
|
445
|
+
};
|
446
|
+
};
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
var methods = {
|
452
|
+
init : function( options ) {
|
453
|
+
return new DomainsBotApi(options);
|
454
|
+
}
|
455
|
+
};
|
456
|
+
|
457
|
+
$.fn.domainsbot = function ( method ) {
|
458
|
+
// Method calling logic
|
459
|
+
if ( methods[method] ) {
|
460
|
+
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
|
461
|
+
} else if ( typeof method === 'object' || ! method ) {
|
462
|
+
return methods.init.apply( this, arguments );
|
463
|
+
} else {
|
464
|
+
$.error( 'Method ' + method + ' does not exist on jQuery.domainsbot' );
|
465
|
+
}
|
466
|
+
|
467
|
+
};
|
468
|
+
})( jQuery );
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: domainsbot-jquery-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rubem Nakamura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: railties
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4'
|
69
|
+
description: domainsbot-jquery plugin packaged as a Rails engine
|
70
|
+
email: rubem.nakamura@gmail.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files:
|
74
|
+
- LICENSE.txt
|
75
|
+
- README.md
|
76
|
+
files:
|
77
|
+
- .document
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/domainsbot-jquery-rails.rb
|
84
|
+
- lib/domainsbot-jquery-rails/version.rb
|
85
|
+
- vendor/assets/javascripts/domainsbot-jquery.js
|
86
|
+
homepage: http://github.com/rubemz/domainsbot-jquery-rails
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.2.2
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: domainsbot-jquery plugin packaged as a Rails engine
|
110
|
+
test_files: []
|