jquery-titlealert-rails 0.0.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 +7 -0
- data/.gitignore +5 -0
- data/Gemfile +3 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/jquery-titlealert-rails.gemspec +22 -0
- data/lib/jquery-titlealert-rails.rb +8 -0
- data/lib/jquery-titlealert-rails/version.rb +5 -0
- data/vendor/assets/javascripts/jquery.titlealert.js +143 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 39fb12c6e937561f61a3ba6df355ddaaca1949fd
|
4
|
+
data.tar.gz: aef985b784013242c7c56d2f6000e07d059d5db2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 397ae60749be783e96ce9a0bc4bf375bee9f1a1544578bd23a8d841d60e57871bc1dcdc22309d1e8b696cbe57f92b846e818bfe23130a2f2886ae0640a2bb594
|
7
|
+
data.tar.gz: fd62850ff4bd4367f44b85af17927cad9e25bcba5495e94ebd49c9b5c77734a61c010af85b4f3a9e7855aaf03461491a2d911e33ebeab5a28fcb1d024ab4ce41
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# jQuery TitleAlert Rails
|
2
|
+
|
3
|
+
Rails gem for https://github.com/heyman/jquery-titlealert
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'jquery-titlealert-rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
Or install it yourself with:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem install jquery-titlealert-rails
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ bundle
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Add the following to your javascript asset manifest
|
28
|
+
|
29
|
+
```coffeescript
|
30
|
+
//= require jquery.titlealert
|
31
|
+
```
|
32
|
+
|
33
|
+
And thats it!
|
34
|
+
|
35
|
+
Head over to https://github.com/heyman/jquery-titlealert for usage.
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jquery-titlealert-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jquery-titlealert-rails"
|
8
|
+
spec.version = JqueryTitlealert::Rails::VERSION
|
9
|
+
spec.authors = ["Kainage"]
|
10
|
+
spec.email = ["kainage@gmail.com"]
|
11
|
+
spec.homepage = "http://github.com/kainage/jquery-titlealert-rails"
|
12
|
+
spec.summary = "This gem adds jquery-titlealert to your rails app"
|
13
|
+
spec.description = "This gem adds jquery-titlealert to your rails app"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "rails", ">= 3.1.0"
|
21
|
+
spec.add_development_dependency "bundler"
|
22
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
/*!!
|
2
|
+
* Title Alert 0.7
|
3
|
+
*
|
4
|
+
* Copyright (c) 2009 ESN | http://esn.me
|
5
|
+
* Jonatan Heyman | http://heyman.info
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
16
|
+
*/
|
17
|
+
|
18
|
+
/*
|
19
|
+
* @name jQuery.titleAlert
|
20
|
+
* @projectDescription Show alert message in the browser title bar
|
21
|
+
* @author Jonatan Heyman | http://heyman.info
|
22
|
+
* @version 0.7.0
|
23
|
+
* @license MIT License
|
24
|
+
*
|
25
|
+
* @id jQuery.titleAlert
|
26
|
+
* @param {String} text The text that should be flashed in the browser title
|
27
|
+
* @param {Object} settings Optional set of settings.
|
28
|
+
* @option {Number} interval The flashing interval in milliseconds (default: 500).
|
29
|
+
* @option {Number} originalTitleInterval Time in milliseconds that the original title is diplayed for. If null the time is the same as interval (default: null).
|
30
|
+
* @option {Number} duration The total lenght of the flashing before it is automatically stopped. Zero means infinite (default: 0).
|
31
|
+
* @option {Boolean} stopOnFocus If true, the flashing will stop when the window gets focus (default: true).
|
32
|
+
* @option {Boolean} stopOnMouseMove If true, the flashing will stop when the browser window recieves a mousemove event. (default:false).
|
33
|
+
* @option {Boolean} requireBlur Experimental. If true, the call will be ignored unless the window is out of focus (default: false).
|
34
|
+
* Known issues: Firefox doesn't recognize tab switching as blur, and there are some minor IE problems as well.
|
35
|
+
*
|
36
|
+
* @example $.titleAlert("Hello World!", {requireBlur:true, stopOnFocus:true, duration:10000, interval:500});
|
37
|
+
* @desc Flash title bar with text "Hello World!", if the window doesn't have focus, for 10 seconds or until window gets focused, with an interval of 500ms
|
38
|
+
*/
|
39
|
+
;(function($){
|
40
|
+
$.titleAlert = function(text, settings) {
|
41
|
+
// check if it currently flashing something, if so reset it
|
42
|
+
if ($.titleAlert._running)
|
43
|
+
$.titleAlert.stop();
|
44
|
+
|
45
|
+
// override default settings with specified settings
|
46
|
+
$.titleAlert._settings = settings = $.extend( {}, $.titleAlert.defaults, settings);
|
47
|
+
|
48
|
+
// if it's required that the window doesn't have focus, and it has, just return
|
49
|
+
if (settings.requireBlur && $.titleAlert.hasFocus)
|
50
|
+
return;
|
51
|
+
|
52
|
+
// originalTitleInterval defaults to interval if not set
|
53
|
+
settings.originalTitleInterval = settings.originalTitleInterval || settings.interval;
|
54
|
+
|
55
|
+
$.titleAlert._running = true;
|
56
|
+
$.titleAlert._initialText = document.title;
|
57
|
+
document.title = text;
|
58
|
+
var showingAlertTitle = true;
|
59
|
+
var switchTitle = function() {
|
60
|
+
// WTF! Sometimes Internet Explorer 6 calls the interval function an extra time!
|
61
|
+
if (!$.titleAlert._running)
|
62
|
+
return;
|
63
|
+
|
64
|
+
showingAlertTitle = !showingAlertTitle;
|
65
|
+
document.title = (showingAlertTitle ? text : $.titleAlert._initialText);
|
66
|
+
$.titleAlert._intervalToken = setTimeout(switchTitle, (showingAlertTitle ? settings.interval : settings.originalTitleInterval));
|
67
|
+
}
|
68
|
+
$.titleAlert._intervalToken = setTimeout(switchTitle, settings.interval);
|
69
|
+
|
70
|
+
if (settings.stopOnMouseMove) {
|
71
|
+
$(document).mousemove(function(event) {
|
72
|
+
$(this).unbind(event);
|
73
|
+
$.titleAlert.stop();
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
// check if a duration is specified
|
78
|
+
if (settings.duration > 0) {
|
79
|
+
$.titleAlert._timeoutToken = setTimeout(function() {
|
80
|
+
$.titleAlert.stop();
|
81
|
+
}, settings.duration);
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
// default settings
|
86
|
+
$.titleAlert.defaults = {
|
87
|
+
interval: 500,
|
88
|
+
originalTitleInterval: null,
|
89
|
+
duration:0,
|
90
|
+
stopOnFocus: true,
|
91
|
+
requireBlur: false,
|
92
|
+
stopOnMouseMove: false
|
93
|
+
};
|
94
|
+
|
95
|
+
// stop current title flash
|
96
|
+
$.titleAlert.stop = function() {
|
97
|
+
if (!$.titleAlert._running)
|
98
|
+
return;
|
99
|
+
|
100
|
+
clearTimeout($.titleAlert._intervalToken);
|
101
|
+
clearTimeout($.titleAlert._timeoutToken);
|
102
|
+
document.title = $.titleAlert._initialText;
|
103
|
+
|
104
|
+
$.titleAlert._timeoutToken = null;
|
105
|
+
$.titleAlert._intervalToken = null;
|
106
|
+
$.titleAlert._initialText = null;
|
107
|
+
$.titleAlert._running = false;
|
108
|
+
$.titleAlert._settings = null;
|
109
|
+
}
|
110
|
+
|
111
|
+
$.titleAlert.hasFocus = true;
|
112
|
+
$.titleAlert._running = false;
|
113
|
+
$.titleAlert._intervalToken = null;
|
114
|
+
$.titleAlert._timeoutToken = null;
|
115
|
+
$.titleAlert._initialText = null;
|
116
|
+
$.titleAlert._settings = null;
|
117
|
+
|
118
|
+
|
119
|
+
$.titleAlert._focus = function () {
|
120
|
+
$.titleAlert.hasFocus = true;
|
121
|
+
|
122
|
+
if ($.titleAlert._running && $.titleAlert._settings.stopOnFocus) {
|
123
|
+
var initialText = $.titleAlert._initialText;
|
124
|
+
$.titleAlert.stop();
|
125
|
+
|
126
|
+
// ugly hack because of a bug in Chrome which causes a change of document.title immediately after tab switch
|
127
|
+
// to have no effect on the browser title
|
128
|
+
setTimeout(function() {
|
129
|
+
if ($.titleAlert._running)
|
130
|
+
return;
|
131
|
+
document.title = ".";
|
132
|
+
document.title = initialText;
|
133
|
+
}, 1000);
|
134
|
+
}
|
135
|
+
};
|
136
|
+
$.titleAlert._blur = function () {
|
137
|
+
$.titleAlert.hasFocus = false;
|
138
|
+
};
|
139
|
+
|
140
|
+
// bind focus and blur event handlers
|
141
|
+
$(window).bind("focus", $.titleAlert._focus);
|
142
|
+
$(window).bind("blur", $.titleAlert._blur);
|
143
|
+
})(jQuery);
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-titlealert-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kainage
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: This gem adds jquery-titlealert to your rails app
|
42
|
+
email:
|
43
|
+
- kainage@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- jquery-titlealert-rails.gemspec
|
53
|
+
- lib/jquery-titlealert-rails.rb
|
54
|
+
- lib/jquery-titlealert-rails/version.rb
|
55
|
+
- vendor/assets/javascripts/jquery.titlealert.js
|
56
|
+
homepage: http://github.com/kainage/jquery-titlealert-rails
|
57
|
+
licenses: []
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.2.2
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: This gem adds jquery-titlealert to your rails app
|
79
|
+
test_files: []
|