[44] | 1 | function getContentFromEditor() {
|
---|
| 2 | var data = '';
|
---|
| 3 | if ( (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden() ) { // Tiny MCE
|
---|
| 4 | tinyMCE.triggerSave();
|
---|
| 5 | data = jQuery("#content").val().stripTags();
|
---|
| 6 | } else if ( typeof FCKeditorAPI != "undefined" ) { // FCK Editor
|
---|
| 7 | var oEditor = FCKeditorAPI.GetInstance('content') ;
|
---|
| 8 | data = oEditor.GetHTML().stripTags();
|
---|
| 9 | } else if ( typeof WYM_INSTANCES != "undefined" ) { // Simple WYMeditor
|
---|
| 10 | data = WYM_INSTANCES[0].xhtml().stripTags();
|
---|
| 11 | } else { // No editor, just quick tags
|
---|
| 12 | data = jQuery("#content").val().stripTags();
|
---|
| 13 | }
|
---|
| 14 | return data;
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | function registerClickTags() {
|
---|
| 18 | jQuery("#suggestedtags .inside span").click(function() { addTag(this.innerHTML); });
|
---|
| 19 | jQuery('#st_ajax_loading').hide();
|
---|
| 20 | if ( jQuery('#suggestedtags .inside').css('display') != 'block' ) {
|
---|
| 21 | jQuery('#suggestedtags').toggleClass('closed');
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | jQuery(document).ready(function() {
|
---|
| 26 | // Yahoo API
|
---|
| 27 | jQuery("a.yahoo_api").click(function() {
|
---|
| 28 | jQuery('#st_ajax_loading').show();
|
---|
| 29 | jQuery("#suggestedtags .inside").load( site_url + '/wp-admin/admin.php?st_ajax_action=tags_from_yahoo', {content:getContentFromEditor(),title:jQuery("#title").val(),tags:jQuery("#tags-input").val()}, function(){
|
---|
| 30 | registerClickTags();
|
---|
| 31 | });
|
---|
| 32 | return false;
|
---|
| 33 | });
|
---|
| 34 | // Local Tags Database
|
---|
| 35 | jQuery("a.local_db").click(function() {
|
---|
| 36 | jQuery('#st_ajax_loading').show();
|
---|
| 37 | jQuery("#suggestedtags .inside").load( site_url + '/wp-admin/admin.php?st_ajax_action=tags_from_local_db', {content:getContentFromEditor(),title:jQuery("#title").val()}, function(){
|
---|
| 38 | registerClickTags();
|
---|
| 39 | });
|
---|
| 40 | return false;
|
---|
| 41 | });
|
---|
| 42 | // Tag The Net API
|
---|
| 43 | jQuery("a.ttn_api").click(function() {
|
---|
| 44 | jQuery('#st_ajax_loading').show();
|
---|
| 45 | jQuery("#suggestedtags .inside").load( site_url + '/wp-admin/admin.php?st_ajax_action=tags_from_tagthenet', {content:getContentFromEditor(),title:jQuery("#title").val()}, function(){
|
---|
| 46 | registerClickTags();
|
---|
| 47 | });
|
---|
| 48 | return false;
|
---|
| 49 | });
|
---|
| 50 | }); |
---|