Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

clean up twicture filter, remove 37s growler, add basic gist support

  • Loading branch information...
commit d5f48b1931a95180b9f788c959f97c997fd32a6b 1 parent 1a95866
@defunkt authored
Showing with 38 additions and 14 deletions.
  1. +38 −14 lacampfire.user.js
View
52 lacampfire.user.js 100644 → 100755
@@ -7,20 +7,44 @@
// @include *.campfirenow.com/room*
// ==/UserScript==
-if ('Campfire' in window) {
- (function() {
- Campfire.Speaker.prototype.send = function(forcePaste) {
- var value = $F(this.input);
- if (value.blank()) return;
- var pasting = forcePaste || value.match(/\r|\n/);
- value = tweetToTwicture(value) || value;
- this.speak(value, pasting);
- this.input.value = '';
- }
+function LALog(e) {
+ new Insertion.Bottom('chat', "<tr><td colspan='2' style='color: red'>A Javascript Error Occurred in the campfire grease monkey script: " + e + "</td></tr>");
+}
+
+if (MessageTransformers) {
+ MessageTransformers = {
+ list: [ImageAutolink, YoutubeVideoAutolink, Autolink],
- function tweetToTwicture(value) {
- var matches = value.match(/^http:\/\/twitter.com\/(.+?)\/statuses\/(\d+)$/);
- return matches ? "http://twictur.es/" + matches[2] + ".gif" : null;
+ applyFirst: function(text) {
+ return MessageTransformers.list.returnFirstApplication(function(transformer) {
+ return transformer.transform(text);
+ });
+ }
+ };
+
+ MessageTransformers.list.unshift({
+ transform: function(text) {
+ var matches = text.match(/^http:\/\/gist.github.com\/(\d+)$/);
+ if (!matches) return;
+
+ var iframe = '<iframe src="#{url}" width="100%" frameborder="0" style="border:0;padding:0;margin:0;"></iframe>';
+
+ return iframe.interpolate({url: "http://gist.github.com/" + matches[1] + ".pibb"});
}
- })();
+ });
+}
+
+if (Campfire) {
+ // tweetToTwicture
+ Campfire.Speaker.Filters.push(function(value) {
+ var matches = value.match(/^http:\/\/twitter.com\/.+?\/statuses\/(\d+)$/);
+ return matches ? 'http://twictur.es/' + matches[1] + '.gif' : value;
+ });
+
+ window.chat['speaker'].filters = Campfire.Speaker.Filters.toArray();
+}
+
+if (Growler) {
+ // remove the built-in growl stuff if a growl userscript is detected
+ Campfire.Responders = Campfire.Responders.without('GrowlNotifier')
}
Please sign in to comment.
Something went wrong with that request. Please try again.