jQuery(function($) { $("#body-button").click(function(){ $(this).toggleClass('icon-add').toggleClass('icon-remove'); $('#article-body-field').slideToggle(); return false; }) $("#textile-quickref-show").click(function(){ $('#textile-quickref-hide').show(); $(this).hide(); $('#textile-quickref').slideToggle(); return false; }) $("#textile-quickref-hide").click(function(){ $('#textile-quickref-show').show(); $(this).hide(); $('#textile-quickref').slideToggle(); return false; }) var button_add = $('.text-editor-sidebar span.button-add').attr('data-value'); var button_zoom = $('.text-editor-sidebar span.button-zoom').attr('data-value'); var button_close = $('.text-editor-sidebar span.button-close').attr('data-value'); function add_to_text_button(extra_class) { if (!extra_class) { extra_class = '' } return '' + button_add + ''; } function close_button(extra_class) { if (!extra_class) { extra_class = '' } return '' + button_close + ''; } function zoom_button() { return '' + button_zoom + ''; } function list_items(items, selector, auto_add) { var html_for_items = ''; var images = []; var files = []; var errors = []; $.each(items, function(i, item) { if (item.error) { errors.push(item); return; } if (item.content_type && item.content_type.match(/^image/)) { images.push(item); } else { files.push(item); } }); $.each(images, function(i, item) { html_for_items += '
', '').replace('', ''); // old firefox var data = $.parseJSON(text); list_items(data, '#media-upload-results .items', true); if (data.length && data.length > 0) { $('#media-upload-results').slideDown(); } $('#media-upload-box .header').toggleClass('icon-loading'); } }); $('#media-upload-more-files').click(function() { $('#media-upload-results').hide(); $('#media-upload-form').show(); return false; }); function show_hide_token_input() { if($("#article_published_false").attr('checked')) $("#text-input-search-exception-users").parent("div").css('display', 'block'); else $("#text-input-search-exception-users").parent("div").css('display', 'none'); } if( $("#token-input-search-article-privacy-exceptions").length == 1 ) { show_hide_token_input(); //Hide / Show the text area $("#article_published_false").click(show_hide_token_input); $("#article_published_true").click(show_hide_token_input); } });