Version 1.6.5
git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@1731054 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
57661e98a3
commit
07a745ab72
4 changed files with 87 additions and 64 deletions
|
@ -4,13 +4,13 @@
|
||||||
Plugin URI: http://wordpress.org/plugins/footnotes/
|
Plugin URI: http://wordpress.org/plugins/footnotes/
|
||||||
Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
|
Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
|
||||||
Author: ManFisher Medien ManuFaktur
|
Author: ManFisher Medien ManuFaktur
|
||||||
Version: 1.6.4
|
Version: 1.6.5
|
||||||
Author URI: http://manfisher.net/plugins/footnotes/
|
Author URI: http://manfisher.net/plugins/footnotes/
|
||||||
Text Domain: footnotes
|
Text Domain: footnotes
|
||||||
Domain Path: /languages
|
Domain Path: /languages
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Copyright 2014 Mark Cheret, Stefan Herndler (email : info@manfisher.eu | support@herndler.org)
|
Copyright 2014 Mark Cheret, Stefan Herndler, Erica Franz (email : info@manfisher.eu | support@herndler.org | erica@fatpony.me)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License, version 3, as
|
it under the terms of the GNU General Public License, version 3, as
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
=== footnotes ===
|
=== footnotes ===
|
||||||
Contributors: Aricura, mark.cheret
|
Contributors: Aricura, mark.cheret, ericakfranz
|
||||||
Tags: footnote, bibliography, formatting, notes, post, reference
|
Tags: footnote, bibliography, formatting, notes, post, reference
|
||||||
Requires at least: 3.9
|
Requires at least: 3.9
|
||||||
Tested up to: 4.5.3
|
Tested up to: 4.8.1
|
||||||
Stable Tag: 2.0
|
Stable Tag: 1.6.5
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
@ -79,7 +79,8 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
=
|
= 1.6.5 =
|
||||||
|
* Bugfix: Check if quicktags script is available before loading custom QTag button. This fixes a JS error which may have interfered with other functionality on custom post type edit screens.
|
||||||
|
|
||||||
= 1.6.4 =
|
= 1.6.4 =
|
||||||
|
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
<script type="text/javascript">
|
|
||||||
/**
|
|
||||||
* 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){
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
63
templates/dashboard/editor-button.php
Normal file
63
templates/dashboard/editor-button.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/**
|
||||||
|
* 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* adds a new button to the plain text editor
|
||||||
|
*/
|
||||||
|
function load_footnotes_quicktag_inline() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a check to ensure the quicktags script is available
|
||||||
|
* preventing undefined error if no quicktags script
|
||||||
|
* @author Erica Franz
|
||||||
|
*/
|
||||||
|
if ( wp_script_is( 'quicktags' ) ) { ?>
|
||||||
|
|
||||||
|
// And now the footnotes button
|
||||||
|
QTags.addButton('MCI_Footnotes_QuickTag_button', 'footnotes', MCI_Footnotes_text_editor_callback);
|
||||||
|
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action( 'admin_print_footer_scripts', 'load_footnotes_quicktag_inline' );
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php ?>
|
Reference in a new issue