development version 2.1.1d3 with experimental optional alternative tooltip implementation in response to user
git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2416861 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
c05c96a6fd
commit
5a8e30e6ea
11 changed files with 163 additions and 90 deletions
|
@ -322,6 +322,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
|
|||
"label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Enable the mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled),
|
||||
|
||||
"label-alternative" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __("Use alternative tooltip implementation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"alternative" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_Enabled),
|
||||
|
||||
"label-activate-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __("Display only an excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
|
||||
"activate-excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_Enabled),
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ class MCI_Footnotes {
|
|||
'mci-footnotes-css-public',
|
||||
plugins_url('../css/public.css', __FILE__),
|
||||
'',
|
||||
'2.1.1d2'
|
||||
'2.1.1d3'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* v2.0.4 2020-11-02T2115+0100
|
||||
* v2.0.7 2020-11-06T1342+0100
|
||||
* v2.1.0 2020-11-08T2149+0100
|
||||
* V2.2.0 2020-11-11T1819+0100 ######## set to '' line 416 before release! ######################
|
||||
*/
|
||||
|
||||
|
||||
|
@ -28,8 +29,8 @@ class MCI_Footnotes_Settings {
|
|||
*
|
||||
* @since 2.0.9
|
||||
* @var string
|
||||
*
|
||||
* 2020-11-08T2106+0100
|
||||
*
|
||||
* 2020-11-08T2106+0100
|
||||
*/
|
||||
const C_STR_FOOTNOTES_TOOLTIP_READON_LABEL = "footnote_inputfield_readon_label";
|
||||
|
||||
|
@ -168,6 +169,16 @@ class MCI_Footnotes_Settings {
|
|||
*/
|
||||
const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED = "footnote_inputfield_custom_mouse_over_box_enabled";
|
||||
|
||||
/**
|
||||
* Settings Container Key for alternative tooltip implementation
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @var string
|
||||
*
|
||||
* 2020-11-11T1817+0100
|
||||
*/
|
||||
const C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE = "footnote_inputfield_custom_mouse_over_box_alternative";
|
||||
|
||||
/**
|
||||
* Settings Container Key for the mouse-over box to display only an excerpt.
|
||||
*
|
||||
|
@ -393,57 +404,58 @@ class MCI_Footnotes_Settings {
|
|||
self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'no'
|
||||
),
|
||||
"footnotes_storage_custom" => array(
|
||||
|
||||
// The default footnote referrer surroundings should be square brackets:
|
||||
// * as in English typesetting;
|
||||
// * for better UX thanks to a more button-like appearance;
|
||||
// * for stylistic consistency with the expand-collapse button
|
||||
self::C_STR_FOOTNOTES_STYLING_BEFORE => '[',
|
||||
self::C_STR_FOOTNOTES_STYLING_AFTER => ']',
|
||||
|
||||
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes',
|
||||
|
||||
// The mouse over content truncation should be enabled by default
|
||||
// to raise awareness of the functionality and to prevent the screen
|
||||
// from being filled at mouse-over, and to allow the Continue reading:
|
||||
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes',
|
||||
|
||||
// The truncation length is raised from 150 to 200 chars:
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200,
|
||||
|
||||
// The default position should not be lateral because of the risk
|
||||
// the box gets squeezed between note anchor at line end and window edge,
|
||||
// and top because reading at the bottom of the window is more likely:
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center',
|
||||
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0,
|
||||
// The vertical offset must be negative for the box not to cover
|
||||
// the current line of text (web coordinates origin is top left):
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7,
|
||||
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '',
|
||||
// The mouse over box shouldn’t feature a colored background
|
||||
// by default, due to diverging user preferences. White is neutral:
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff',
|
||||
|
||||
|
||||
// The default footnote referrer surroundings should be square brackets:
|
||||
// * as in English typesetting;
|
||||
// * for better UX thanks to a more button-like appearance;
|
||||
// * for stylistic consistency with the expand-collapse button
|
||||
self::C_STR_FOOTNOTES_STYLING_BEFORE => '[',
|
||||
self::C_STR_FOOTNOTES_STYLING_AFTER => ']',
|
||||
|
||||
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes',
|
||||
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => 'yes',
|
||||
|
||||
// The mouse over content truncation should be enabled by default
|
||||
// to raise awareness of the functionality and to prevent the screen
|
||||
// from being filled at mouse-over, and to allow the Continue reading:
|
||||
self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes',
|
||||
|
||||
// The truncation length is raised from 150 to 200 chars:
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200,
|
||||
|
||||
// The default position should not be lateral because of the risk
|
||||
// the box gets squeezed between note anchor at line end and window edge,
|
||||
// and top because reading at the bottom of the window is more likely:
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center',
|
||||
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0,
|
||||
// The vertical offset must be negative for the box not to cover
|
||||
// the current line of text (web coordinates origin is top left):
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7,
|
||||
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '',
|
||||
// The mouse over box shouldn’t feature a colored background
|
||||
// by default, due to diverging user preferences. White is neutral:
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff',
|
||||
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1,
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99',
|
||||
|
||||
// The mouse over box corners mustn’t be rounded as that is outdated:
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0,
|
||||
|
||||
// The width should be limited to start with, for the box to have shape:
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450,
|
||||
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99',
|
||||
|
||||
// The mouse over box corners mustn’t be rounded as that is outdated:
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0,
|
||||
|
||||
// The width should be limited to start with, for the box to have shape:
|
||||
self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450,
|
||||
|
||||
self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666',
|
||||
self::C_STR_HYPERLINK_ARROW => '↑',
|
||||
self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '',
|
||||
self::C_STR_CUSTOM_CSS => ''
|
||||
),
|
||||
// These should all be enabled by default to prevent users from
|
||||
// thinking at first that the feature is broken in post titles.
|
||||
// These should all be enabled by default to prevent users from
|
||||
// thinking at first that the feature is broken in post titles.
|
||||
// See <https://wordpress.org/support/topic/more-feature-ideas/>
|
||||
// In titles, footnotes are functionally pointless in WordPress.
|
||||
// In titles, footnotes are functionally pointless in WordPress.
|
||||
"footnotes_storage_expert" => array(
|
||||
self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => 'yes',
|
||||
self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'yes',
|
||||
|
|
|
@ -120,7 +120,7 @@ class MCI_Footnotes_Task {
|
|||
<style type="text/css" media="screen">
|
||||
<?php
|
||||
echo MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS);
|
||||
echo '.footnote_tooltip { display: none; padding: 12px; font-size: 13px;';
|
||||
echo '.footnote_tooltip {';
|
||||
if (!empty($l_str_Color)) {
|
||||
printf(" color: %s;", $l_str_Color);
|
||||
}
|
||||
|
@ -146,8 +146,14 @@ class MCI_Footnotes_Task {
|
|||
}
|
||||
echo '}';
|
||||
?>
|
||||
</style>
|
||||
<?php
|
||||
</style>
|
||||
<?php
|
||||
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) {
|
||||
echo '<script content="text/javascript">' . "\r\n";
|
||||
echo "\t" . 'function footnoteTooltipShow(footnoteTooltipId) { document.getElementById(footnoteTooltipId).style.display = "block"; };' . "\r\n";
|
||||
echo "\t" . 'function footnoteTooltipHide(footnoteTooltipId) { document.getElementById(footnoteTooltipId).style.display = "none"; }' . "\r\n";
|
||||
echo "</script>\r\n";
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -353,7 +359,11 @@ class MCI_Footnotes_Task {
|
|||
|
||||
if (!$p_bool_HideFootnotesText) {
|
||||
// load template file
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote");
|
||||
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) {
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote-alternative");
|
||||
} else {
|
||||
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote");
|
||||
}
|
||||
$l_obj_TemplateTooltip = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "tooltip");
|
||||
} else {
|
||||
$l_obj_Template = null;
|
||||
|
@ -395,8 +405,7 @@ class MCI_Footnotes_Task {
|
|||
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_ExcerptText, 0, strrpos($l_str_ExcerptText, ' '));
|
||||
// Removed hyperlink navigation on user request, but left <a> element for style.
|
||||
$l_str_ExcerptText .= ' … ' . '<a class="continue" onclick="footnote_moveToAnchor_' . $l_int_PostID . '(\'footnote_plugin_reference_' . $l_int_PostID . '_' . $l_str_Index . '\');">' . MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL) . '</a>';
|
||||
$l_str_ExcerptText .= ' … ' . '<span class="footnote_tooltip_continue" onclick="footnote_moveToAnchor_' . $l_int_PostID . '(\'footnote_plugin_reference_' . $l_int_PostID . '_' . $l_str_Index . '\');">' . MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,7 +438,9 @@ class MCI_Footnotes_Task {
|
|||
"offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0
|
||||
)
|
||||
);
|
||||
$l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent();
|
||||
if (!MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE))) {
|
||||
$l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent();
|
||||
}
|
||||
$l_obj_TemplateTooltip->reload();
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue