Changeset 1303074
- Timestamp:
- 12/08/2015 03:36:36 PM (10 years ago)
- Location:
- responsive-mobile-friendly-tooltip
- Files:
-
- 6 edited
- 1 copied
-
tags/1.6 (copied) (copied from responsive-mobile-friendly-tooltip/trunk)
-
tags/1.6/readme.txt (modified) (2 diffs)
-
tags/1.6/responsive-tooltip-tinyMCE.js (modified) (3 diffs)
-
tags/1.6/responsive-tooltip.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/responsive-tooltip-tinyMCE.js (modified) (3 diffs)
-
trunk/responsive-tooltip.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
responsive-mobile-friendly-tooltip/tags/1.6/readme.txt
r847542 r1303074 3 3 Tags: Tooltip, tinyMCE, responsive, mobile-friendly 4 4 Requires at least: 3.0.1 5 Tested up to: 3.86 Stable tag: 1. 5.25 Tested up to: 4.3 6 Stable tag: 1.6 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 44 44 == Changelog == 45 45 46 = 1.6 = 47 * Both "Invert" and "Hover" attributes are deprecated. 48 * Hopefully all bugs fixed. 49 * Dialog is working again. 50 46 51 = 1.5.2 = 47 52 * added the ajax folder we.. lost -
responsive-mobile-friendly-tooltip/tags/1.6/responsive-tooltip-tinyMCE.js
r765061 r1303074 1 /*---------------------Dialog backend-----------------------*/ 2 var RMFtooltip; 3 4 ( function( $ ) { 5 var editor, 6 inputs = {}; 7 8 RMFtooltip = { 9 init: function() { 10 inputs.wrap = $('#rmf-tooltip-wrap'); 11 inputs.dialog = $( '#rmf-tooltip' ); 12 inputs.backdrop = $( '#rmf-tooltip-backdrop' ); 13 inputs.submit = $( '#rmf-tooltip-submit' ); 14 inputs.close = $( '#rmf-tooltip-close' ); 15 16 // Input 17 inputs.text = $( '#rmf-tooltip-text' ); 18 inputs.tip = $( '#rmf-tooltip-tip' ); 19 20 // Bind event handlers 21 inputs.submit.click( function( event ) { 22 event.preventDefault(); 23 RMFtooltip.update(); 24 }); 25 inputs.close.add( inputs.backdrop ).add( '#rmf-tooltip-cancel a' ).click( function( event ) { 26 event.preventDefault(); 27 RMFtooltip.close(); 28 }); 29 30 }, 31 32 open: function( editorId ) { 33 var ed, 34 $body = $( document.body ); 35 36 $body.addClass( 'modal-open' ); 37 38 RMFtooltip.range = null; 39 40 if ( editorId ) { 41 window.wpActiveEditor = editorId; 42 } 43 44 if ( ! window.wpActiveEditor ) { 45 return; 46 } 47 48 this.textarea = $( '#' + window.wpActiveEditor ).get( 0 ); 49 50 if ( typeof tinymce !== 'undefined' ) { 51 // Make sure the link wrapper is the last element in the body, 52 // or the inline editor toolbar may show above the backdrop. 53 $body.append( inputs.backdrop, inputs.wrap ); 54 55 ed = tinymce.get( wpActiveEditor ); 56 57 if ( ed && ! ed.isHidden() ) { 58 editor = ed; 59 } else { 60 editor = null; 61 } 62 } 63 inputs.wrap.show(); 64 inputs.backdrop.show(); 65 66 }, 67 68 close: function() { 69 $( document.body ).removeClass( 'modal-open' ); 70 RMFtooltip.textarea.focus(); 71 inputs.backdrop.hide(); 72 inputs.wrap.hide(); 73 RMFtooltip_tip = inputs.tip.val(); 74 RMFtooltip_text = inputs.text.val(); 75 inputs.tip.val(''); 76 inputs.text.val(''); 77 }, 78 update: function update () { 79 /*var attrs = RMFtooltip.getAttrs(), 80 link, text;*/ 81 RMFtooltip.close(); 82 editor.focus(); 83 if (RMFtooltip_text != null && RMFtooltip_text != '' && RMFtooltip_tip != null && RMFtooltip_tip != ''){ 84 editor.execCommand('mceInsertContent', false, '[tooltip tip="'+RMFtooltip_tip+'"]'+RMFtooltip_text+'[/tooltip]'); 85 } 86 editor.nodeChanged(); 87 }, 88 } 89 $( document ).ready( RMFtooltip.init ); 90 })( jQuery ); 91 /*---------------Integrate with TinyMCE---------------------*/ 1 92 (function() { 2 93 tinymce.create('tinymce.plugins.RMFtooltip', { … … 5 96 title : 'ToolTip', 6 97 image : url+'/RMFtooltipbutton.png', 7 onclick : function() { 8 i = jQuery('<div title="Create your tooltip" ></div>'); 9 if (window.RMFtooltip_cache) { 10 i.html(window.RMFtooltip_cache); 11 } else { 12 jQuery.get(url+'/ajax/form.html', function(data) { 13 window.RMFtooltip_cache = data; 14 i.html(window.RMFtooltip_cache); 15 }); 16 } 17 i.dialog({ 18 autoOpen: true, 19 draggable: false, 20 resizable: false, 21 modal: true, 22 dialogClass: 'wp-dialog', 23 buttons: { 24 "OK": function() { 25 RMFtooltip_text = jQuery("#RMFtooltip_text").val(); 26 RMFtooltip_tip = jQuery("#RMFtooltip_tip").val(); 27 if (RMFtooltip_text != null && RMFtooltip_text != '' && RMFtooltip_tip != null && RMFtooltip_tip != ''){ 28 ed.execCommand('mceInsertContent', false, '[tooltip tip="'+RMFtooltip_tip+'"]'+RMFtooltip_text+'[/tooltip]'); 29 } 30 jQuery( this ).dialog( "close" ); 31 jQuery(this).empty(); 32 }, 33 Cancel: function() { 34 jQuery( this ).dialog( "destroy" ); 35 jQuery(this).empty(); 36 } 37 } 38 }); 39 } 98 cmd : 'RMFtooltip_cmd' 40 99 }); 100 ed.addCommand('RMFtooltip_cmd', function() { 101 window.RMFtooltip && window.RMFtooltip.open( ed.id ); 102 }); 103 41 104 }, 42 105 createControl : function(n, cm) { … … 49 112 authorurl : 'itayxd.com', 50 113 infourl : 'https://github.com/ItayXD/responsive-tooltip', 51 version : "1. 0"114 version : "1.6" 52 115 }; 53 116 } -
responsive-mobile-friendly-tooltip/tags/1.6/responsive-tooltip.php
r847545 r1303074 4 4 Plugin URI: https://github.com/ItayXD/responsive-tooltip 5 5 Description: Responsive and mobile-friendly tooltip to present tiny amount of hidden content - the tip. 6 Version: 1. 5.26 Version: 1.6 7 7 Author: ItayXD 8 8 Author URI: itayxd.com … … 14 14 extract(shortcode_atts(array( 15 15 'tip' => null, 16 'hover' => null, 17 'invert' => false, // deprecated16 'hover' => null, // deprecated 17 'invert' => false,// deprecated 18 18 ), $atts)); 19 19 … … 22 22 list ($tip, $hover) = array ($hover, $tip); 23 23 } 24 24 //deprecated 25 25 if ($content && ($tip || $hover)) { 26 26 $content = do_shortcode( $content ); … … 52 52 function RMFtooltip_button() { 53 53 54 /*if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {54 if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) { 55 55 return; 56 56 } 57 57 58 if ( get_user_option('rich_editing') == 'true' ) { */58 if ( get_user_option('rich_editing') == 'true' ) { 59 59 add_filter( 'mce_external_plugins', 'RMFtooltip_add_plugin' ); 60 60 add_filter( 'mce_buttons', 'RMFtooltip_register_button' ); 61 //}61 } 62 62 63 63 } … … 68 68 69 69 /*-------------------- Adds needed stylesheets and Js --------------------*/ 70 70 //For the front-site 71 71 add_action( 'wp_enqueue_scripts', 'RMFtooltip_stylesheet_js' ); 72 72 … … 77 77 wp_enqueue_script( 'RMFtooltip-js' ); 78 78 } 79 //For admin panel 80 add_action( 'admin_enqueue_scripts', 'RMFtooltip_admin__stylesheet' ); 81 82 function RMFtooltip_admin__stylesheet() { 83 wp_register_style( 'RMFtooltip-admin-css', plugins_url('responsive-tooltip-dialog.css', __FILE__) ); 84 wp_enqueue_style( 'RMFtooltip-admin-css' ); 85 } 79 86 /*-------------------- Version Handling --------------------*/ 80 $c_version = 1. 2; // Current version87 $c_version = 1.6; // Current version 81 88 $o_version = get_option(RMFtooltip_version); //Gets old version 82 89 if ( $c_version > $o_version ) { … … 95 102 file_put_contents(plugin_dir_path(__FILE__) . 'responsive-tooltip.css', $css_file, LOCK_EX); 96 103 } 104 105 /*-------------------------------TinyMCE Dialog-------------------------------*/ 106 107 function rmf_tooltip_dialog() { //Creates the dialog (HTML) 108 ?> 109 <div id="rmf-tooltip-backdrop" style="display: none"></div> 110 <div id="rmf-tooltip-wrap" class="wp-core-ui" style="display: none"> 111 <form id="rmf-tooltip" tabindex="-1"> 112 <div id="tooltip-modal-title"> 113 <?php _e( 'Tooltip wizard' ) ?> 114 <button type="button" id="rmf-tooltip-close"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button> 115 </div> 116 <div id="tip-creator"> 117 <div id="tip-options"> 118 <p class="howto"><?php _e( 'The tip will pop up will the text is hovered' ); ?></p> 119 <div> 120 <label><span><?php _e( 'The tip' ); ?></span><input id="rmf-tooltip-tip" type="text" /></label> 121 </div> 122 <div class="rmf-tooltip-text-field"> 123 <label><span><?php _e( 'The base text' ); ?></span><input id="rmf-tooltip-text" type="text" /></label> 124 </div> 125 </div> 126 </div> 127 <div class="submitbox"> 128 <div id="rmf-tooltip-cancel"> 129 <a class="submitdelete deletion" href="#"><?php _e( 'Cancel' ); ?></a> 130 </div> 131 <div id="rmf-tooltip-update"> 132 <input type="submit" value="<?php esc_attr_e( 'Add Tip' ); ?>" class="button button-primary" id="rmf-tooltip-submit" name="rmf-tooltip-submit"> 133 </div> 134 </div> 135 </form> 136 </div> 137 <?php 138 } 139 add_action( 'after_wp_tiny_mce', 'rmf_tooltip_dialog' ); //Runs after tiny mce loads -
responsive-mobile-friendly-tooltip/trunk/readme.txt
r847542 r1303074 3 3 Tags: Tooltip, tinyMCE, responsive, mobile-friendly 4 4 Requires at least: 3.0.1 5 Tested up to: 3.86 Stable tag: 1. 5.25 Tested up to: 4.3 6 Stable tag: 1.6 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 44 44 == Changelog == 45 45 46 = 1.6 = 47 * Both "Invert" and "Hover" attributes are deprecated. 48 * Hopefully all bugs fixed. 49 * Dialog is working again. 50 46 51 = 1.5.2 = 47 52 * added the ajax folder we.. lost -
responsive-mobile-friendly-tooltip/trunk/responsive-tooltip-tinyMCE.js
r765061 r1303074 1 /*---------------------Dialog backend-----------------------*/ 2 var RMFtooltip; 3 4 ( function( $ ) { 5 var editor, 6 inputs = {}; 7 8 RMFtooltip = { 9 init: function() { 10 inputs.wrap = $('#rmf-tooltip-wrap'); 11 inputs.dialog = $( '#rmf-tooltip' ); 12 inputs.backdrop = $( '#rmf-tooltip-backdrop' ); 13 inputs.submit = $( '#rmf-tooltip-submit' ); 14 inputs.close = $( '#rmf-tooltip-close' ); 15 16 // Input 17 inputs.text = $( '#rmf-tooltip-text' ); 18 inputs.tip = $( '#rmf-tooltip-tip' ); 19 20 // Bind event handlers 21 inputs.submit.click( function( event ) { 22 event.preventDefault(); 23 RMFtooltip.update(); 24 }); 25 inputs.close.add( inputs.backdrop ).add( '#rmf-tooltip-cancel a' ).click( function( event ) { 26 event.preventDefault(); 27 RMFtooltip.close(); 28 }); 29 30 }, 31 32 open: function( editorId ) { 33 var ed, 34 $body = $( document.body ); 35 36 $body.addClass( 'modal-open' ); 37 38 RMFtooltip.range = null; 39 40 if ( editorId ) { 41 window.wpActiveEditor = editorId; 42 } 43 44 if ( ! window.wpActiveEditor ) { 45 return; 46 } 47 48 this.textarea = $( '#' + window.wpActiveEditor ).get( 0 ); 49 50 if ( typeof tinymce !== 'undefined' ) { 51 // Make sure the link wrapper is the last element in the body, 52 // or the inline editor toolbar may show above the backdrop. 53 $body.append( inputs.backdrop, inputs.wrap ); 54 55 ed = tinymce.get( wpActiveEditor ); 56 57 if ( ed && ! ed.isHidden() ) { 58 editor = ed; 59 } else { 60 editor = null; 61 } 62 } 63 inputs.wrap.show(); 64 inputs.backdrop.show(); 65 66 }, 67 68 close: function() { 69 $( document.body ).removeClass( 'modal-open' ); 70 RMFtooltip.textarea.focus(); 71 inputs.backdrop.hide(); 72 inputs.wrap.hide(); 73 RMFtooltip_tip = inputs.tip.val(); 74 RMFtooltip_text = inputs.text.val(); 75 inputs.tip.val(''); 76 inputs.text.val(''); 77 }, 78 update: function update () { 79 /*var attrs = RMFtooltip.getAttrs(), 80 link, text;*/ 81 RMFtooltip.close(); 82 editor.focus(); 83 if (RMFtooltip_text != null && RMFtooltip_text != '' && RMFtooltip_tip != null && RMFtooltip_tip != ''){ 84 editor.execCommand('mceInsertContent', false, '[tooltip tip="'+RMFtooltip_tip+'"]'+RMFtooltip_text+'[/tooltip]'); 85 } 86 editor.nodeChanged(); 87 }, 88 } 89 $( document ).ready( RMFtooltip.init ); 90 })( jQuery ); 91 /*---------------Integrate with TinyMCE---------------------*/ 1 92 (function() { 2 93 tinymce.create('tinymce.plugins.RMFtooltip', { … … 5 96 title : 'ToolTip', 6 97 image : url+'/RMFtooltipbutton.png', 7 onclick : function() { 8 i = jQuery('<div title="Create your tooltip" ></div>'); 9 if (window.RMFtooltip_cache) { 10 i.html(window.RMFtooltip_cache); 11 } else { 12 jQuery.get(url+'/ajax/form.html', function(data) { 13 window.RMFtooltip_cache = data; 14 i.html(window.RMFtooltip_cache); 15 }); 16 } 17 i.dialog({ 18 autoOpen: true, 19 draggable: false, 20 resizable: false, 21 modal: true, 22 dialogClass: 'wp-dialog', 23 buttons: { 24 "OK": function() { 25 RMFtooltip_text = jQuery("#RMFtooltip_text").val(); 26 RMFtooltip_tip = jQuery("#RMFtooltip_tip").val(); 27 if (RMFtooltip_text != null && RMFtooltip_text != '' && RMFtooltip_tip != null && RMFtooltip_tip != ''){ 28 ed.execCommand('mceInsertContent', false, '[tooltip tip="'+RMFtooltip_tip+'"]'+RMFtooltip_text+'[/tooltip]'); 29 } 30 jQuery( this ).dialog( "close" ); 31 jQuery(this).empty(); 32 }, 33 Cancel: function() { 34 jQuery( this ).dialog( "destroy" ); 35 jQuery(this).empty(); 36 } 37 } 38 }); 39 } 98 cmd : 'RMFtooltip_cmd' 40 99 }); 100 ed.addCommand('RMFtooltip_cmd', function() { 101 window.RMFtooltip && window.RMFtooltip.open( ed.id ); 102 }); 103 41 104 }, 42 105 createControl : function(n, cm) { … … 49 112 authorurl : 'itayxd.com', 50 113 infourl : 'https://github.com/ItayXD/responsive-tooltip', 51 version : "1. 0"114 version : "1.6" 52 115 }; 53 116 } -
responsive-mobile-friendly-tooltip/trunk/responsive-tooltip.php
r847545 r1303074 4 4 Plugin URI: https://github.com/ItayXD/responsive-tooltip 5 5 Description: Responsive and mobile-friendly tooltip to present tiny amount of hidden content - the tip. 6 Version: 1. 5.26 Version: 1.6 7 7 Author: ItayXD 8 8 Author URI: itayxd.com … … 14 14 extract(shortcode_atts(array( 15 15 'tip' => null, 16 'hover' => null, 17 'invert' => false, // deprecated16 'hover' => null, // deprecated 17 'invert' => false,// deprecated 18 18 ), $atts)); 19 19 … … 22 22 list ($tip, $hover) = array ($hover, $tip); 23 23 } 24 24 //deprecated 25 25 if ($content && ($tip || $hover)) { 26 26 $content = do_shortcode( $content ); … … 52 52 function RMFtooltip_button() { 53 53 54 /*if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {54 if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) { 55 55 return; 56 56 } 57 57 58 if ( get_user_option('rich_editing') == 'true' ) { */58 if ( get_user_option('rich_editing') == 'true' ) { 59 59 add_filter( 'mce_external_plugins', 'RMFtooltip_add_plugin' ); 60 60 add_filter( 'mce_buttons', 'RMFtooltip_register_button' ); 61 //}61 } 62 62 63 63 } … … 68 68 69 69 /*-------------------- Adds needed stylesheets and Js --------------------*/ 70 70 //For the front-site 71 71 add_action( 'wp_enqueue_scripts', 'RMFtooltip_stylesheet_js' ); 72 72 … … 77 77 wp_enqueue_script( 'RMFtooltip-js' ); 78 78 } 79 //For admin panel 80 add_action( 'admin_enqueue_scripts', 'RMFtooltip_admin__stylesheet' ); 81 82 function RMFtooltip_admin__stylesheet() { 83 wp_register_style( 'RMFtooltip-admin-css', plugins_url('responsive-tooltip-dialog.css', __FILE__) ); 84 wp_enqueue_style( 'RMFtooltip-admin-css' ); 85 } 79 86 /*-------------------- Version Handling --------------------*/ 80 $c_version = 1. 2; // Current version87 $c_version = 1.6; // Current version 81 88 $o_version = get_option(RMFtooltip_version); //Gets old version 82 89 if ( $c_version > $o_version ) { … … 95 102 file_put_contents(plugin_dir_path(__FILE__) . 'responsive-tooltip.css', $css_file, LOCK_EX); 96 103 } 104 105 /*-------------------------------TinyMCE Dialog-------------------------------*/ 106 107 function rmf_tooltip_dialog() { //Creates the dialog (HTML) 108 ?> 109 <div id="rmf-tooltip-backdrop" style="display: none"></div> 110 <div id="rmf-tooltip-wrap" class="wp-core-ui" style="display: none"> 111 <form id="rmf-tooltip" tabindex="-1"> 112 <div id="tooltip-modal-title"> 113 <?php _e( 'Tooltip wizard' ) ?> 114 <button type="button" id="rmf-tooltip-close"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button> 115 </div> 116 <div id="tip-creator"> 117 <div id="tip-options"> 118 <p class="howto"><?php _e( 'The tip will pop up will the text is hovered' ); ?></p> 119 <div> 120 <label><span><?php _e( 'The tip' ); ?></span><input id="rmf-tooltip-tip" type="text" /></label> 121 </div> 122 <div class="rmf-tooltip-text-field"> 123 <label><span><?php _e( 'The base text' ); ?></span><input id="rmf-tooltip-text" type="text" /></label> 124 </div> 125 </div> 126 </div> 127 <div class="submitbox"> 128 <div id="rmf-tooltip-cancel"> 129 <a class="submitdelete deletion" href="#"><?php _e( 'Cancel' ); ?></a> 130 </div> 131 <div id="rmf-tooltip-update"> 132 <input type="submit" value="<?php esc_attr_e( 'Add Tip' ); ?>" class="button button-primary" id="rmf-tooltip-submit" name="rmf-tooltip-submit"> 133 </div> 134 </div> 135 </form> 136 </div> 137 <?php 138 } 139 add_action( 'after_wp_tiny_mce', 'rmf_tooltip_dialog' ); //Runs after tiny mce loads
Note: See TracChangeset
for help on using the changeset viewer.