2010-05-11 21:38:52 +00:00
|
|
|
/* ___ file or text ___ */
|
|
|
|
|
|
|
|
var enableFileOrTextToggling = function() {
|
2010-07-22 22:10:40 +00:00
|
|
|
$('div.hidden').hide();
|
2010-05-11 21:38:52 +00:00
|
|
|
|
2011-07-01 00:15:45 +00:00
|
|
|
var fileSelectorFieldset = $('div#file-selector fieldset');
|
|
|
|
var textSelectorFieldset = $('div#text-selector fieldset');
|
|
|
|
|
2010-07-22 22:10:40 +00:00
|
|
|
$('span.alt').click(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
if ($("div#file-selector").is(":hidden")) {
|
|
|
|
$("div#text-selector").slideUp("normal", function() {
|
|
|
|
$("div#file-selector").slideDown();
|
|
|
|
$("input#theme_asset_performing_plain_text").val(false);
|
2011-07-01 00:15:45 +00:00
|
|
|
fileSelectorFieldset.trigger('refresh');
|
2010-07-22 22:10:40 +00:00
|
|
|
});
|
2010-05-11 21:38:52 +00:00
|
|
|
} else {
|
2010-07-22 22:10:40 +00:00
|
|
|
$("div#file-selector").slideUp("normal", function() {
|
|
|
|
$("div#text-selector").slideDown();
|
|
|
|
$("input#theme_asset_performing_plain_text").val(true);
|
2011-07-01 00:15:45 +00:00
|
|
|
textSelectorFieldset.trigger('refresh');
|
2010-07-22 22:10:40 +00:00
|
|
|
});
|
2010-05-11 21:38:52 +00:00
|
|
|
}
|
2010-07-22 22:10:40 +00:00
|
|
|
});
|
2010-06-02 00:39:05 +00:00
|
|
|
}
|
2010-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
$(document).ready(function() {
|
2010-07-22 22:10:40 +00:00
|
|
|
enableFileOrTextToggling();
|
|
|
|
|
|
|
|
$('code.stylesheet textarea').each(function() {
|
2011-01-12 15:54:09 +00:00
|
|
|
addCodeMirrorEditor(null, $(this), 'CSS');
|
2010-07-22 22:10:40 +00:00
|
|
|
});
|
|
|
|
$('code.javascript textarea').each(function() {
|
2011-01-12 15:54:09 +00:00
|
|
|
addCodeMirrorEditor(null, $(this), 'JS');
|
2010-07-22 22:10:40 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('select#theme_asset_content_type').bind('change', function() {
|
|
|
|
var editor = CodeMirrorEditors[0].editor;
|
|
|
|
editor.setParser($(this).val() == 'stylesheet' ? 'CSSParser' : 'JSParser');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('a#image-picker-link').imagepicker({
|
|
|
|
insertFn: function(link) {
|
2010-10-11 14:26:46 +00:00
|
|
|
return link.attr('href');
|
2010-07-22 22:10:40 +00:00
|
|
|
}
|
|
|
|
});
|
2010-07-23 20:20:09 +00:00
|
|
|
});
|