(function() { jQuery( document ).on( 'tinymce-editor-setup', function( event, editor ) { editor.addButton( 'wp_statistic_tc_button', { text: '', tooltip: editor.getLang('wp_statistic_tinymce_plugin.insert'), icon: 'icon-statistic dashicons-chart-pie', onclick: function() { editor.windowManager.open({ title: editor.getLang('wp_statistic_tinymce_plugin.insert'), minWidth: 500, minHeight: 480, body: [ { type: 'listbox', name: 'stat', label: editor.getLang('wp_statistic_tinymce_plugin.stat'), 'values': [ {text: editor.getLang('wp_statistic_tinymce_plugin.usersonline'), value: 'usersonline'}, {text: editor.getLang('wp_statistic_tinymce_plugin.visits'), value: 'visits'}, {text: editor.getLang('wp_statistic_tinymce_plugin.visitors'), value: 'visitors'}, {text: editor.getLang('wp_statistic_tinymce_plugin.pagevisits'), value: 'pagevisits'}, {text: editor.getLang('wp_statistic_tinymce_plugin.pagevisitors'), value: 'pagevisitors'}, {text: editor.getLang('wp_statistic_tinymce_plugin.searches'), value: 'searches'}, {text: editor.getLang('wp_statistic_tinymce_plugin.postcount'), value: 'postcount'}, {text: editor.getLang('wp_statistic_tinymce_plugin.pagecount'), value: 'pagecount'}, {text: editor.getLang('wp_statistic_tinymce_plugin.commentcount'), value: 'commentcount'}, {text: editor.getLang('wp_statistic_tinymce_plugin.spamcount'), value: 'spamcount'}, {text: editor.getLang('wp_statistic_tinymce_plugin.usercount'), value: 'usercount'}, {text: editor.getLang('wp_statistic_tinymce_plugin.postaverage'), value: 'postaverage'}, {text: editor.getLang('wp_statistic_tinymce_plugin.commentaverage'), value: 'commentaverage'}, {text: editor.getLang('wp_statistic_tinymce_plugin.useraverage'), value: 'useraverage'}, {text: editor.getLang('wp_statistic_tinymce_plugin.lpd'), value: 'lpd'}, {text: editor.getLang('wp_statistic_tinymce_plugin.referrer'), value: 'referrer'}, ] }, { type : 'container', html : '