ajax 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -47,3 +47,11 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
47
47
  rdoc.rdoc_files.include('lib/**/*.rb')
48
48
  rdoc.rdoc_files.include('app/**/*.rb')
49
49
  end
50
+
51
+ desc "Release a new patch version"
52
+ task :release_new_version do
53
+ Rake::Task['version:bump:patch'].invoke
54
+ Rake::Task['github:release'].invoke
55
+ Rake::Task['git:release'].invoke
56
+ Rake::Task['gemcutter:release'].invoke
57
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
@@ -4,4 +4,4 @@
4
4
  window.ajax.loaded_by_framework = true;
5
5
  }
6
6
  });
7
- </script>
7
+ </script>
data/lib/ajax.rb CHANGED
@@ -109,4 +109,8 @@ module Ajax
109
109
  ::ActionView::Base.send(:include, Ajax::ActionView)
110
110
  end
111
111
  end
112
+
113
+ def self.version
114
+ @version ||= File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).strip
115
+ end
112
116
  end
@@ -1,13 +1,13 @@
1
- /**
1
+ /**
2
2
  * Script lazy loader 0.5
3
3
  * Copyright (c) 2008 Bob Matsuoka
4
4
  *
5
- * This program is free software; you can redistribute it and/or
5
+ * This program is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU General Public License
7
7
  * as published by the Free Software Foundation; either version 2
8
8
  * of the License, or (at your option) any later version.
9
9
  */
10
-
10
+
11
11
  var LazyLoader = {}; //namespace
12
12
  LazyLoader.timer = {}; // contains timers for scripts
13
13
  LazyLoader.scripts = []; // contains called script references
