| 1 |
/* |
| 2 |
* Tinymce plugin for Analytify |
| 3 |
*/ |
| 4 |
|
| 5 |
(function() { |
| 6 |
tinymce.create('tinymce.plugins.analytify', { |
| 7 |
|
| 8 |
init : function(editor, url) { |
| 9 |
|
| 10 |
editor.addButton( 'analytifystats', { |
| 11 |
title: 'Analytify Shortcodes', |
| 12 |
type: 'menubutton', |
| 13 |
icon: 'icon analytify-shortcodes-icon', |
| 14 |
menu: [ |
| 15 |
/** Simple **/ |
| 16 |
{ |
| 17 |
text: 'Simple', |
| 18 |
onclick: function() { |
| 19 |
|
| 20 |
editor.windowManager.open( { |
| 21 |
|
| 22 |
title: 'Analytify Simple Shortcodes: Returns selected data', |
| 23 |
body: [ |
| 24 |
{ |
| 25 |
type: 'listbox', |
| 26 |
name: 'metrics', |
| 27 |
label: 'Metrics :', |
| 28 |
'values': [ |
| 29 |
{text: 'Users', value: 'ga:users'}, |
| 30 |
{text: 'New Users', value: 'ga:newUsers'}, |
| 31 |
{text: 'Percent New Sessions', value: 'ga:percentNewSessions'}, |
| 32 |
{text: '----- Session Management -----', value: ''}, |
| 33 |
{text: 'Sessions', value: 'ga:sessions'}, |
| 34 |
{text: 'Bounces', value: 'ga:bounces'}, |
| 35 |
{text: 'BounceRate', value: 'ga:bounceRate'}, |
| 36 |
{text: 'Session Duration', value: 'ga:sessionDuration'}, |
| 37 |
{text: 'Avg Session Duration', value: 'ga:avgSessionDuration'}, |
| 38 |
{text: 'Percent New Sessions', value: 'ga:percentNewSessions'}, |
| 39 |
{text: '----- Page Tracking -----', value: ''}, |
| 40 |
{text: 'Page Value', value: 'ga:pageValue'}, |
| 41 |
{text: 'Entrances', value: 'ga:entrances'}, |
| 42 |
{text: 'Page views', value: 'ga:pageviews'}, |
| 43 |
{text: 'Unique Pageviews', value: 'ga:uniquePageviews'}, |
| 44 |
{text: 'Exits', value: 'ga:exits'}, |
| 45 |
{text: 'Exit Rate', value: 'ga:exitRate'}, |
| 46 |
{text: 'Time On Page', value: 'ga:timeOnPage'}, |
| 47 |
{text: 'Avg Time On Page', value: 'ga:avgTimeOnPage'} |
| 48 |
] |
| 49 |
}, |
| 50 |
{ |
| 51 |
type: 'listbox', |
| 52 |
name: 'permission_view', |
| 53 |
label: 'Visible to :', |
| 54 |
'values': [ |
| 55 |
{text: 'Everyone', value: ""}, |
| 56 |
{text: 'Administrator', value: 'administrator'}, |
| 57 |
{text: 'Editor', value: 'editor'}, |
| 58 |
{text: 'Author', value: 'author'}, |
| 59 |
{text: 'Contributor', value: 'contributor'} |
| 60 |
] |
| 61 |
} |
| 62 |
], |
| 63 |
onsubmit: function( e ) { |
| 64 |
editor.insertContent( '[analytify-stats metrics="' + e.data.metrics + '" permission_view="' + e.data.permission_view + '"]'); |
| 65 |
} |
| 66 |
}); |
| 67 |
} |
| 68 |
}, |
| 69 |
|
| 70 |
/** Advanced **/ |
| 71 |
{ |
| 72 |
text: 'Advanced', |
| 73 |
onclick: function() { |
| 74 |
tb_show("Analytify Advanced Shortcodes: Use it according to your needs.", "admin-ajax.php?action=analytify_advanced_shortcode"); |
| 75 |
tinymce.DOM.setStyle(["TB_overlay", "TB_window", "TB_load"], "z-index", "999999"); |
| 76 |
var tb = jQuery("#TB_window"); |
| 77 |
if (tb) |
| 78 |
{ |
| 79 |
var tbCont = tb.find('#TB_ajaxContent'); |
| 80 |
tbCont.css({ width : 'auto', height : 'auto',background : '#efefef' }); |
| 81 |
|
| 82 |
} |
| 83 |
} |
| 84 |
} |
| 85 |
] |
| 86 |
}); |
| 87 |
}, |
| 88 |
createControl : function(n, cm) { |
| 89 |
return null; |
| 90 |
}, |
| 91 |
getInfo : function() { |
| 92 |
return { |
| 93 |
longname : "Analytify Shortcodes - Show selected analytics", |
| 94 |
author : 'Adnan', |
| 95 |
authorurl : 'http://wp-analytify.com/', |
| 96 |
infourl : 'http://wp-analytify.com/', |
| 97 |
version : "1.1" |
| 98 |
}; |
| 99 |
} |
| 100 |
}); |
| 101 |
|
| 102 |
tinymce.PluginManager.add('analytifystats', tinymce.plugins.analytify); |
| 103 |
})(); |