{"size": 2183, "ext": "js", "max_stars_repo_path": "javascript/plugin/editor_plugin.js", "max_stars_repo_name": "bluehousegroup/silverstripe-pardot", "max_stars_repo_stars_event_min_datetime": "2015-05-11T19:54:12.000Z", "max_stars_repo_stars_event_max_datetime": "2019-01-30T10:19:43.000Z", "max_issues_repo_path": "javascript/plugin/editor_plugin.js", "max_issues_repo_name": "bluehousegroup/silverstripe-pardot", "max_issues_repo_issues_event_min_datetime": "2016-03-02T20:23:40.000Z", "max_issues_repo_issues_event_max_datetime": "2019-07-12T04:41:22.000Z", "max_forks_repo_path": "javascript/plugin/editor_plugin.js", "max_forks_repo_name": "bluehousegroup/silverstripe-pardot", "max_forks_repo_forks_event_min_datetime": "2015-12-04T00:35:09.000Z", "max_forks_repo_forks_event_max_datetime": "2019-07-08T17:11:37.000Z"}
{"max_stars_count": 6, "max_issues_count": 16, "max_forks_count": 9, "avg_line_length": 27.6329113924, "max_line_length": 90, "alphanum_fraction": 0.6074209803}
(function() {

	var each = tinymce.each;

	jQuery('body').on('click', '#pardot-submit-form', function(e){
		e.preventDefault();
		output = jQuery("#selected_form").val();
		height = jQuery("#form-height").val();
		width = jQuery("#form-width").val();
		classes = jQuery("#form-classes").val();
		if(height.length > 0)
			output += ", height='"+height+"'";
		if(width.length > 0)
			output += ", width='"+width+"'";
		if(classes.length > 0)
			output += ", class='"+classes+"'";
		output += "]";
		tinymce.execCommand('mceReplaceContent', false, output);
		jQuery('.htmleditorfield-pardotdialog').remove();

		return false;
	});

	jQuery('body').on('click', '#pardot-submit-dynamic', function(e){
		e.preventDefault();
		output = jQuery("#selected_content").val();
		height = jQuery("#content-height").val();
		width = jQuery("#content-width").val();
		classes = jQuery("#content-classes").val();
		if(height.length > 0)
			output += ", height='"+height+"'";
		if(width.length > 0)
			output += ", width='"+width+"'";
		if(classes.length > 0)
			output += ", class='"+classes+"'";
		output += "]";
		tinymce.execCommand('mceReplaceContent', false, output);
		jQuery('.htmleditorfield-pardotdialog').remove();

		return false;
	});

	tinymce.create('tinymce.plugins.pardot', {

		init : function(ed, url) {
			var self = this;

			ed.addButton ('pardot', {
				'title' : 'Pardot',
				'image' : url+'/pardot-button.png',
				'onclick' : function () {
					dialog = '<div class="htmleditorfield-dialog htmleditorfield-pardotdialog loading">';
					jQuery('body').append(dialog);
					jQuery.ajax({
						url: '/pardot',
						complete: function() {
							jQuery('.htmleditorfield-pardotdialog').removeClass('loading');
						},
						success: function(html) {
							jQuery('.htmleditorfield-pardotdialog').html(html);
						}
					});
				}
			});
		},

		getInfo : function() {
			return {
				longname  : 'pardot',
				author    : 'Bluehouse Group',
				authorurl : 'https://github.com/bluehousegroup/',
				infourl   : 'https://github.com/bluehousegroup/silverstripe-pardot',
				version   : "1.0"
			};
		}
	});

	tinymce.PluginManager.add('pardot', tinymce.plugins.pardot);
})();