for bugfix release 2.0.3

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2409068 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2020-10-29 13:17:36 +00:00
parent 45e85af501
commit 9d4768f040
8 changed files with 149 additions and 88 deletions

View file

@ -6,6 +6,9 @@
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 12.09.14 10:56 * @since 1.5.0 12.09.14 10:56
*/ */
// Versioning: update plugin version # for style sheet cache busting on line 103
// Added jQueryUI on 2020-10-26T1907+0100 // Added jQueryUI on 2020-10-26T1907+0100
// Following @vonpiernik <https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762> // Following @vonpiernik <https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762>
@ -96,8 +99,8 @@ class MCI_Footnotes {
wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, true ); wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, true );
wp_enqueue_script( 'jQueryUI' ); wp_enqueue_script( 'jQueryUI' );
// IMPORTANT: current version number for cache busting:
wp_enqueue_style('mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__)); wp_enqueue_style('mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__), '', '2.0.3');
// add the jQuery plugin (already registered by WordPress) // add the jQuery plugin (already registered by WordPress)
wp_enqueue_script('jquery'); wp_enqueue_script('jquery');

View file

@ -5,17 +5,10 @@
* @filesource * @filesource
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*
*/ */
/* /*
Customization: 2020-06-23T0613+0200 custom styles, fixed print output [now in public.css] Last modified: 2020-10-29T1402+0100
Customization: 2020-09-09T2140+0200 raised scroll level, shorter scroll time [reference-container.html]
Customization: 2020-09-09T2140+0200 changed parameters off dashboard [tooltip.html]
Debugging: 2020-09-09T2140+0200 fixed missing or wrong links #0#
Usability: 2020-09-09T2140+0200 voided $a_str_Prefix #1#
Usability: 2020-09-09T2140+0200 added line breaks #2#
Translation: 2020-09-10T2104+0200 fix infobox text and missing setting #0#
Upgrade v1.6.5: 2020-10-23T0252+0200 #3#
Last modified: 2020-10-23T0611+0200
*/ */
// If called directly, abort: // If called directly, abort:
defined( 'ABSPATH' ) or die; defined( 'ABSPATH' ) or die;
@ -316,6 +309,10 @@ class MCI_Footnotes_Task {
* @return string * @return string
*/ */
public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) { public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) {
// prepare prepending post ID to make footnote IDs unique wrt archive view:
$id_underscore = get_the_id();
$id_underscore .= '_';
self::$a_str_Prefix = $id_underscore;
// contains the index for the next footnote on this page // contains the index for the next footnote on this page
$l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1; $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1;
// contains the starting position for the lookup of a footnote // contains the starting position for the lookup of a footnote
@ -350,7 +347,6 @@ class MCI_Footnotes_Task {
do { do {
// get first occurrence of the footnote short code [start] // get first occurrence of the footnote short code [start]
$i_int_len_Content = strlen($p_str_Content); $i_int_len_Content = strlen($p_str_Content);
// #3# upgrade v1.6.5:
if ($l_int_PosStart > $i_int_len_Content) $l_int_PosStart = $i_int_len_Content; if ($l_int_PosStart > $i_int_len_Content) $l_int_PosStart = $i_int_len_Content;
$l_int_PosStart = strpos($p_str_Content, $l_str_StartingTag, $l_int_PosStart); $l_int_PosStart = strpos($p_str_Content, $l_str_StartingTag, $l_int_PosStart);
// no short code found, stop here // no short code found, stop here
@ -382,12 +378,6 @@ class MCI_Footnotes_Task {
if (is_int($l_int_MaxLength) && strlen($l_str_DummyText) > $l_int_MaxLength) { if (is_int($l_int_MaxLength) && strlen($l_str_DummyText) > $l_int_MaxLength) {
$l_str_ExcerptText = substr($l_str_DummyText, 0, $l_int_MaxLength); $l_str_ExcerptText = substr($l_str_DummyText, 0, $l_int_MaxLength);
$l_str_ExcerptText = substr($l_str_ExcerptText, 0, strrpos($l_str_ExcerptText, ' ')); $l_str_ExcerptText = substr($l_str_ExcerptText, 0, strrpos($l_str_ExcerptText, ' '));
// #0#
// col 48: replaced space with no-break space.
// col 54: replaced three dots with horizontal ellipsis (&hellip;): “use the single Unicode …, and not three dots” <https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_content_best_practices>
// col 139: added class.
// col 162: added fragment id, or the footnote wont work if JS is disabled.
// col 294: added the random prefix for consistency, even if disabled.
$l_str_ExcerptText .= '&nbsp;&#x2026; ' . sprintf(__("%scontinue%s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '<a class="continue" href="#footnote_plugin_reference_' . self::$a_str_Prefix.$l_str_Index . '" onclick="footnote_moveToAnchor(\'footnote_plugin_reference_' . self::$a_str_Prefix . $l_str_Index . '\');">', '</a>'); $l_str_ExcerptText .= '&nbsp;&#x2026; ' . sprintf(__("%scontinue%s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '<a class="continue" href="#footnote_plugin_reference_' . self::$a_str_Prefix.$l_str_Index . '" onclick="footnote_moveToAnchor(\'footnote_plugin_reference_' . self::$a_str_Prefix . $l_str_Index . '\');">', '</a>');
} }
} }
@ -500,7 +490,7 @@ class MCI_Footnotes_Task {
"text" => $l_str_FootnoteText "text" => $l_str_FootnoteText
) )
); );
// #2# added line breaks for source code legibility: // extra line breaks for page source legibility:
$footnote_item_temp = $l_obj_Template->getContent(); $footnote_item_temp = $l_obj_Template->getContent();
$footnote_item_temp .= "\r\n\r\n"; $footnote_item_temp .= "\r\n\r\n";
$l_str_Body .= $footnote_item_temp; $l_str_Body .= $footnote_item_temp;
@ -522,8 +512,6 @@ class MCI_Footnotes_Task {
// free all found footnotes if reference container will be displayed // free all found footnotes if reference container will be displayed
self::$a_arr_Footnotes = array(); self::$a_arr_Footnotes = array();
// #1# Disabled the random prefix preventing fn refs from being shared.
//self::$a_str_Prefix = rand(1000, 9999) . "_";
return $l_obj_TemplateContainer->getContent(); return $l_obj_TemplateContainer->getContent();
} }
} }