@@ -24,22 +24,22 @@ LazyLoader.load = function(url, callback) {
24
24
  script.src = url;
25
25
  script.type = "text/javascript";
26
26
  $(script).appendTo("head"); // add script tag to head element
27
-
27
+
28
28
  // was a callback requested
29
- if (callback) {
29
+ if (callback) {
30
30
  // test for onreadystatechange to trigger callback
31
- script.onreadystatechange = function () {
31
+ script.onreadystatechange = function () {
32
32
  if (script.readyState == 'loaded' || script.readyState == 'complete') {
33
33
  callback();
34
34
  }
35
35
  };
36
-
36
+
37
37
  // test for onload to trigger callback
38
- script.onload = function () {
38
+ script.onload = function () {
39
39
  callback();
40
40
  return;
41
41
  };
42
-
42
+
43
43
  // safari doesn't support either onload or readystate, create a timer
44
44
  // only way to do this in safari
45
45
  if (($.browser.webkit && !navigator.userAgent.match(/Version\/3/)) || $.browser.opera) { // sniff
@@ -151,12 +151,12 @@ var AjaxAssets = function(array, type) {
151
151
  done = true;
152
152
  if (callback)
153
153
  callback();
154
-
154
+
155
155
  // Handle memory leak in IE
156
156
  script.onload = script.onreadystatechange = null;
157
157
  }
158
158
  };
159
- }
159
+ }
160
160
  } else if (type == 'css') {
161
161
  if (url.match(/datauri/)) {
162
162
  $(DATA_URI_START + '<link type="text/css" rel="stylesheet" href="'+ url +'">' + DATA_URI_END).appendTo('head');
@@ -176,7 +176,7 @@ var AjaxAssets = function(array, type) {
176
176
  *
177
177
  * == Options
178
178
  *
179
- * We extend self with the <tt>options</tt> array. This allows you to set
179
+ * We extend self with the <tt>options</tt> array. This allows you to set
180
180
  * any instance variable on the instance.
181
181
  *
182
182
  * <tt>enabled</tt> boolean indicating whether the plugin is enabled.
@@ -230,7 +230,7 @@ var AjaxAssets = function(array, type) {
230
230
  */
231
231
  var Ajax = function(options) {
232
232
  var self = this;
233
-
233
+
234
234
  /**
235
235
  * Options
236
236
  *
@@ -251,7 +251,7 @@ var Ajax = function(options) {
251
251
  loaded: false,
252
252
  lazy_load_assets: false,
253
253
  current_request: undefined,
254
-
254
+
255
255
  // For initial position of the loading icon. Often the mouse does not
256
256
  // move so position it by the link that was clicked.
257
257
  last_click_coords: undefined
@@ -320,11 +320,11 @@ var Ajax = function(options) {
320
320
  /**
321
321
  * jQuery Address callback triggered when the address changes.
322
322
  * Loads the current address using AJAX.
323
- *
323
+ *
324
324
  * If the inner content was pre-rendered (as in after a redirect),
325
325
  * then <tt>loaded_by_framwork</tt> should be false.
326
326
  *
327
- * jQuery Address will still fire a request when the page loads,
327
+ * jQuery Address will still fire a request when the page loads,
328
328
  * so we ignore that request if <tt>loaded_by_framwork</tt> is false.
329
329
  */
330
330
  self.addressChanged = function() {
@@ -340,11 +340,11 @@ var Ajax = function(options) {
340
340
 
341
341
  // Ensure that the URL ends with '#' if we are on root. This
342
342
  // will not trigger addressChanged().
343
- if (document.location.pathname == '/'
343
+ if (document.location.pathname == '/'
344
344
  && document.location.href.indexOf('#') == -1) {
345
345
  document.location.href = document.location.href + '#';
346
346
  }
347
-
347
+
348
348
  // Clean up the URL before making the request. If the URL changes
349
349
  // as a result of this, update it, which will trigger this
350
350
  // callback again.
@@ -352,7 +352,7 @@ var Ajax = function(options) {
352
352
  if (url != $.address.value()) {
353
353
  $.address.value(url);
354
354
  return false;
355
- } else {
355
+ } else {
356
356
  self.loadPage({
357
357
  url: url
358
358
  });
@@ -391,7 +391,7 @@ var Ajax = function(options) {
391
391
  console.log('[ajax] abort failed!', e);
392
392
  }
393
393
  }
394
-
394
+
395
395
  self.current_request = jQuery.ajax({
396
396
  cache: false,
397
397
  url: options.url,
@@ -436,9 +436,9 @@ var Ajax = function(options) {
436
436
  * Return the current host with protocol and with no trailing slash.
437
437
  */
438
438
  self.host = function() {
439
- return $.address.baseURL().replace(new RegExp(document.location.pathname), '');
439
+ return $.address.baseURL().replace(new RegExp(document.location.pathname), '');
440
440
  };
441
-
441
+
442
442
  /**
443
443
  * linkClicked
444
444
  *
@@ -533,17 +533,17 @@ var Ajax = function(options) {
533
533
 
534
534
  /**
535
535
  * Load javascipts
536
- */
536
+ */
537
537
  if (self.lazy_load_assets && data.assets && data.assets.javascripts !== undefined) {
538
538
  var count = data.assets.javascripts.length;
539
539
  var callback;
540
-
540
+
541
541
  jQuery.each(jQuery.makeArray(data.assets.javascripts), function(idx, url) {
542
542
  if (self.javascripts.loadedAsset(url)) {
543
543
  console.log('[ajax] skipping js', url);
544
544
  return true;
545
545
  }
546
-
546
+
547
547
  // Execute callbacks once the last asset has loaded
548
548
  callback = (idx == count - 1) ? undefined : self.executeCallbacks;
549
549
  self.javascripts.loadAsset(url, callback);
@@ -554,7 +554,7 @@ var Ajax = function(options) {
554
554
  }
555
555
 
556
556
  $(document).trigger('ajax.onload');
557
-
557
+
558
558
  /**
559
559
  * Set cookies - browsers don't seem to allow this
560
560
  */
@@ -625,7 +625,7 @@ var Ajax = function(options) {
625
625
  var marginLeft = parseInt(icon.css('marginLeft'), 10);
626
626
  marginTop = isNaN(marginTop) ? 0 : marginTop;
627
627
  marginLeft = isNaN(marginLeft) ? 0 : marginLeft;
628
-
628
+
629
629
  icon.css({
630
630
  position: 'absolute',
631
631
  left: '50%',
@@ -16,4 +16,8 @@ context Ajax do
16
16
  it "should have a root method" do
17
17
  Ajax.root.should == File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
18
18
  end
19
+
20
+ it "should tell you the version" do
21
+ Ajax.version.should =~ /\d+\.\d+.\d+/
22
+ end
19
23
  end
@@ -9,7 +9,7 @@ module FileMacros
9
9
  identical_files?(first, second).should be(false)
10
10
  end
11
11
 
12
- def (file)
12
+ def file_should_exist(file)
13
13
  File.exists?(file).should be(true)
14
14
  end
15
15
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Karl Varga
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-13 00:00:00 -07:00
17
+ date: 2010-05-28 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency