diff --git a/Popups.hooks.php b/Popups.hooks.php index 4944c8c98..8f82c9771 100644 --- a/Popups.hooks.php +++ b/Popups.hooks.php @@ -94,6 +94,7 @@ class PopupsHooks { "popups-settings-enable", "popups-settings-help", "popups-settings-help-ok", + "popups-send-feedback", ), 'remoteExtPath' => 'Popups', 'localBasePath' => __DIR__, @@ -128,4 +129,12 @@ class PopupsHooks { ); return true; } + + /** + * @param array $vars + */ + public static function onResourceLoaderGetConfigVars( array &$vars ) { + $conf = ConfigFactory::getDefaultInstance()->makeConfig( 'popups' ); + $vars['wgPopupsSurveyLink'] = $conf->get( 'PopupsSurveyLink' ); + } } diff --git a/Popups.php b/Popups.php index 730c91fb5..f6d9cf385 100644 --- a/Popups.php +++ b/Popups.php @@ -33,6 +33,9 @@ $wgExtensionCredits['betafeatures'][] = array( 'license-name' => 'GPL-2.0+', ); +$wgPopupsSurveyLink = false; +$wgConfigRegistry['popups'] = 'GlobalVarConfig::newInstance'; + $wgAutoloadClasses['PopupsHooks'] = __DIR__ . '/Popups.hooks.php'; $wgMessagesDirs['Popups'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['Popups'] = __DIR__ . '/Popups.i18n.php'; @@ -41,4 +44,5 @@ $wgHooks['GetBetaFeaturePreferences'][] = 'PopupsHooks::getPreferences'; $wgHooks['BeforePageDisplay'][] = 'PopupsHooks::onBeforePageDisplay'; $wgHooks['ResourceLoaderTestModules'][] = 'PopupsHooks::onResourceLoaderTestModules'; $wgHooks['EventLoggingRegisterSchemas'][] = 'PopupsHooks::onEventLoggingRegisterSchemas'; -$wgHooks[ 'ResourceLoaderRegisterModules' ][] = 'PopupsHooks::onResourceLoaderRegisterModules'; \ No newline at end of file +$wgHooks['ResourceLoaderRegisterModules'][] = 'PopupsHooks::onResourceLoaderRegisterModules'; +$wgHooks['ResourceLoaderGetConfigVars'][] = 'PopupsHooks::onResourceLoaderGetConfigVars'; diff --git a/i18n/en.json b/i18n/en.json index acd300210..e0cda976e 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -18,5 +18,6 @@ "popups-settings-help-ok": "OK", "popups-settings-cancel": "Cancel", "popups-settings-help": "You can turn previews back on using a link in the footer of the page.", - "popups-settings-enable": "Enable previews" + "popups-settings-enable": "Enable previews", + "popups-send-feedback": "Send Feedback" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 84ba68bfe..e9d2b3981 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -20,5 +20,6 @@ "popups-settings-save": "Save buttton for the setting's dialoag\n{{Identical|Save}}", "popups-settings-cancel": "Cancel button for the setting's dialog\n{{Identical|Cancel}}", "popups-settings-help": "Help text explaining how to re-enable previews", - "popups-settings-enable": "Link on the footer to enable hovercards if its disabled.\n\nSee also:\n* {{msg-mw|Popups-settings-option-off}}" + "popups-settings-enable": "Link on the footer to enable hovercards if its disabled.\n\nSee also:\n* {{msg-mw|Popups-settings-option-off}}", + "popups-send-feedback": "Tooltip for the send feedback icon on the hovercard" } diff --git a/resources/cog.png b/resources/cog.png new file mode 100644 index 000000000..c1242ac62 Binary files /dev/null and b/resources/cog.png differ diff --git a/resources/cog.svg b/resources/cog.svg new file mode 100644 index 000000000..8f1fb471b --- /dev/null +++ b/resources/cog.svg @@ -0,0 +1,10 @@ + + + + + + diff --git a/resources/ext.popups.core.less b/resources/ext.popups.core.less index bb625f469..0e52ea753 100644 --- a/resources/ext.popups.core.less +++ b/resources/ext.popups.core.less @@ -98,14 +98,34 @@ color: #00af89; } - .mwe-popups-settings-icon { + .mwe-popups-icon { display: inline-block; - vertical-align: text-top; + vertical-align: middle; cursor: pointer; - margin-left: 5px; - height: 16px; - width: 16px; - .background-image-svg( "gear_gray.svg", "gear_gray.png" ); + margin: 0; + margin-top: -5px; + height: 24px; + width: 30px; + border-radius: 2px; + background-position: center center; + background-repeat: no-repeat; + background-size: 24px 24px; + + &:hover { + background-color: #eee; + } + + &:active { + background-color: #ccc; + } + } + + .mwe-popups-settings-icon { + .background-image-svg( "cog.svg", "cog.png" ); + } + + .mwe-popups-survey-icon { + .background-image-svg( "horn-ltr.svg", "horn-ltr.png" ); } } @@ -283,4 +303,4 @@ .mwe-popups-border-triangle-bottom( 8px, 10px, #bbb, 0px ); } } -} +} \ No newline at end of file diff --git a/resources/ext.popups.renderer.article.js b/resources/ext.popups.renderer.article.js index 5e2a7903f..f9b8f9f7a 100644 --- a/resources/ext.popups.renderer.article.js +++ b/resources/ext.popups.renderer.article.js @@ -25,6 +25,13 @@ pokeySize: 8 // Height of the triangle used to point at the link }; + + /** + * Survey link, if any, for this renderer + * @property surveyLink + */ + article.surveyLink = mw.config.get( 'wgPopupsSurveyLink' ); + /** * Send an API request and cache the jQuery element * @@ -112,14 +119,25 @@ timestampclass = ( timediff < oneDay ) ? 'mwe-popups-timestamp-recent' : 'mwe-popups-timestamp-older', - $settingsImage = $( '' ).addClass( 'mwe-popups-settings-icon' ), + $settingsImage = $( '' ).addClass( 'mwe-popups-icon mwe-popups-settings-icon' ), + $surveyImage, $timestamp = $( '
' ) .addClass( timestampclass ) .append( $( '' ).text( mw.message( 'popups-last-edited', moment( timestamp ).fromNow() ).text() ), $settingsImage - ); + ); + + if ( article.surveyLink ) { + $surveyImage = $( '' ) + .attr( 'href', article.surveyLink ) + .attr( 'target', '_blank' ) + .attr( 'title', mw.message( 'popups-send-feedback' ) ) + .addClass( 'mwe-popups-icon mwe-popups-survey-icon' ); + $timestamp.append( $surveyImage ); + } + if ( $thumbnail.prop( 'tagName' ) !== 'SPAN' ) { $thumbnail = $( '' ) diff --git a/resources/gear_gray.png b/resources/gear_gray.png deleted file mode 100644 index a6ae346e5..000000000 Binary files a/resources/gear_gray.png and /dev/null differ diff --git a/resources/gear_gray.svg b/resources/gear_gray.svg deleted file mode 100644 index 2f44fd663..000000000 --- a/resources/gear_gray.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/resources/horn-ltr.png b/resources/horn-ltr.png new file mode 100644 index 000000000..0f2e45395 Binary files /dev/null and b/resources/horn-ltr.png differ diff --git a/resources/horn-ltr.svg b/resources/horn-ltr.svg new file mode 100644 index 000000000..92e0342ab --- /dev/null +++ b/resources/horn-ltr.svg @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/resources/horn-rtl.png b/resources/horn-rtl.png new file mode 100644 index 000000000..9b76640f7 Binary files /dev/null and b/resources/horn-rtl.png differ diff --git a/resources/horn-rtl.svg b/resources/horn-rtl.svg new file mode 100644 index 000000000..7ab4a61fb --- /dev/null +++ b/resources/horn-rtl.svg @@ -0,0 +1,10 @@ + + + + + + + +