View file

@ -6,7 +6,7 @@
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 14.09.14 10:58 * @since 1.5.0 14.09.14 10:58
*/ */
// Last modified: 2020-10-29T0805+0100
/** /**
* Handles each Template file for the Plugin Frontend (e.g. Settings Dashboard, Public pages, ...). * Handles each Template file for the Plugin Frontend (e.g. Settings Dashboard, Public pages, ...).
@ -76,6 +76,8 @@ class MCI_Footnotes_Template {
// get Template file content // get Template file content
$this->a_str_OriginalContent = str_replace("\n", "", file_get_contents($l_str_TemplateFile)); $this->a_str_OriginalContent = str_replace("\n", "", file_get_contents($l_str_TemplateFile));
$this->a_str_OriginalContent = str_replace("\r", "", $this->a_str_OriginalContent); $this->a_str_OriginalContent = str_replace("\r", "", $this->a_str_OriginalContent);
$this->a_str_OriginalContent = str_replace("\t", " ", $this->a_str_OriginalContent);
$this->a_str_OriginalContent = str_replace(" ", " ", $this->a_str_OriginalContent);
$this->reload(); $this->reload();
} }

View file

@ -1,17 +1,14 @@
/** /**
* Created by Stefan Herndler. * Created by Stefan Herndler.
* User: Stefan * User: Stefan
* Date: 15.05.14 * Created-Date: 15.05.14
* Time: 16:21 * Created-Time: 16:21
* Version: 1.0.7
* Since: 1.0 * Since: 1.0
* Version: 2.0.3
* Last modified: 2020-10-29T1343+0100
*/ */
/* /* footnote tags */
* Last modified: 2020-10-28T1452+0100
*/
/* footnotes */
.footnote_tag_styling, .footnote_tag_styling,
.footnote_tag_styling:hover { .footnote_tag_styling:hover {
@ -42,7 +39,7 @@
text-decoration: underline; text-decoration: underline;
} }
/* tooltip infobox content */ /* tooltip infobox */
span.footnote_tooltip { span.footnote_tooltip {
font-size: inherit; font-size: inherit;
@ -58,13 +55,21 @@ span.footnote_tooltip {
text-decoration: underline; text-decoration: underline;
} }
/* reference container label */ /* reference container */
.footnote-reference-container {
width: 100%;
border: none;
}
.footnote_container_prepare { .footnote_container_prepare {
display: block !important; display: block !important;
padding-top: 24px !important; padding-top: 24px !important;
} }
#footnote_references_container td {
padding: none;
}
/* label */
.footnote_container_prepare > p { .footnote_container_prepare > p {
line-height: 1.3 !important; line-height: 1.3 !important;
margin-top: 1em !important; margin-top: 1em !important;
@ -81,12 +86,15 @@ span.footnote_tooltip {
text-align: left !important; text-align: left !important;
vertical-align: middle; vertical-align: middle;
} }
.footnote_container_prepare > p > span:first-child { .footnote_container_prepare > p > span:first-child {
padding-left: 20px !important;
text-align: left !important; text-align: left !important;
font-size: 1.5em !important; font-size: 1.5em !important;
} }
/* collapse button */
#footnote_reference_container_collapse_button {
cursor: pointer;
}
.footnote_container_prepare > p > span:last-child a { .footnote_container_prepare > p > span:last-child a {
text-decoration: none; text-decoration: none;
} }
@ -95,48 +103,60 @@ span.footnote_tooltip {
color: #008800; color: #008800;
} }
/* reference container */ /* footnotes */
.footnote-reference-container {
width: 100%;
border: none;
}
.footnote_plugin_index, .footnote_plugin_index,
.footnote_plugin_text { .footnote_plugin_text {
border:none !important; border:none !important;
text-align: left; text-align: left;
vertical-align: top; vertical-align: top;
} }
.footnote_plugin_index a,
/* index */
.footnote_plugin_index {
padding-right: 5px;
min-width: 50px;
cursor: pointer;
}
.footnote_plugin_index a {
text-decoration: none;
}
.footnote_plugin_index a:hover {
text-decoration: underline;
}
/* text */
.footnote_plugin_text {
width: 90%;
}
.footnote_plugin_text a { .footnote_plugin_text a {
text-decoration: none; text-decoration: none;
} }
.footnote_plugin_index a:hover,
.footnote_plugin_text a:hover { .footnote_plugin_text a:hover {
text-decoration: underline; text-decoration: underline !important;
}
.footnote_plugin_index {
cursor: pointer;
overflow-wrap: unset;
word-wrap: unset;
word-wrap: normal !important;
word-break: unset;
word-break: keep-all !important;
white-space: nowrap;
max-width: 140px;
overflow: hidden;
}
@media only screen and (max-width: 768px) {
.footnote_plugin_index {
max-width: 100px;
}
} }
/* printing style */ /* printing style */
.footnote_container_overall_wrapper {
page-break-inside: avoid;
}
.footnote_container_prepare {
page-break-after: avoid;
}
table.footnote_reference_container td {
display: block;
}
table.footnote_reference_container {
page-break-before: avoid;
page-break-inside: auto;
}
table.footnote_reference_container tr {
page-break-before: auto;
}
@media print { @media print {
.footnote_tooltip { .footnote_tooltip,
.footnote_reference_container_collapse_button_outfit,
.footnote_plugin_index_arrow {
display: none; display: none;
} }
.footnote_plugin_tooltip_text { .footnote_plugin_tooltip_text {
@ -144,5 +164,9 @@ span.footnote_tooltip {
} }
.footnote_plugin_index a { .footnote_plugin_index a {
color: inherit; color: inherit;
text-decoration: none !important;
}
div.post-meta-edit-link-wrapper { /*hides the Edit button in WP2020*/
display: none; /*(added as a service)*/
} }
} }

View file

@ -4,7 +4,7 @@
Plugin URI: https://wordpress.org/plugins/footnotes/ Plugin URI: https://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: Mark Cheret Author: Mark Cheret
Version: 2.0.2 Version: 2.0.3
Author URI: http://cheret.de/plugins/footnotes-2/ Author URI: http://cheret.de/plugins/footnotes-2/
Text Domain: footnotes Text Domain: footnotes
Domain Path: /languages Domain Path: /languages
@ -25,7 +25,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
// Last modified: 2020-10-28T1643+0100 // Last modified: 2020-10-29T1405+0100
/** /**
* @filesource * @filesource
* @author Stefan Herndler * @author Stefan Herndler

View file

@ -4,7 +4,7 @@ Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, referen
Requires at least: 3.9 Requires at least: 3.9
Tested up to: 5.5 Tested up to: 5.5
Requires PHP: 5.6 Requires PHP: 5.6
Stable Tag: 2.0.2 Stable Tag: 2.0.3
License: GPLv3 or later License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -80,29 +80,37 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
== Changelog == == Changelog ==
= 2.0.3 =
- Bugfix: Layout: Self-adjusting width of ID column but hidden overflow
- Update: Prepended transitional up arrow to backlinking footnote numbers
- Bugfix: Fragment IDs: Prepended post ID to footnote number
- Bugfix: Feed plugin version in style sheet query string for cache busting
- Bugfix: Print style: Hide reference collapse button when printing
- Update: Layout: Removed padding before reference container label
= 2.0.2 = = 2.0.2 =
- Bugfix: Restored expand/collapse button of reference container
- Bugfix: Dashboard: Available CSS selectors, last item display - Bugfix: Dashboard: Available CSS selectors, last item display
- Bugfix: Footnote anchor and ID color to default on screen, to inherit in print - Bugfix: Footnote anchor and ID color to default on screen, to inherit in print
- Bugfix: Disabled underline in footnote anchors, underline only on hover - Bugfix: Disabled underline in footnote anchors, underline only on hover
= 2.0.1 = = 2.0.1 =
- Bugfix: Restored expand/collapse button of reference container
- Bugfix: Fixed public.css - Bugfix: Fixed public.css
- Update: Language fr_FR along with es_ES, de_AT, de_DE, en_GB, en_US for 2.0 - Update: Language fr_FR along with es_ES, de_AT, de_DE, en_GB, en_US for 2.0
= 2.0.0 = = 2.0.0 =
- Major contributions taken from WordPress user pewgeuges, all details here https://github.com/media-competence-institute/footnotes/blob/master/README.md: - Major contributions taken from WordPress user pewgeuges, all details here https://github.com/media-competence-institute/footnotes/blob/master/README.md:
- Update: **symbol for backlinks** removed - **symbol for backlinks** removed
- Update: hyperlink moved to the reference number - hyperlink moved to the reference number
- Update: Upgrade jQuery library - Upgrade jQuery library
- Update: Account for disruptive PHP change - Account for disruptive PHP change
- Bugfix: footnote links script independent - footnote links script independent
- Bugfix: Get the “Continue reading” link to work in the mouse-over box - Get the “Continue reading” link to work in the mouse-over box
- Bugfix: Debug printed posts and pages - Debug printed posts and pages
- Bugfix: Display of combined identical notes - Fix display of combined identical notes
- Update: Adjusted scrolling time and offset - Adjusted scrolling time and offset
- Bugfix: No margins around footnotes - No borders around footnotes in the container
- Bugfix: Mouse-over box display timing - Mouse-over box display timing
= 1.6.6 = = 1.6.6 =
- Beginning of translation to French - Beginning of translation to French

View file

@ -1,4 +1,4 @@
<tr> <tr>
<td class="footnote_plugin_index" id="footnote_plugin_reference_[[id]]" onclick="footnote_moveToAnchor('footnote_plugin_tooltip_[[id]]');"><a href="#footnote_plugin_tooltip_[[id]]">[[index]].</a></td> <td class="footnote_plugin_index" id="footnote_plugin_reference_[[id]]" onclick="footnote_moveToAnchor('footnote_plugin_tooltip_[[id]]');"><a href="#footnote_plugin_tooltip_[[id]]"><span class="footnote_plugin_index_arrow">&#x2191;&#x200A;</span>[[index]].</a></td>
<td class="footnote_plugin_text">[[text]]</td> <td class="footnote_plugin_text">[[text]]</td>
</tr> </tr>

View file

@ -1,11 +1,47 @@
<div class="footnote_container_prepare"> <div class="footnote_container_overall_wrapper">
<p><span onclick="footnote_expand_reference_container();">[[label]]</span><span style="[[button-style]]">&nbsp;&nbsp;&nbsp;[ <a id="footnote_reference_container_collapse_button" style="cursor:pointer;" onclick="footnote_expand_collapse_reference_container();">+</a> ]</span></p> <div class="footnote_container_prepare">
<p><span
onclick="footnote_expand_reference_container();"
>[[label]]</span><span
class="footnote_reference_container_collapse_button_outfit"
style="[[button-style]]"
>&nbsp;&nbsp;&nbsp;[ <a
id="footnote_reference_container_collapse_button"
onclick="footnote_expand_collapse_reference_container();"
>+</a> ]</span></p>
</div>
<div id="[[id]]" style="[[style]]">
<table class="footnote-reference-container">
<tbody>
[[content]]
</tbody>
</table>
</div>
</div> </div>
<div id="[[id]]" style="[[style]]"> <script type="text/javascript">
<table class="footnote-reference-container"> function footnote_expand_reference_container() {
<tbody> jQuery('#[[id]]').show();
[[content]] jQuery('#footnote_reference_container_collapse_button').text('-');
</tbody> }
</table> function footnote_collapse_reference_container() {
</div> jQuery('#[[id]]').hide();
<script type="text/javascript"> function footnote_expand_reference_container() { jQuery("#[[id]]").show(); jQuery("#footnote_reference_container_collapse_button").text("-"); } function footnote_collapse_reference_container() { jQuery("#[[id]]").hide(); jQuery("#footnote_reference_container_collapse_button").text("+"); } function footnote_expand_collapse_reference_container() { if (jQuery("#[[id]]").is(":hidden")) { footnote_expand_reference_container(); } else { footnote_collapse_reference_container(); } } function footnote_moveToAnchor(p_str_TargetID) { footnote_expand_reference_container(); var l_obj_Target = jQuery("#" + p_str_TargetID); if(l_obj_Target.length) { jQuery('html, body').animate({ scrollTop: l_obj_Target.offset().top - window.innerHeight * .05 }, 80); } } </script> jQuery('#footnote_reference_container_collapse_button').text('+');
}
function footnote_expand_collapse_reference_container() {
if (jQuery('#[[id]]').is(':hidden')) {
footnote_expand_reference_container();
} else {
footnote_collapse_reference_container();
}
}
function footnote_moveToAnchor(p_str_TargetID) {
footnote_expand_reference_container();
var l_obj_Target = jQuery('#' + p_str_TargetID);
if (l_obj_Target.length) {
jQuery('html, body').animate({
scrollTop: l_obj_Target.offset().top - window.innerHeight * 0.12
},
80);
}
}
</script>