Plugin Directory

Changeset 1303074


Ignore:
Timestamp:
12/08/2015 03:36:36 PM (10 years ago)
Author:
ItayXD
Message:

version 1.6, fix

Location:
responsive-mobile-friendly-tooltip
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • responsive-mobile-friendly-tooltip/tags/1.6/readme.txt

    r847542 r1303074  
    33Tags: Tooltip, tinyMCE, responsive, mobile-friendly
    44Requires at least: 3.0.1
    5 Tested up to: 3.8
    6 Stable tag: 1.5.2
     5Tested up to: 4.3
     6Stable tag: 1.6
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4444== Changelog ==
    4545
     46= 1.6 =
     47* Both "Invert" and "Hover" attributes are deprecated.
     48* Hopefully all bugs fixed.
     49* Dialog is working again.
     50
    4651= 1.5.2 =
    4752* added the ajax folder we.. lost
  • responsive-mobile-friendly-tooltip/tags/1.6/responsive-tooltip-tinyMCE.js

    r765061 r1303074  
     1/*---------------------Dialog backend-----------------------*/
     2var 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---------------------*/
    192(function() {
    293    tinymce.create('tinymce.plugins.RMFtooltip', {
     
    596                title : 'ToolTip',
    697                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'
    4099            });
     100            ed.addCommand('RMFtooltip_cmd', function() {
     101                window.RMFtooltip && window.RMFtooltip.open( ed.id );
     102            });
     103
    41104        },
    42105        createControl : function(n, cm) {
     
    49112                authorurl : 'itayxd.com',
    50113                infourl : 'https://github.com/ItayXD/responsive-tooltip',
    51                 version : "1.0"
     114                version : "1.6"
    52115            };
    53116        }
  • responsive-mobile-friendly-tooltip/tags/1.6/responsive-tooltip.php

    r847545 r1303074  
    44   Plugin URI: https://github.com/ItayXD/responsive-tooltip
    55   Description: Responsive and mobile-friendly tooltip to present tiny amount of hidden content - the tip.
    6    Version: 1.5.2
     6   Version: 1.6
    77   Author: ItayXD
    88   Author URI: itayxd.com
     
    1414    extract(shortcode_atts(array(
    1515        'tip' => null,
    16         'hover' => null,
    17         'invert' => false, // deprecated
     16        'hover' => null,   // deprecated
     17        'invert' => false,// deprecated
    1818    ), $atts));
    1919
     
    2222        list ($tip, $hover) = array ($hover, $tip);
    2323    }
    24    
     24    //deprecated
    2525    if ($content && ($tip || $hover)) {
    2626        $content = do_shortcode( $content );
     
    5252function RMFtooltip_button() {
    5353
    54  /*  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
     54   if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
    5555      return;
    5656   }
    5757
    58    if ( get_user_option('rich_editing') == 'true' ) {*/
     58   if ( get_user_option('rich_editing') == 'true' ) {
    5959      add_filter( 'mce_external_plugins', 'RMFtooltip_add_plugin' );
    6060      add_filter( 'mce_buttons', 'RMFtooltip_register_button' );
    61 //   }
     61   }
    6262
    6363}
     
    6868
    6969/*-------------------- Adds needed stylesheets and Js  --------------------*/
    70 
     70//For the front-site
    7171add_action( 'wp_enqueue_scripts', 'RMFtooltip_stylesheet_js' );
    7272
     
    7777    wp_enqueue_script( 'RMFtooltip-js' );
    7878}
     79//For admin panel
     80add_action( 'admin_enqueue_scripts', 'RMFtooltip_admin__stylesheet' );
     81
     82function 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}
    7986/*-------------------- Version Handling --------------------*/
    80 $c_version = 1.2; // Current version
     87$c_version = 1.6; // Current version
    8188$o_version = get_option(RMFtooltip_version); //Gets old version
    8289if ( $c_version > $o_version ) {
     
    95102   file_put_contents(plugin_dir_path(__FILE__) . 'responsive-tooltip.css', $css_file, LOCK_EX);
    96103}
     104
     105/*-------------------------------TinyMCE Dialog-------------------------------*/
     106
     107function 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}
     139add_action( 'after_wp_tiny_mce', 'rmf_tooltip_dialog' ); //Runs after tiny mce loads
  • responsive-mobile-friendly-tooltip/trunk/readme.txt

    r847542 r1303074  
    33Tags: Tooltip, tinyMCE, responsive, mobile-friendly
    44Requires at least: 3.0.1
    5 Tested up to: 3.8
    6 Stable tag: 1.5.2
     5Tested up to: 4.3
     6Stable tag: 1.6
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4444== Changelog ==
    4545
     46= 1.6 =
     47* Both "Invert" and "Hover" attributes are deprecated.
     48* Hopefully all bugs fixed.
     49* Dialog is working again.
     50
    4651= 1.5.2 =
    4752* added the ajax folder we.. lost
  • responsive-mobile-friendly-tooltip/trunk/responsive-tooltip-tinyMCE.js

    r765061 r1303074  
     1/*---------------------Dialog backend-----------------------*/
     2var 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---------------------*/
    192(function() {
    293    tinymce.create('tinymce.plugins.RMFtooltip', {
     
    596                title : 'ToolTip',
    697                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'
    4099            });
     100            ed.addCommand('RMFtooltip_cmd', function() {
     101                window.RMFtooltip && window.RMFtooltip.open( ed.id );
     102            });
     103
    41104        },
    42105        createControl : function(n, cm) {
     
    49112                authorurl : 'itayxd.com',
    50113                infourl : 'https://github.com/ItayXD/responsive-tooltip',
    51                 version : "1.0"
     114                version : "1.6"
    52115            };
    53116        }
  • responsive-mobile-friendly-tooltip/trunk/responsive-tooltip.php

    r847545 r1303074  
    44   Plugin URI: https://github.com/ItayXD/responsive-tooltip
    55   Description: Responsive and mobile-friendly tooltip to present tiny amount of hidden content - the tip.
    6    Version: 1.5.2
     6   Version: 1.6
    77   Author: ItayXD
    88   Author URI: itayxd.com
     
    1414    extract(shortcode_atts(array(
    1515        'tip' => null,
    16         'hover' => null,
    17         'invert' => false, // deprecated
     16        'hover' => null,   // deprecated
     17        'invert' => false,// deprecated
    1818    ), $atts));
    1919
     
    2222        list ($tip, $hover) = array ($hover, $tip);
    2323    }
    24    
     24    //deprecated
    2525    if ($content && ($tip || $hover)) {
    2626        $content = do_shortcode( $content );
     
    5252function RMFtooltip_button() {
    5353
    54  /*  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
     54   if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
    5555      return;
    5656   }
    5757
    58    if ( get_user_option('rich_editing') == 'true' ) {*/
     58   if ( get_user_option('rich_editing') == 'true' ) {
    5959      add_filter( 'mce_external_plugins', 'RMFtooltip_add_plugin' );
    6060      add_filter( 'mce_buttons', 'RMFtooltip_register_button' );
    61 //   }
     61   }
    6262
    6363}
     
    6868
    6969/*-------------------- Adds needed stylesheets and Js  --------------------*/
    70 
     70//For the front-site
    7171add_action( 'wp_enqueue_scripts', 'RMFtooltip_stylesheet_js' );
    7272
     
    7777    wp_enqueue_script( 'RMFtooltip-js' );
    7878}
     79//For admin panel
     80add_action( 'admin_enqueue_scripts', 'RMFtooltip_admin__stylesheet' );
     81
     82function 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}
    7986/*-------------------- Version Handling --------------------*/
    80 $c_version = 1.2; // Current version
     87$c_version = 1.6; // Current version
    8188$o_version = get_option(RMFtooltip_version); //Gets old version
    8289if ( $c_version > $o_version ) {
     
    95102   file_put_contents(plugin_dir_path(__FILE__) . 'responsive-tooltip.css', $css_file, LOCK_EX);
    96103}
     104
     105/*-------------------------------TinyMCE Dialog-------------------------------*/
     106
     107function 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}
     139add_action( 'after_wp_tiny_mce', 'rmf_tooltip_dialog' ); //Runs after tiny mce loads
Note: See TracChangeset for help on using the changeset viewer.