diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/farbtastic/farbtastic.js | 20 | ||||
-rw-r--r-- | js/userdesign.go.js (renamed from js/farbtastic/farbtastic.go.js) | 35 | ||||
-rw-r--r-- | js/util.js | 33 |
3 files changed, 61 insertions, 27 deletions
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); diff --git a/js/farbtastic/farbtastic.go.js b/js/userdesign.go.js index 0149eca7d..833b19adc 100644 --- a/js/farbtastic/farbtastic.go.js +++ b/js/userdesign.go.js @@ -10,19 +10,19 @@ $(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}); + case 1: default: + $('html, body').css({'background-color':C}); break; case 2: - $('#aside_primary').css({'background-color':C}); + $('#content, #site_nav_local_views .current a').css({'background-color':C}); break; case 3: - $('body').css({'color':C}); + $('#aside_primary').css({'background-color':C}); break; case 4: + $('html body').css({'color':C}); + break; + case 5: $('a').css({'color':C}); break; } @@ -49,7 +49,7 @@ $(document).ready(function() { } } - function Init() { + function InitFarbtastic() { $('#settings_design_color').append('<div id="color-picker"></div>'); $('#color-picker').hide(); @@ -59,7 +59,9 @@ $(document).ready(function() { swatches .each(SynchColors) .blur(function() { - $(this).val($(this).val().toUpperCase()); + tv = $(this).val(); + $(this).val(tv.toUpperCase()); + (tv.length == 4) ? ((tv[0] == '#') ? $(this).val('#'+tv[1]+tv[1]+tv[2]+tv[2]+tv[3]+tv[3]) : '') : ''; }) .focus(function() { $('#color-picker').show(); @@ -73,13 +75,24 @@ $(document).ready(function() { } var f, swatches; - Init(); + InitFarbtastic(); $('#form_settings_design').bind('reset', function(){ setTimeout(function(){ swatches.each(function(){UpdateColors(this);}); $('#color-picker').remove(); swatches.unbind(); - Init(); + InitFarbtastic(); },10); }); + + $('#design_background-image_off').focus(function() { + $('body').css({'background-image':'none'}); + }); + $('#design_background-image_on').focus(function() { + $('body').css({'background-image':'url('+$('#design_background-image_onoff img')[0].src+')'}); + }); + + $('#design_background-image_repeat').click(function() { + ($(this)[0].checked) ? $('body').css({'background-repeat':'repeat'}) : $('body').css({'background-repeat':'no-repeat'}); + }); }); diff --git a/js/util.js b/js/util.js index fd2500d44..e7c54b74a 100644 --- a/js/util.js +++ b/js/util.js @@ -217,10 +217,12 @@ $(document).ready(function(){ $('#'+li.id).css({display:'none'}); $('#'+li.id).fadeIn(2500); NoticeReply(); + NoticeAttachments(); } } $("#notice_data-text").val(""); $("#notice_data-attach").val(""); + $('#notice_data-attach_selected').remove(); counter(); } $("#form_notice").removeClass("processing"); @@ -230,23 +232,13 @@ $(document).ready(function(){ }; $("#form_notice").ajaxForm(PostNotice); $("#form_notice").each(addAjaxHidden); - NoticeHover(); NoticeReply(); NoticeAttachments(); + NoticeDataAttach(); }); - -function NoticeHover() { - function mouseHandler(e) { - $(e.target).closest('li.hentry')[(e.type === 'mouseover') ? 'addClass' : 'removeClass']('hover'); - }; - $('#content .notices').mouseover(mouseHandler); - $('#content .notices').mouseout(mouseHandler); -} - - function NoticeReply() { - if ($('#notice_data-text').length > 0) { + if ($('#notice_data-text').length > 0 && $('#content .notice_reply').length > 0) { $('#content .notice').each(function() { var notice = $(this)[0]; $($('.notice_reply', notice)[0]).click(function() { @@ -290,13 +282,13 @@ function NoticeAttachments() { timeout : 0 }; - $('a.attachment').click(function() { + $('#content .notice a.attachment').click(function() { $().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; }); var t; - $("body:not(#shownotice) a.thumbnail").hover( + $("body:not(#shownotice) #content .notice a.thumbnail").hover( function() { var anchor = $(this); $("a.thumbnail").children('img').hide(); @@ -320,3 +312,16 @@ function NoticeAttachments() { } ); } + +function NoticeDataAttach() { + NDA = $('#notice_data-attach'); + NDA.change(function() { + S = '<div id="notice_data-attach_selected" class="success"><code>'+$(this).val()+'</code> <button>×</button></div>'; + NDAS = $('#notice_data-attach_selected'); + (NDAS.length > 0) ? NDAS.replaceWith(S) : $('#form_notice').append(S); + $('#notice_data-attach_selected button').click(function(){ + $('#notice_data-attach_selected').remove(); + NDA.val(''); + }); + }); +} |