Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first commit

  • Loading branch information...
commit 7bc81902366b4e7ed3d4cfa2c2b8b0b732ff5f7c 0 parents
@pstadler pstadler authored
2  .gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+._*
3  README.md
@@ -0,0 +1,3 @@
+Candy Plugins
+=============
+This is the official plugin repository for [Candy](http://amiadogroup.github.com/candy), a JavaScript based multi-user chat client.
97 colors/candy.css
@@ -0,0 +1,97 @@
+#colors-control {
+ background: no-repeat url('colors-control.png');
+ position: relative;
+}
+
+#colors-control-indicator {
+ display: inline-block;
+ height: 6px;
+ width: 6px;
+ border: 1px solid white;
+ position: absolute;
+ top: 100%;
+ left: 100%;
+ margin: -8px 0 0 -8px;
+}
+
+#context-menu .colors {
+ padding-left: 5px;
+ width: 89px;
+ white-space: normal;
+}
+
+#context-menu .colors:hover {
+ background-color: inherit;
+}
+
+#context-menu .colors span {
+ display: inline-block;
+ width: 14px;
+ height: 14px;
+ border: 1px solid white;
+ margin: 3px;
+}
+
+.message-pane span.colored {
+ background-color: transparent !important;
+}
+
+.color-0 {
+ color: #333;
+ background-color: #333;
+}
+
+.color-1 {
+ color: #c4322b;
+ background-color: #c4322b;
+}
+
+.color-2 {
+ color: #37991e;
+ background-color: #37991e;
+}
+
+.color-3 {
+ color: #1654c9;
+ background-color: #1654c9;
+}
+
+.color-4 {
+ color: #66379b;
+ background-color: #66379b;
+}
+
+.color-5 {
+ color: #ba7318;
+ background-color: #ba7318;
+}
+
+.color-6 {
+ color: #32938a;
+ background-color: #32938a;
+}
+
+.color-7 {
+ color: #9e2274;
+ background-color: #9e2274;
+}
+
+.color-8 {
+ color: #4C82E4;
+ background-color: #4C82E4;
+}
+
+.color-9 {
+ color: #7F140E;
+ background-color: #7F140E;
+}
+
+.color-10 {
+ color: #1C630A;
+ background-color: #1C630A;
+}
+
+.color-11 {
+ color: #CF55A4;
+ background-color: #CF55A4;
+}
76 colors/candy.js
@@ -0,0 +1,76 @@
+var CandyShop = (function(self) { return self; }(CandyShop || {}));
+
+CandyShop.Colors = (function(self, Candy, $) {
+
+ var _numColors,
+ _currentColor = 0;
+
+ self.init = function(numColors) {
+ _numColors = numColors ? numColors : 8;
+
+ self.applyTranslations();
+
+ Candy.View.Event.Message.beforeSend = function(message) {
+ if(_currentColor > 0 && $.trim(message) !== '') {
+ return '|c:'+ _currentColor +'|' + message;
+ }
+ return message;
+ };
+
+ Candy.View.Event.Message.beforeShow = function(message) {
+ message = message.replace(/^\|c:([0-9]{1,2})\|(.*)/gm, '<span class="colored color-$1">$2</span>');
+ return message;
+ };
+
+ if(Candy.Util.cookieExists('candyshop-colors-current')) {
+ var color = parseInt(Candy.Util.getCookie('candyshop-colors-current'), 10);
+ if(color > 0 && color < _numColors) {
+ _currentColor = color;
+ }
+ }
+ var html = '<li id="colors-control" data-tooltip="' + $.i18n._('candyshopColorsMessagecolor') + '"><span class="color-' + _currentColor + '" id="colors-control-indicator"></span></li>';
+ $('#emoticons-icon').after(html);
+ $('#colors-control').click(function(event) {
+ CandyShop.Colors.showPicker(this);
+ });
+ };
+
+ self.showPicker = function(elem) {
+ elem = $(elem);
+ var pos = elem.offset(),
+ menu = $('#context-menu'),
+ content = $('ul', menu),
+ colors = '',
+ i;
+
+ $('#tooltip').hide();
+
+ for(i = _numColors-1; i >= 0; i--) {
+ colors = '<span class="color-' + i + '" data-color="' + i + '"></span>' + colors;
+ }
+ content.html('<li class="colors">' + colors + '</li>');
+ content.find('span').click(function() {
+ _currentColor = $(this).attr('data-color');
+ $('#colors-control-indicator').attr('class', 'color-' + _currentColor);
+ Candy.Util.setCookie('candyshop-colors-current', _currentColor, 365);
+ Candy.View.Pane.Room.setFocusToForm(Candy.View.getCurrent().roomJid);
+ menu.hide();
+ });
+
+ var posLeft = Candy.Util.getPosLeftAccordingToWindowBounds(menu, pos.left),
+ posTop = Candy.Util.getPosTopAccordingToWindowBounds(menu, pos.top);
+
+ menu.css({'left': posLeft.px, 'top': posTop.px, backgroundPosition: posLeft.backgroundPositionAlignment + ' ' + posTop.backgroundPositionAlignment});
+ menu.fadeIn('fast');
+
+ return true;
+ };
+
+ self.applyTranslations = function() {
+ Candy.View.Translation.en.candyshopColorsMessagecolor = 'Message color';
+ Candy.View.Translation.de.candyshopColorsMessagecolor = 'Farbe für Nachrichten';
+ Candy.View.Translation.fr.candyshopColorsMessagecolor = 'Couleur des messages';
+ };
+
+ return self;
+}(CandyShop.Colors || {}, Candy, jQuery));
BIN  colors/colors-control.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.