summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/farbtastic/farbtastic.go.js69
-rw-r--r--js/install.js18
-rw-r--r--js/jquery.joverlay.min.js6
-rw-r--r--js/util.js4
4 files changed, 91 insertions, 6 deletions
diff --git a/js/farbtastic/farbtastic.go.js b/js/farbtastic/farbtastic.go.js
index 21a1530bc..e298c1dab 100644
--- a/js/farbtastic/farbtastic.go.js
+++ b/js/farbtastic/farbtastic.go.js
@@ -1,10 +1,67 @@
$(document).ready(function() {
- var f = $.farbtastic('#color-picker');
- var colors = $('#settings_design_color input');
+ function UpdateColors(e) {
+ var S = f.linked;
+ var C = f.color;
- colors
- .each(function () { f.linkTo(this); })
- .focus(function() {
- f.linkTo(this);
+ if (S && S.value && S.value != C) {
+ UpdateSwatch(S);
+
+ switch (parseInt(f.linked.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;
+ }
+ S.value = C;
+ }
+ }
+
+ 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"
});
+ }
+
+ $('#settings_design_color').append('<div id="color-picker"></div>');
+ $('#color-picker').hide();
+
+ var f = $.farbtastic('#color-picker', UpdateColors);
+ var swatches = $('#settings_design_color .swatch');
+
+ swatches
+ .each(UpdateColors)
+
+ .blur(function() {
+ $(this).val($(this).val().toUpperCase());
+ })
+
+ .focus(function() {
+ $('#color-picker').show();
+ UpdateFarbtastic(this);
+ })
+
+ .change(function() {
+ UpdateFarbtastic(this);
+ UpdateSwatch(this);
+ }).change()
+
+ ;
+
});
diff --git a/js/install.js b/js/install.js
new file mode 100644
index 000000000..32a54111e
--- /dev/null
+++ b/js/install.js
@@ -0,0 +1,18 @@
+$(document).ready(function(){
+ $.ajax({url:'check-fancy',
+ type:'GET',
+ success:function(data, textStatus) {
+ $('#fancy-enable').attr('checked', true);
+ $('#fancy-disable').attr('checked', false);
+ $('#fancy-form_guide').text(data);
+ },
+ error:function(XMLHttpRequest, textStatus, errorThrown) {
+ $('#fancy-enable').attr('checked', false);
+ $('#fancy-disable').attr('checked', true);
+ $('#fancy-enable').attr('disabled', true);
+ $('#fancy-disable').attr('disabled', true);
+ $('#fancy-form_guide').text("Fancy URL support detection failed, disabling this option. Make sure you renamed htaccess.sample to .htaccess.");
+ }
+ });
+});
+
diff --git a/js/jquery.joverlay.min.js b/js/jquery.joverlay.min.js
new file mode 100644
index 000000000..c9168506a
--- /dev/null
+++ b/js/jquery.joverlay.min.js
@@ -0,0 +1,6 @@
+/* Copyright (c) 2009 Alvaro A. Lima Jr http://alvarojunior.com/jquery/joverlay.html
+ * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * Version: 0.6 (Abr 23, 2009)
+ * Requires: jQuery 1.3+
+ */
+(function($){var f=$.browser.msie&&$.browser.version==6.0;var g=null;$.fn.jOverlay=function(b){var b=$.extend({},$.fn.jOverlay.options,b);if(g!=null){clearTimeout(g)}var c=this.is('*')?this:'#jOverlayContent';var d=f?'absolute':'fixed';var e=b.imgLoading?"<img id='jOverlayLoading' src='"+b.imgLoading+"' style='position:"+d+"; z-index:"+(b.zIndex+9)+";'/>":'';$('body').prepend(e+"<div id='jOverlay' />"+"<div id='jOverlayContent' style='position:"+d+"; z-index:"+(b.zIndex+5)+"; display:none;'/>");$('#jOverlayLoading').load(function(){if(b.center){$.center(this)}});if(f){$("select").hide();$("#jOverlayContent select").show()}$('#jOverlay').css({backgroundColor:b.color,position:d,top:'0px',left:'0px',filter:'alpha(opacity='+(b.opacity*100)+')',opacity:b.opacity,zIndex:b.zIndex,width:!f?'100%':$(window).width()+'px',height:!f?'100%':$(document).height()+'px'}).show();if(this.is('*')){$('#jOverlayContent').html(this.addClass('jOverlayChildren').show()).show();if(b.center){$.center('#jOverlayContent')}if(!b.url&&$.isFunction(b.success)){b.success(this.html())}}if(b.url){$.ajax({type:b.method,data:b.data,url:b.url,success:function(a){$('#jOverlayLoading').fadeOut(600);$(c).html(a).show();if(b.center){$.center('#jOverlayContent')}if($.isFunction(b.success)){b.success(a)}}})}if(f){$(window).scroll(function(){if(b.center){$.center('#jOverlayContent')}});$(window).resize(function(){$('#jOverlay').css({width:$(window).width()+'px',height:$(document).height()+'px'});if(b.center){$.center('#jOverlayContent')}})}$(document).keydown(function(a){if(a.keyCode==27){$.closeOverlay()}});if(b.bgClickToClose){$('#jOverlay').click($.closeOverlay)}if(Number(b.timeout)>0){g=setTimeout($.closeOverlay,Number(b.timeout))}};$.center=function(a){var a=$(a);var b=a.height();var c=a.width();a.css({width:c+'px',marginLeft:'-'+(c/2)+'px',marginTop:'-'+b/2+'px',height:'auto',top:!f?'50%':$(window).scrollTop()+($(window).height()/2)+"px",left:'50%'})};$.fn.jOverlay.options={method:'GET',data:'',url:'',color:'#000',opacity:'0.6',zIndex:9999,center:true,imgLoading:'',bgClickToClose:true,success:null,timeout:0};$.closeOverlay=function(){if(f){$("select").show()}$('#jOverlayContent .jOverlayChildren').hide().prependTo($('body'));$('#jOverlayLoading, #jOverlayContent, #jOverlay').remove()}})(jQuery); \ No newline at end of file
diff --git a/js/util.js b/js/util.js
index 3f14bc61c..31d9eb4f5 100644
--- a/js/util.js
+++ b/js/util.js
@@ -17,6 +17,10 @@
*/
$(document).ready(function(){
+ $('.attachments').click(function() {$().jOverlay({zIndex:999, success:function(html) {$('.attachment').click(function() {$().jOverlay({url:$(this).attr('href') + '/ajax'}); return false; });
+ }, url:$(this).attr('href') + '/ajax'}); return false; });
+ $('.attachment').click(function() {$().jOverlay({url:$(this).attr('href') + '/ajax'}); return false; });
+
// count character on keyup
function counter(event){
var maxLength = 140;