From 07a745ab72109537cfe437ad8f8fdfede6432a30 Mon Sep 17 00:00:00 2001 From: ericakfranz Date: Sat, 16 Sep 2017 23:37:43 +0000 Subject: [PATCH] Version 1.6.5 git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@1731054 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- footnotes.php | 38 ++++++++-------- readme.txt | 9 ++-- templates/dashboard/editor-button.html | 41 ----------------- templates/dashboard/editor-button.php | 63 ++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 64 deletions(-) delete mode 100644 templates/dashboard/editor-button.html create mode 100644 templates/dashboard/editor-button.php diff --git a/footnotes.php b/footnotes.php index 0ecfbd6..330d6e1 100755 --- a/footnotes.php +++ b/footnotes.php @@ -1,29 +1,29 @@ - /** - * adds a tag in at the beginning and at the end of a selected text in the specific text area - * @param string elementID - * @param string openTag - * @param string closeTag - */ - function MCI_Footnotes_wrapText(elementID, openTag, closeTag) { - var textArea = jQuery('#' + elementID); - var len = textArea.val().length; - var start = textArea[0].selectionStart; - var end = textArea[0].selectionEnd; - var selectedText = textArea.val().substring(start, end); - var replacement = openTag + selectedText + closeTag; - textArea.val(textArea.val().substring(0, start) + replacement + textArea.val().substring(end, len)); - } - /** - * adds a new button to the plain text editor - */ - QTags.addButton( 'MCI_Footnotes_QuickTag_button', 'footnotes', MCI_Footnotes_text_editor_callback ); - /** - * callback function when the button is clicked - * executes a ajax call to get the start and end tag for the footnotes and - * adds them in before and after the selected text - */ - function MCI_Footnotes_text_editor_callback() { - jQuery.ajax({ - type: 'POST', - url: '/wp-admin/admin-ajax.php', - data: { - action: 'footnotes_getTags' - }, - success: function(data, textStatus, XMLHttpRequest){ - var l_arr_Tags = JSON.parse(data); - MCI_Footnotes_wrapText("content", l_arr_Tags['start'], l_arr_Tags['end']); - }, - error: function(MLHttpRequest, textStatus, errorThrown){ - } - }); - } - \ No newline at end of file diff --git a/templates/dashboard/editor-button.php b/templates/dashboard/editor-button.php new file mode 100644 index 0000000..9564d08 --- /dev/null +++ b/templates/dashboard/editor-button.php @@ -0,0 +1,63 @@ + + +