razy.elad
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Hacks
In reply to: How to add links to tooltip (plugin development)?sure, please see below
1. a hreffunction foo(json) { var obj = JSON.parse(json); this.name = obj.name; var content = tinyMCE.activeEditor.getContent(); var search_for = obj.name; var split_content = content.split(search_for); //---------------- decorate the item's text in the post - add a floating "micro site"------------------------ var tmp = split_content[0] + " " + '<a class="tooltip" href="#">'+ search_for ; tmp += '<span class="classic">'; tmp += 'Start decorate tooltip'; // this is outputted as nice tooltip tmp += '<a href="https://www.google.com">call google</a>'; // this is concatenated to the post's' text instead of being in the tooltip tmp += '<span>'; tmp += '</span>'; tmp += '</span>'; tmp += '</a>'; //----------------- ---------------------- for (i = 1; i < split_content.length; i++) {tmp += split_content[i] ;} tinyMCE.activeEditor.setContent(tmp); }
2. jQuery tooltip
function foo(json) { var obj = JSON.parse(json); this.name = obj.name; var content = tinyMCE.activeEditor.getContent(); var search_for = obj.name; var split_content = content.split(search_for); //---------------- decorate the item's text in the post - add a floating "micro site"------------------------ var tmp = split_content[0] + " " ; tmp += '<label id="search_1" title="initial tooltip">' + search_for + '</label>' ; tmp += '<script type="text/javascript">' ; tmp += 'jQuery( document ).ready(function() {' ; tmp += ' jQuery(function() {' ; tmp += ' jQuery( "#search_1" ).tooltip({' ; // this is not outputted although in native php engine it replace the the "initial tooltip" tmp += ' content: "https://www.google.com"' ; tmp += ' })});' ; tmp += '});' ; tmp += '</script>' ; //----------------- ---------------------- for (i = 1; i < split_content.length; i++) {tmp += split_content[i] ;} tinyMCE.activeEditor.setContent(tmp); }
Viewing 1 replies (of 1 total)