caveat_patch_kids 0.0.3 → 0.0.4

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.
data/README.md CHANGED
@@ -10,14 +10,14 @@ Install in the usual way:
10
10
 
11
11
  ## Usage
12
12
 
13
- To start, plant a cavet patch:
13
+ To start, plant a caveat patch:
14
14
 
15
15
  $ caveat-patch-kids plant
16
16
  create /Users/yourface/.caveat_patch_kids/caveatPatchor.js
17
17
 
18
- This creates a basic caveatPatchor.js you can customize. Either drop you code at the bottom, or require scripts provided by CaveatPatchKids (see below).
18
+ This creates a basic caveatPatchor.js you can customize using Sprockets directories. Either drop you code at the bottom, or require scripts provided by CaveatPatchKids.
19
19
 
20
- When you are happy with the results, bloom it:
20
+ When you are happy with the code, bloom it:
21
21
 
22
22
  $ caveat-patch-kids bloom
23
23
  bloom /Users/yourface/Library/Application Support/Propane/unsupported/caveatPatchor.js
@@ -39,6 +39,7 @@ These scripts are provided by CaveatPatchKids. Include them by updating ~/.cavea
39
39
  * caveat_patch_kids/embiggen_message_history: increase message history
40
40
  * caveat_patch_kids/stylize_diffs: colorize diffs with red/green
41
41
  * caveat_patch_kids/stylize_diffs: colorize nagios alerts
42
+ * caveat_patch_kids/link_to_rdio_app: update rdio links to go to the Rdio app, instead of a browser
42
43
 
43
44
  The original caveatPatchor.js had a lot of mysterious and odd things. Those weren't included by default, but could be of use to someone, somewhere, or maybe just need some cleanup and documentation. See `scripts/caveat_patch_kids/unsupported` for the good.
44
45
 
@@ -46,7 +47,7 @@ The original caveatPatchor.js had a lot of mysterious and odd things. Those were
46
47
 
47
48
  For convience, a full bundles with several scripts are included. Require them like any other script:
48
49
 
49
- * caveat_patch_kids/bundles/all: all scripts (that aren't unsupported)
50
+ * caveat_patch_kids/bundles/all: all scripts, except ones that aren't unspoorted or require specific things on your system (ie rdio)
50
51
  * caveat_patch_kids/bundles/unsupported: all scripts, even ones unsupported. you probably shouldn't do this unless you are a crazy person
51
52
 
52
53
  ## Thanks
@@ -1,3 +1,3 @@
1
1
  module CaveatPatchKids
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -4,3 +4,4 @@
4
4
  //= require caveat_patch_kids/embiggen_message_history
5
5
  //= require caveat_patch_kids/stylize_nagios
6
6
  //= require caveat_patch_kids/stylize_diffs
7
+ //= require caveat_patch_kids/embed_youtube
@@ -0,0 +1,40 @@
1
+ // from https://gist.github.com/1481799
2
+ Campfire.YouTube = Class.create({
3
+ initialize: function(chat) {
4
+ this.chat = chat;
5
+ var messages = this.chat.transcript.messages;
6
+ for (var i = 0; i < messages.length; i++) {
7
+ this.detectYouTubeURL(messages[i]);
8
+ }
9
+ },
10
+
11
+ detectYouTubeURL: function(message) {
12
+ if (!message.pending() && message.kind === 'text') {
13
+
14
+ if(message.bodyElement().innerHTML.match(/http:\/\/www\.youtube\.com\//)){
15
+
16
+ setTimeout(function(){
17
+ var links = message.bodyElement().select('a');
18
+ if (!links.length) {
19
+ return;
20
+ }
21
+ var href = links[0].getAttribute('href');
22
+ var vid_id = href.split("v=")[1].split(/\&amp;|\&|,|%2C/)[0];
23
+ message.bodyElement().innerHTML = '<iframe width="420" height="315" src="http://www.youtube.com/embed/'+ vid_id+ '" frameborder="0" allowfullscreen></iframe>' ;
24
+ },300);
25
+ }
26
+ }
27
+ },
28
+ onMessagesInsertedBeforeDisplay: function(messages) {
29
+ for (var i = 0; i < messages.length; i++) {
30
+ this.detectYouTubeURL(messages[i]);
31
+ }
32
+ },
33
+
34
+ onMessageAccepted: function(message, messageID) {
35
+ this.detectYouTubeURL(message);
36
+ }
37
+ });
38
+
39
+ Campfire.Responders.push("YouTube");
40
+ window.chat.installPropaneResponder("YouTube", "youtube");
@@ -0,0 +1,40 @@
1
+ Campfire.RdioExpander = Class.create({
2
+ initialize: function(chat) {
3
+ this.chat = chat;
4
+ var messages = this.chat.transcript.messages;
5
+ for (var i = 0; i < messages.length; i++) {
6
+ this.detectRdioURL(messages[i]);
7
+ }
8
+ },
9
+
10
+ detectRdioURL: function(message) {
11
+ if (!message.pending() && message.kind === 'text') {
12
+ var body = message.bodyElement()
13
+ var links = message.bodyElement().select('a:not(image)');
14
+
15
+ for (var i = 0; i < links.length; i++) {
16
+ var link = links[i];
17
+ var href = link.getAttribute('href');
18
+ var match = href.match(/^http:\/\/(rd\.io\/x\/\w*)$/)
19
+ if (match) {
20
+ var rdioHref = "rdio://" + match[1];
21
+ link.setAttribute('href', rdioHref);
22
+ }
23
+ }
24
+ }
25
+ },
26
+
27
+ onMessagesInsertedBeforeDisplay: function(messages) {
28
+ for (var i = 0; i < messages.length; i++) {
29
+ this.detectRdioURL(messages[i]);
30
+ }
31
+ },
32
+
33
+ onMessageAccepted: function(message, messageID) {
34
+ this.detectRdioURL(message);
35
+ }
36
+
37
+ });
38
+
39
+ Campfire.Responders.push("RdioExpander");
40
+ window.chat.installPropaneResponder("RdioExpander", "rdioexpander");
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caveat_patch_kids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-15 00:00:00.000000000 Z
12
+ date: 2013-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprockets
@@ -81,7 +81,9 @@ files:
81
81
  - scripts/caveat_patch_kids/bundles/unsupported.js
82
82
  - scripts/caveat_patch_kids/display_avatars.js
83
83
  - scripts/caveat_patch_kids/display_githubs.js
84
+ - scripts/caveat_patch_kids/embed_youtube.js
84
85
  - scripts/caveat_patch_kids/embiggen_message_history.js
86
+ - scripts/caveat_patch_kids/link_to_rdio_app.js
85
87
  - scripts/caveat_patch_kids/stylize_diffs.js
86
88
  - scripts/caveat_patch_kids/stylize_nagios.js
87
89
  - scripts/caveat_patch_kids/unsupported/display_emoji.js
@@ -120,4 +122,3 @@ specification_version: 3
120
122
  summary: CaveatPatchKids is a tool for generating, sharing, and maintaing caveatPatchor.js
121
123
  files for use with Propane, powered by sprockets and other fun stuff
122
124
  test_files: []
123
- has_rdoc: