summaryrefslogtreecommitdiff
path: root/js/farbtastic
diff options
context:
space:
mode:
authorJeffery To <jeffery.to@gmail.com>2009-06-26 15:31:42 +0800
committerJeffery To <jeffery.to@gmail.com>2009-06-26 15:31:42 +0800
commit6328add622641e5f5721cc34d27d4d872c86a561 (patch)
tree31be2d91646bc3deed194f7c7e8ad64c9ee17971 /js/farbtastic
parent6d308f6ffe3f894c60fafaea3ceaef86d30dfe1d (diff)
parent97ee517680979bf12e82eab99ecf943712fe97c9 (diff)
Merge branch '0.8.x' into invite-enabled
Diffstat (limited to 'js/farbtastic')
-rw-r--r--js/farbtastic/farbtastic.go.js85
-rw-r--r--js/farbtastic/farbtastic.js20
2 files changed, 18 insertions, 87 deletions
diff --git a/js/farbtastic/farbtastic.go.js b/js/farbtastic/farbtastic.go.js
deleted file mode 100644
index 0149eca7d..000000000
--- a/js/farbtastic/farbtastic.go.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/** Init for Farbtastic library and page setup
- *
- * @package Laconica
- * @author Sarven Capadisli <csarven@controlyourself.ca>
- * @copyright 2009 Control Yourself, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://laconi.ca/
- */
-$(document).ready(function() {
- function UpdateColors(S) {
- C = $(S).val();
- switch (parseInt(S.id.slice(-1))) {
- case 0: default:
- $('body').css({'background-color':C});
- break;
- case 1:
- $('#content').css({'background-color':C});
- break;
- case 2:
- $('#aside_primary').css({'background-color':C});
- break;
- case 3:
- $('body').css({'color':C});
- break;
- case 4:
- $('a').css({'color':C});
- break;
- }
- }
-
- function UpdateFarbtastic(e) {
- f.linked = e;
- f.setColor(e.value);
- }
-
- function UpdateSwatch(e) {
- $(e).css({"background-color": e.value,
- "color": f.hsl[2] > 0.5 ? "#000": "#fff"});
- }
-
- function SynchColors(e) {
- var S = f.linked;
- var C = f.color;
-
- if (S && S.value && S.value != C) {
- S.value = C;
- UpdateSwatch(S);
- UpdateColors(S);
- }
- }
-
- function Init() {
- $('#settings_design_color').append('<div id="color-picker"></div>');
- $('#color-picker').hide();
-
- f = $.farbtastic('#color-picker', SynchColors);
- swatches = $('#settings_design_color .swatch');
-
- swatches
- .each(SynchColors)
- .blur(function() {
- $(this).val($(this).val().toUpperCase());
- })
- .focus(function() {
- $('#color-picker').show();
- UpdateFarbtastic(this);
- })
- .change(function() {
- UpdateFarbtastic(this);
- UpdateSwatch(this);
- UpdateColors(this);
- }).change();
- }
-
- var f, swatches;
- Init();
- $('#form_settings_design').bind('reset', function(){
- setTimeout(function(){
- swatches.each(function(){UpdateColors(this);});
- $('#color-picker').remove();
- swatches.unbind();
- Init();
- },10);
- });
-});
diff --git a/js/farbtastic/farbtastic.js b/js/farbtastic/farbtastic.js
index 24a377803..d8b5ad9cd 100644
--- a/js/farbtastic/farbtastic.js
+++ b/js/farbtastic/farbtastic.js
@@ -1,5 +1,21 @@
-// $Id: farbtastic.js,v 1.2 2007/01/08 22:53:01 unconed Exp $
-// Farbtastic 1.2
+/**
+ * Farbtastic Color Picker 1.2
+ * © 2008 Steven Wittens
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
jQuery.fn.farbtastic = function (callback) {
$.farbtastic(this, callback);