var WPRSS_TMCE_PLUGIN_ID = 'wprss'; var WPRSS_ED = null; var wprss_dialog_submit = null; jQuery( document ).ready( function($) { wprss_dialog_submit = function() { this.focus(); var shortcode = '[wp-rss-aggregator'; var all = $('#wprss-dialog-all-sources').is(':checked'); var selected_template = $('#wprss-dialog-templates').val(); if (selected_template.length > 0) { shortcode += ' template="' + selected_template + '"'; } sources = []; $('#wprss-dialog-feed-source-list :selected').each( function( i, selected ){ sources[i] = $(selected).val(); }); sources = sources.join(','); excludes = []; $('#wprss-dialog-exclude-list :selected').each( function( i, selected ){ excludes[i] = $(selected).val(); }); excludes = excludes.join(','); limit = $('#wprss-dialog-feed-limit').val(); pagination = $('#wprss-dialog-pagination').val(); page = $('#wprss-dialog-start-page').val(); if ( all ) { if ( excludes.length > 0 ) { shortcode += ' exclude="' + excludes + '"'; } } else { if ( sources.length > 0 ) { shortcode += ' source="' + sources + '"'; } } if ( limit !== '' && limit !== '0' ) { shortcode += ' limit="' + limit + '"'; } if (pagination.length > 0) { shortcode += ' pagination="' + pagination + '"'; } if ( page !== '' && parseInt(page) > 1 ) { shortcode += ' page="' + page + '"'; } shortcode += ']'; WPRSS_ED.execCommand('mceInsertContent', false, shortcode); WPRSS_Dialog.close(); } window.WPRSS_Dialog = new function() { // Keep a reference to the current object var base = this; var dialog = null; var dialog_head = null; var dialog_head_close = null; var dialog_inside = null; var close = function( e ) { overlay.fadeOut(); dialog_inside.empty(); }; base.close = close; base.init = function() { overlay = $('
'); dialog = $(''); dialog_head = $('