Enhance shortcode menu with Thickbox prompt

This commit is contained in:
Brian Miyaji
2014-07-12 02:33:53 +10:00
parent 89276205fd
commit bfb06c64bc
11 changed files with 900 additions and 230 deletions

View File

@@ -74,14 +74,35 @@
text-align: center;
}
.wp-media-buttons .add_sportspress span.wp-media-buttons-icon:before {
font: normal 20px/1 sportspress, dashicons;
/* Prefs */
.sp-prefs .button {
margin: 0 3px 4px 0;
padding: 0 7px 1px 5px;
}
.sp-prefs .button input[type=checkbox] {
background: transparent;
border: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.sp-prefs .button input[type=checkbox]:not(:checked):before {
float: left;
display: inline-block;
vertical-align: middle;
width: 16px;
font: 400 21px/1 dashicons;
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
content: '\f111';
content: '\f335';
margin: -3px 0 0 -4px;
color: #a00;
}
/* TinyMCE */
i.mce-i-sp_shortcodes_button:before, span.mce_sp_shortcodes_button:before {
font-family: 'sportspress';
speak: none;

View File

@@ -3,15 +3,22 @@
$strings = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ':{
sportspress:{
insert: "' . esc_js( __( 'SportsPress shortcodes', 'sportspress' ) ) . '",
auto: "' . esc_js( __( 'Auto', 'sportspress' ) ) . '",
manual: "' . esc_js( __( 'Manual', 'sportspress' ) ) . '",
single: "' . esc_js( __( 'Single', 'sportspress' ) ) . '",
select: "' . esc_js( __( 'Select...', 'sportspress' ) ) . '",
countdown: "' . esc_js( __( 'Countdown', 'sportspress' ) ) . '",
event_details: "' . esc_js( __( 'Event Details', 'sportspress' ) ) . '",
event_results: "' . esc_js( __( 'Event Results', 'sportspress' ) ) . '",
event_performance: "' . esc_js( __( 'Event Performance', 'sportspress' ) ) . '",
event_calendar: "' . esc_js( __( 'Event Calendar', 'sportspress' ) ) . '",
event_list: "' . esc_js( __( 'Event List', 'sportspress' ) ) . '",
event_blocks: "' . esc_js( __( 'Event Blocks', 'sportspress' ) ) . '",
event: "' . esc_js( __( 'Event', 'sportspress' ) ) . '",
details: "' . esc_js( __( 'Details', 'sportspress' ) ) . '",
results: "' . esc_js( __( 'Results', 'sportspress' ) ) . '",
performance: "' . esc_js( __( 'Performance', 'sportspress' ) ) . '",
calendar: "' . esc_js( __( 'Calendar', 'sportspress' ) ) . '",
list: "' . esc_js( __( 'List', 'sportspress' ) ) . '",
blocks: "' . esc_js( __( 'Blocks', 'sportspress' ) ) . '",
league_table: "' . esc_js( __( 'League Table', 'sportspress' ) ) . '",
player_list: "' . esc_js( __( 'Player List', 'sportspress' ) ) . '",
player_gallery: "' . esc_js( __( 'Player Gallery', 'sportspress' ) ) . '"
player: "' . esc_js( __( 'Player', 'sportspress' ) ) . '",
statistics: "' . esc_js( __( 'Statistics', 'sportspress' ) ) . '",
list: "' . esc_js( __( 'List', 'sportspress' ) ) . '",
gallery: "' . esc_js( __( 'Gallery', 'sportspress' ) ) . '"
}
}})';
}})';

View File

