| 20 |
$("input.color_textfield").each(function () { |
$("input.color_textfield").each(function () { |
| 21 |
farb.linkTo(this); |
farb.linkTo(this); |
| 22 |
$(this).click(function () { |
$(this).click(function () { |
| 23 |
farb.linkTo(this); |
var field = this.name; |
| 24 |
|
farb.linkTo(function () { |
| 25 |
|
var name = tablemanager_convert(field); |
| 26 |
|
$("input[name='" + field + "']").css('backgroundColor', farb.color); |
| 27 |
|
$("input[name='" + field + "']").attr('value', farb.color); |
| 28 |
|
$(name[1]).css(tablemanager_normal_field(name[2]), farb.color); |
| 29 |
|
}); |
| 30 |
}).filter(':first').click(); |
}).filter(':first').click(); |
| 31 |
}); |
}); |
| 32 |
|
|
| 48 |
} |
} |
| 49 |
}); |
}); |
| 50 |
|
|
| 51 |
// tablemanager preview table alterations when options are clicked |
// tablemanager preview table alterations when options are clicked/ changed |
| 52 |
$("input[type=radio]").click(function () { |
$("input[type=radio]").click(function () { |
| 53 |
var name = tablemanager_convert(this.name); |
var name = tablemanager_convert(this.name); |
| 54 |
if (this.value == 'custom') { |
if (this.value == 'custom') { |
| 59 |
} |
} |
| 60 |
}); |
}); |
| 61 |
|
|
| 62 |
// converts given name into an array containing the correct object selector and table style |
// catch 'custom' textfield changes |
| 63 |
|
$("input[type=text]").keyup(function() { |
| 64 |
|
$("input[name='" + tablemanager_normal_field(this.name) + "']").click(); |
| 65 |
|
}); |
| 66 |
|
|
| 67 |
|
/** |
| 68 |
|
* converts given name into an array containing the correct object selector and table style |
| 69 |
|
*/ |
| 70 |
function tablemanager_convert(name) { |
function tablemanager_convert(name) { |
| 71 |
name = name.split(/(?:tabs)(?:\[)(.+)(?:\]\[)(.+)(?:\])/g); |
name = name.split(/(?:tabs)(?:\[)(.+)(?:\]\[)(.+)(?:\])/g); |
| 72 |
if (name[1] == 'table') { |
if (name[1] == 'table') { |
| 78 |
return name; |
return name; |
| 79 |
} |
} |
| 80 |
|
|
| 81 |
// returns the custom colour field for an option which uses farbtastic |
/** |
| 82 |
|
* Returns the custom colour field for an option which uses farbtastic |
| 83 |
|
*/ |
| 84 |
function tablemanager_custom_field(field) { |
function tablemanager_custom_field(field) { |
| 85 |
return field.replace(/\]$/, '-custom]'); |
return field.replace(/\]$/, '-custom]'); |
| 86 |
} |
} |
| 87 |
|
|
| 88 |
|
/** |
| 89 |
|
* Returns the 'normal' field when passed a custom field id |
| 90 |
|
*/ |
| 91 |
|
function tablemanager_normal_field(field) { |
| 92 |
|
return field.replace(/\-custom/, ''); |
| 93 |
|
} |
| 94 |
|
|
| 95 |
}); |
}); |
| 96 |
} |
} |