@@ -10,63 +10,202 @@
menu: [
{
text: ed.getLang( 'sportspress.countdown' ),
onclick: function() {
editor.insertContent( '[countdown id="" live=""]' );
}
menu: [
{
text: ed.getLang( 'sportspress.manual' ),
onclick: function() {
editor.insertContent( '[countdown id="" live="1"]' );
}
},
{
text: ed.getLang( 'sportspress.auto' ),
onclick: function() {
editor.insertContent( '[countdown]' );
}
}
]
},
{
text: ed.getLang( 'sportspress.event_details' ),
onclick: function() {
editor.insertContent( '[event_details id=""]' );
}
},
{
text: ed.getLang( 'sportspress.event_results' ),
onclick: function() {
editor.insertContent( '[event_results id=""]' );
}
},
{
text: ed.getLang( 'sportspress.event_performance' ),
onclick: function() {
editor.insertContent( '[event_performance id=""]' );
}
},
{
text: ed.getLang( 'sportspress.event_calendar' ),
onclick: function() {
editor.insertContent( '[event_calendar id="" status="default" show_all_events_link="0"]' );
}
},
{
text: ed.getLang( 'sportspress.event_list' ),
onclick: function() {
editor.insertContent( '[event_list id="" status="default" show_all_events_link="0"]' );
}
},
{
text: ed.getLang( 'sportspress.event_blocks' ),
onclick: function() {
editor.insertContent( '[event_blocks id="" status="default" show_all_events_link="0"]' );
}
text: ed.getLang( 'sportspress.event' ),
menu: [
{
text: ed.getLang( 'sportspress.single' ),
menu: [
{
text: ed.getLang( 'sportspress.details' ),
onclick: function() {
editor.insertContent( '[event_details id=""]' );
}
},
{
text: ed.getLang( 'sportspress.results' ),
onclick: function() {
editor.insertContent( '[event_results id=""]' );
}
},
{
text: ed.getLang( 'sportspress.performance' ),
onclick: function() {
editor.insertContent( '[event_performance id=""]' );
}
}
]
},
{
text: ed.getLang( 'sportspress.calendar' ),
menu: [
{
text: ed.getLang( 'sportspress.select' ),
onclick : function() {
// triggers the thickbox
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( 'My WIndow POPUP Title', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=sp_choose_event_calendar' );
}
},
{
text: ed.getLang( 'sportspress.manual' ),
onclick: function() {
editor.insertContent( '[event_calendar id="" status="default" initial="1" show_all_events_link="0"]' );
}
},
{
text: ed.getLang( 'sportspress.auto' ),
onclick: function() {
editor.insertContent( '[event_calendar]' );
}
}
]
},
{
text: ed.getLang( 'sportspress.list' ),
menu: [
{
text: ed.getLang( 'sportspress.select' ),
onclick : function() {
// triggers the thickbox
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( 'My WIndow POPUP Title', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=sp_choose_event_list' );
}
},
{
text: ed.getLang( 'sportspress.manual' ),
onclick: function() {
editor.insertContent( '[event_list id="" status="default" show_all_events_link="0"]' );
}
}
]
},
{
text: ed.getLang( 'sportspress.blocks' ),
menu: [
{
text: ed.getLang( 'sportspress.select' ),
onclick : function() {
// triggers the thickbox
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( 'My WIndow POPUP Title', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=sp_choose_event_blocks' );
}
},
{
text: ed.getLang( 'sportspress.manual' ),
onclick: function() {
editor.insertContent( '[event_blocks id="" status="default" show_all_events_link="0"]' );
}
}
]
}
]
},
{
text: ed.getLang( 'sportspress.league_table' ),
onclick: function() {
editor.insertContent( '[league_table id="" number="-1" show_team_logo="1" link_posts="0" show_full_table_link="0"]' );
}
menu: [
{
text: ed.getLang( 'sportspress.select' ),
onclick : function() {
// triggers the thickbox
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( 'My WIndow POPUP Title', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=sp_choose_league_table' );
}
},
{
text: ed.getLang( 'sportspress.manual' ),
onclick: function() {
editor.insertContent( '[league_table id="" number="-1" show_team_logo="1" link_posts="0" show_full_table_link="0"]' );
}
}
]
},
{
text: ed.getLang( 'sportspress.player_list' ),
onclick: function() {
editor.insertContent( '[player_list id="" number="-1" orderby="default" order="ASC" show_all_players_link="0"]' );
}
},
{
text: ed.getLang( 'sportspress.player_gallery' ),
onclick: function() {
editor.insertContent( '[event_blocks id="" number="-1" columns="3" orderby="default" order="ASC" size="thumbnail" show_all_players_link="0"]' );
}
text: ed.getLang( 'sportspress.player' ),
menu: [
{
text: ed.getLang( 'sportspress.single' ),
menu: [
{
text: ed.getLang( 'sportspress.details' ),
onclick: function() {
editor.insertContent( '[player_details id=""]' );
}
},
{
text: ed.getLang( 'sportspress.statistics' ),
onclick: function() {
editor.insertContent( '[player_statistics id=""]' );
}
}
]
},
{
text: ed.getLang( 'sportspress.list' ),
menu: [
{
text: ed.getLang( 'sportspress.select' ),
onclick : function() {
// triggers the thickbox
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( 'My WIndow POPUP Title', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=sp_choose_player_list' );
}
},
{
text: ed.getLang( 'sportspress.manual' ),
onclick: function() {
editor.insertContent( '[player_list id="" number="-1" orderby="default" order="ASC" show_all_players_link="0"]' );
}
}
]
},
{
text: ed.getLang( 'sportspress.gallery' ),
menu: [
{
text: ed.getLang( 'sportspress.select' ),
onclick : function() {
// triggers the thickbox
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( 'My WIndow POPUP Title', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=sp_choose_player_gallery' );
}
},
{
text: ed.getLang( 'sportspress.manual' ),
onclick: function() {
editor.insertContent( '[player_gallery id="" number="-1" columns="3" orderby="default" order="ASC" size="thumbnail" show_all_players_link="0"]' );
}
}
]
}
]
}
]
});