Displaying interwiki results in sidebar
authorJan Drewniak <jan.drewniak@gmail.com>
Wed, 18 Jan 2017 10:27:43 +0000 (11:27 +0100)
committerJan Drewniak <jan.drewniak@gmail.com>
Fri, 3 Feb 2017 17:18:20 +0000 (18:18 +0100)
Displays newly designed interwiki search results in the
sidebar of the specialSearch page.

A prototype of this change can be viewed on this labs url:

http://sistersearch.wmflabs.org/w/index.php?title=Special:Search&search=mars

Bug: T149806

Change-Id: I66e4b6a502dae488d105f11cad73e145990c2327

32 files changed:
autoload.php
includes/DefaultSettings.php
includes/specials/SpecialSearch.php
includes/widget/search/BasicSearchResultSetWidget.php
includes/widget/search/InterwikiSearchResultSetWidget.php
includes/widget/search/InterwikiSearchResultWidget.php [new file with mode: 0644]
includes/widget/search/SearchResultSetWidget.php [new file with mode: 0644]
includes/widget/search/SimpleSearchResultSetWidget.php [new file with mode: 0644]
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.special/images/special.search/book-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/book-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/course-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/course-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/definition-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/definition-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/dna-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/dna-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/image-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/image-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/news-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/news-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/quotation-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/quotation-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/textbook-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/textbook-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/travel-icon.png [new file with mode: 0644]
resources/src/mediawiki.special/images/special.search/travel-icon.svg [new file with mode: 0644]
resources/src/mediawiki.special/mediawiki.special.search.commonsInterwikiWidget.js [new file with mode: 0644]
resources/src/mediawiki.special/mediawiki.special.search.interwikiwidget.styles.less [new file with mode: 0644]
resources/src/mediawiki.special/mediawiki.special.search.styles.css

index a6840b4..dbb7dbd 100644 (file)
@@ -936,8 +936,11 @@ $wgAutoloadLocalClasses = [
        'MediaWiki\\Widget\\Search\\DidYouMeanWidget' => __DIR__ . '/includes/widget/search/DidYouMeanWidget.php',
        'MediaWiki\\Widget\\Search\\FullSearchResultWidget' => __DIR__ . '/includes/widget/search/FullSearchResultWidget.php',
        'MediaWiki\\Widget\\Search\\InterwikiSearchResultSetWidget' => __DIR__ . '/includes/widget/search/InterwikiSearchResultSetWidget.php',
+       'MediaWiki\\Widget\\Search\\InterwikiSearchResultWidget' => __DIR__ . '/includes/widget/search/InterwikiSearchResultWidget.php',
        'MediaWiki\\Widget\\Search\\SearchFormWidget' => __DIR__ . '/includes/widget/search/SearchFormWidget.php',
+       'MediaWiki\\Widget\\Search\\SearchResultSetWidget' => __DIR__ . '/includes/widget/search/SearchResultSetWidget.php',
        'MediaWiki\\Widget\\Search\\SearchResultWidget' => __DIR__ . '/includes/widget/search/SearchResultWidget.php',
+       'MediaWiki\\Widget\\Search\\SimpleSearchResultSetWidget' => __DIR__ . '/includes/widget/search/SimpleSearchResultSetWidget.php',
        'MediaWiki\\Widget\\Search\\SimpleSearchResultWidget' => __DIR__ . '/includes/widget/search/SimpleSearchResultWidget.php',
        'MediaWiki\\Widget\\TitleInputWidget' => __DIR__ . '/includes/widget/TitleInputWidget.php',
        'MediaWiki\\Widget\\UserInputWidget' => __DIR__ . '/includes/widget/UserInputWidget.php',
index a7cbd96..e98227d 100644 (file)
@@ -8562,6 +8562,25 @@ $wgLearnerMemberSince = 4; # days
 $wgExperiencedUserEdits = 500;
 $wgExperiencedUserMemberSince = 30; # days
 
+/**
+ * Mapping of interwiki index prefixes to descriptors that
+ * can be used to change the display of interwiki search results.
+ *
+ * Descriptors are appended to CSS classes of interwiki results
+ * which using InterwikiSearchResultWidget.
+ *
+ * Predefined descriptors include the following words:
+ * definition, textbook, news, quotation, book, travel, course
+ *
+ * @par Example:
+ * @code
+ * $wgInterwikiPrefixDisplayTypes = [
+ *     'iwprefix' => 'definition'
+ *];
+ * @endcode
+ */
+$wgInterwikiPrefixDisplayTypes = [];
+
 /**
  * For really cool vim folding this needs to be at the end:
  * vim: foldmarker=@{,@} foldmethod=marker
index 34620ff..b7356e7 100644 (file)
 
 use MediaWiki\MediaWikiServices;
 use MediaWiki\Widget\Search\BasicSearchResultSetWidget;
-use MediaWiki\Widget\Search\InterwikiSearchResultSetWidget;
 use MediaWiki\Widget\Search\FullSearchResultWidget;
+use MediaWiki\Widget\Search\InterwikiSearchResultWidget;
+use MediaWiki\Widget\Search\InterwikiSearchResultSetWidget;
 use MediaWiki\Widget\Search\SimpleSearchResultWidget;
+use MediaWiki\Widget\Search\SimpleSearchResultSetWidget;
 
 /**
  * implements Special:Search - Run text & title search and display the output
@@ -385,13 +387,26 @@ class SpecialSearch extends SpecialPage {
                // results to display.
                $linkRenderer = $this->getLinkRenderer();
                $mainResultWidget = new FullSearchResultWidget( $this, $linkRenderer );
-               $sidebarResultWidget = new SimpleSearchResultWidget( $this, $linkRenderer );
-               $sidebarResultsWidget = new InterwikiSearchResultSetWidget(
-                       $this,
-                       $sidebarResultWidget,
-                       $linkRenderer,
-                       MediaWikiServices::getInstance()->getInterwikiLookup()
-               );
+
+               if ( $search->getFeatureData( 'enable-new-crossproject-page' ) ) {
+
+                       $sidebarResultWidget = new InterwikiSearchResultWidget( $this, $linkRenderer );
+                       $sidebarResultsWidget = new InterwikiSearchResultSetWidget(
+                               $this,
+                               $sidebarResultWidget,
+                               $linkRenderer,
+                               MediaWikiServices::getInstance()->getInterwikiLookup()
+                       );
+               } else {
+                       $sidebarResultWidget = new SimpleSearchResultWidget( $this, $linkRenderer );
+                       $sidebarResultsWidget = new SimpleSearchResultSetWidget(
+                               $this,
+                               $sidebarResultWidget,
+                               $linkRenderer,
+                               MediaWikiServices::getInstance()->getInterwikiLookup()
+                       );
+               }
+
                $widget = new BasicSearchResultSetWidget( $this, $mainResultWidget, $sidebarResultsWidget );
 
                $out->addHTML( $widget->render(
index 2c31bd2..07094af 100644 (file)
@@ -22,7 +22,7 @@ class BasicSearchResultSetWidget {
        public function __construct(
                SpecialSearch $specialPage,
                SearchResultWidget $resultWidget,
-               InterwikiSearchResultSetWidget $sidebarWidget
+               SearchResultSetWidget $sidebarWidget
        ) {
                $this->specialPage = $specialPage;
                $this->resultWidget = $resultWidget;
index c738483..af1ed05 100644 (file)
@@ -7,13 +7,14 @@ use MediaWiki\Linker\LinkRenderer;
 use SearchResultSet;
 use SpecialSearch;
 use Title;
+use Html;
 
 /**
  * Renders one or more SearchResultSets into a sidebar grouped by
  * interwiki prefix. Includes a per-wiki header indicating where
  * the results are from.
  */
-class InterwikiSearchResultSetWidget {
+class InterwikiSearchResultSetWidget implements SearchResultSetWidget {
        /** @var SpecialSearch */
        protected $specialSearch;
        /** @var SearchResultWidget */
@@ -24,6 +25,10 @@ class InterwikiSearchResultSetWidget {
        protected $linkRenderer;
        /** @var InterwikiLookup */
        protected $iwLookup;
+       /** @var $output */
+       protected $output;
+       /** @var $iwPrefixDisplayTypes */
+       protected $iwPrefixDisplayTypes;
 
        public function __construct(
                SpecialSearch $specialSearch,
@@ -35,8 +40,11 @@ class InterwikiSearchResultSetWidget {
                $this->resultWidget = $resultWidget;
                $this->linkRenderer = $linkRenderer;
                $this->iwLookup = $iwLookup;
+               $this->output = $specialSearch->getOutput();
+               $this->iwPrefixDisplayTypes = $specialSearch->getConfig()->get(
+                       'InterwikiPrefixDisplayTypes'
+               );
        }
-
        /**
         * @param string $term User provided search term
         * @param SearchResultSet|SearchResultSet[] $resultSets List of interwiki
@@ -50,6 +58,9 @@ class InterwikiSearchResultSetWidget {
 
                $this->loadCustomCaptions();
 
+               $this->output->addModules( 'mediawiki.special.search.commonsInterwikiWidget' );
+               $this->output->addModuleStyles( 'mediawiki.special.search.interwikiwidget.styles' );
+
                $iwResults = [];
                foreach ( $resultSets as $resultSet ) {
                        $result = $resultSet->next();
@@ -61,56 +72,99 @@ class InterwikiSearchResultSetWidget {
                        }
                }
 
-               $out = '';
+               $iwResultSetPos = 1;
+               $iwResultListOutput = '';
+
                foreach ( $iwResults as $iwPrefix => $results ) {
-                       $out .= $this->headerHtml( $iwPrefix, $term );
-                       $out .= "<ul class='mw-search-iwresults'>";
                        // TODO: Assumes interwiki results are never paginated
                        $position = 0;
+                       $iwResultItemOutput = '';
+
+                       $iwDisplayType = isset( $this->iwPrefixDisplayTypes[$iwPrefix] )
+                               ? $this->iwPrefixDisplayTypes[$iwPrefix]
+                               : "";
+
                        foreach ( $results as $result ) {
-                               $out .= $this->resultWidget->render( $result, $term, $position++ );
+                               $iwResultItemOutput .= $this->resultWidget->render( $result, $term, $position++ );
                        }
-                       $out .= "</ul>";
+
+                       $headerHtml = $this->headerHtml( $term, $iwPrefix );
+                       $footerHtml = $this->footerHtml( $term, $iwPrefix );
+                       $iwResultListOutput .= Html::rawElement( 'li',
+                               [
+                                       'class' => 'iw-resultset iw-resultset--' . $iwDisplayType,
+                                       'data-iw-resultset-pos' => $iwResultSetPos
+                               ],
+                               $headerHtml .
+                               $iwResultItemOutput .
+                               $footerHtml
+                       );
+
+                       $iwResultSetPos++;
                }
 
-               return
-                       "<div id='mw-search-interwiki'>" .
-                               "<div id='mw-search-interwiki-caption'>" .
-                                       $this->specialSearch->msg( 'search-interwiki-caption' )->text() .
-                               '</div>' .
-                               $out .
-                       "</div>";
+               return Html::rawElement(
+                       'div',
+                       [ 'id' => 'mw-interwiki-results' ],
+                       Html::rawElement(
+                               'p',
+                               [ 'class' => 'iw-headline' ],
+                               $this->specialSearch->msg( 'search-interwiki-caption' )->escaped()
+                       ) .
+                       Html::rawElement(
+                               'ul', [ 'class' => 'iw-results', ], $iwResultListOutput
+                       )
+               );
        }
 
        /**
         * Generates an appropriate HTML header for the given interwiki prefix
         *
-        * @param string $iwPrefix Interwiki prefix of wiki to show header for
         * @param string $term User provided search term
+        * @param string $iwPrefix Interwiki prefix of wiki to show header for
         * @return string HTML
         */
-       protected function headerHtml( $iwPrefix, $term ) {
+       protected function headerHtml( $term, $iwPrefix ) {
+
+               $iwDisplayType = isset( $this->iwPrefixDisplayTypes[$iwPrefix] )
+                       ? $this->iwPrefixDisplayTypes[$iwPrefix]
+                       : "";
+
                if ( isset( $this->customCaptions[$iwPrefix] ) ) {
+                       /* customCaptions composed by loadCustomCaptions() with pre-escaped content.*/
                        $caption = $this->customCaptions[$iwPrefix];
                } else {
                        $interwiki = $this->iwLookup->fetch( $iwPrefix );
                        $parsed = wfParseUrl( wfExpandUrl( $interwiki ? $interwiki->getURL() : '/' ) );
-                       $caption = $this->specialSearch->msg( 'search-interwiki-default', $parsed['host'] )->text();
+                       $caption = $this->specialSearch->msg( 'search-interwiki-default', $parsed['host'] )->escaped();
                }
-               $searchLink = $this->linkRenderer->makeLink(
-                       Title::newFromText( "$iwPrefix:Special:Search" ),
-                       $this->specialSearch->msg( 'search-interwiki-more' )->text(),
-                       [],
-                       [
-                               'search' => $term,
-                               'fulltext' => 1,
-                       ]
+
+               return Html::rawElement( 'div', [ 'class' => 'iw-result__header' ],
+                       Html::rawElement( 'span', [ 'class' => 'iw-result__icon iw-result__icon--' . $iwDisplayType ] )
+                       . $caption
                );
-               return
-                       "<div class='mw-search-interwiki-project'>" .
-                               "<span class='mw-search-interwiki-more'>{$searchLink}</span>" .
-                               $caption .
-               "</div>";
+       }
+
+       /**
+        * Generates an HTML footer for the given interwiki prefix
+        *
+        * @param string $term User provided search term
+        * @param string $iwPrefix Interwiki prefix of wiki to show footer for
+        * @return string HTML
+        */
+       protected function footerHtml( $term, $iwPrefix ) {
+
+               $href = Title::makeTitle( NS_SPECIAL, 'Search', null, $iwPrefix )->getLocalURL(
+                       [ 'search' => $term, 'fulltext' => 1 ]
+               );
+
+               $searchLink = Html::rawElement(
+                       'a',
+                       [ 'href' => $href ],
+                       $this->specialSearch->msg( 'search-interwiki-more' )->escaped()
+               );
+
+               return Html::rawElement( 'div', [ 'class' => 'iw-result__footer' ], $searchLink );
        }
 
        protected function loadCustomCaptions() {
@@ -119,7 +173,7 @@ class InterwikiSearchResultSetWidget {
                }
 
                $this->customCaptions = [];
-               $customLines = explode( "\n", $this->specialSearch->msg( 'search-interwiki-custom' )->text() );
+               $customLines = explode( "\n", $this->specialSearch->msg( 'search-interwiki-custom' )->escaped() );
                foreach ( $customLines as $line ) {
                        $parts = explode( ':', $line, 2 );
                        if ( count( $parts ) === 2 ) {
diff --git a/includes/widget/search/InterwikiSearchResultWidget.php b/includes/widget/search/InterwikiSearchResultWidget.php
new file mode 100644 (file)
index 0000000..44229b8
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+
+namespace MediaWiki\Widget\Search;
+
+use HtmlArmor;
+use MediaWiki\Linker\LinkRenderer;
+use SearchResult;
+use SpecialSearch;
+use Title;
+use Html;
+
+/**
+ * Renders an enhanced interwiki result
+ */
+class InterwikiSearchResultWidget implements SearchResultWidget {
+       /** @var SpecialSearch */
+       protected $specialSearch;
+       /** @var LinkRenderer */
+       protected $linkRenderer;
+       /** @var $iwPrefixDisplayTypes */
+       protected $iwPrefixDisplayTypes;
+
+       public function __construct( SpecialSearch $specialSearch, LinkRenderer $linkRenderer ) {
+               $this->specialSearch = $specialSearch;
+               $this->linkRenderer = $linkRenderer;
+               $this->iwPrefixDisplayTypes = $specialSearch->getConfig()->get( 'InterwikiPrefixDisplayTypes' );
+       }
+
+       /**
+        * @param SearchResult $result The result to render
+        * @param string $terms Terms to be highlighted (@see SearchResult::getTextSnippet)
+        * @param int $position The result position, including offset
+        * @return string HTML
+        */
+       public function render( SearchResult $result, $terms, $position ) {
+
+               $title = $result->getTitle();
+               $iwPrefix = $result->getTitle()->getInterwiki();
+               $titleSnippet = $result->getTitleSnippet();
+               $snippet = $result->getTextSnippet( $terms );
+               $displayType = isset( $this->iwPrefixDisplayTypes[$iwPrefix] )
+                       ? $this->iwPrefixDisplayTypes[$iwPrefix]
+                       : "";
+
+               if ( $titleSnippet ) {
+                       $titleSnippet = new HtmlArmor( $titleSnippet );
+               } else {
+                       $titleSnippet = null;
+               }
+
+               $link = $this->linkRenderer->makeLink( $title, $titleSnippet );
+
+               $redirectTitle = $result->getRedirectTitle();
+               $redirect = '';
+               if ( $redirectTitle !== null ) {
+
+                       $redirectText = $result->getRedirectSnippet();
+
+                       if ( $redirectText ) {
+                               $redirectText = new HtmlArmor( $redirectText );
+                       } else {
+                               $redirectText = null;
+                       }
+
+                       $redirect = Html::rawElement( 'span', [ 'class' => 'iw-result__redirect' ],
+                               $this->specialSearch->msg( 'search-redirect' )->rawParams(
+                                       $this->linkRenderer->makeLink( $redirectTitle, $redirectText )
+                               )->escaped()
+                       );
+               }
+
+               switch ( $displayType ) {
+                       case 'definition':
+                               return "<div class='iw-result__content'>" .
+                                       "<span class='iw-result__title'>{$link} {$redirect}: </span>" .
+                                       $snippet .
+                               "</div>";
+                       case 'quotation':
+                               return "<div class='iw-result__content'>{$snippet}</div>" .
+                                       "<div class='iw-result__title'>{$link} {$redirect}</div>";
+                       default:
+                               return "<div class='iw-result__title'>{$link} {$redirect}</div>" .
+                                       "<div class='iw-result__content'>{$snippet}</div>";
+               };
+       }
+}
diff --git a/includes/widget/search/SearchResultSetWidget.php b/includes/widget/search/SearchResultSetWidget.php
new file mode 100644 (file)
index 0000000..6df6e65
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace MediaWiki\Widget\Search;
+
+use SearchResultSet;
+
+/**
+ * Renders a set of search results to HTML
+ */
+interface SearchResultSetWidget {
+       /**
+        * @param string $term User provided search term
+        * @param SearchResultSet|SearchResultSet[] $resultSets List of interwiki
+        *  results to render.
+        * @return string HTML
+        */
+       public function render( $term, $resultSets );
+}
diff --git a/includes/widget/search/SimpleSearchResultSetWidget.php b/includes/widget/search/SimpleSearchResultSetWidget.php
new file mode 100644 (file)
index 0000000..49ebc4e
--- /dev/null
@@ -0,0 +1,132 @@
+<?php
+
+namespace MediaWiki\Widget\Search;
+
+use MediaWiki\Interwiki\InterwikiLookup;
+use MediaWiki\Linker\LinkRenderer;
+use SearchResultSet;
+use SpecialSearch;
+use Title;
+use Html;
+
+/**
+ * Renders one or more SearchResultSets into a sidebar grouped by
+ * interwiki prefix. Includes a per-wiki header indicating where
+ * the results are from.
+ */
+class SimpleSearchResultSetWidget implements SearchResultSetWidget{
+       /** @var SpecialSearch */
+       protected $specialSearch;
+       /** @var SearchResultWidget */
+       protected $resultWidget;
+       /** @var string[]|null */
+       protected $customCaptions;
+       /** @var LinkRenderer */
+       protected $linkRenderer;
+       /** @var InterwikiLookup */
+       protected $iwLookup;
+
+       public function __construct(
+               SpecialSearch $specialSearch,
+               SearchResultWidget $resultWidget,
+               LinkRenderer $linkRenderer,
+               InterwikiLookup $iwLookup
+       ) {
+               $this->specialSearch = $specialSearch;
+               $this->resultWidget = $resultWidget;
+               $this->linkRenderer = $linkRenderer;
+               $this->iwLookup = $iwLookup;
+       }
+
+       /**
+        * @param string $term User provided search term
+        * @param SearchResultSet|SearchResultSet[] $resultSets List of interwiki
+        *  results to render.
+        * @return string HTML
+        */
+       public function render( $term, $resultSets ) {
+               if ( !is_array( $resultSets ) ) {
+                       $resultSets = [ $resultSets ];
+               }
+
+               $this->loadCustomCaptions();
+
+               $iwResults = [];
+               foreach ( $resultSets as $resultSet ) {
+                       $result = $resultSet->next();
+                       while ( $result ) {
+                               if ( !$result->isBrokenTitle() ) {
+                                       $iwResults[$result->getTitle()->getInterwiki()][] = $result;
+                               }
+                               $result = $resultSet->next();
+                       }
+               }
+
+               $out = '';
+               foreach ( $iwResults as $iwPrefix => $results ) {
+                       $out .= $this->headerHtml( $iwPrefix, $term );
+                       $out .= "<ul class='mw-search-iwresults'>";
+                       // TODO: Assumes interwiki results are never paginated
+                       $position = 0;
+                       foreach ( $results as $result ) {
+                               $out .= $this->resultWidget->render( $result, $term, $position++ );
+                       }
+                       $out .= "</ul>";
+               }
+
+               return
+                       "<div id='mw-search-interwiki'>" .
+                               "<div id='mw-search-interwiki-caption'>" .
+                                       $this->specialSearch->msg( 'search-interwiki-caption' )->escaped() .
+                               '</div>' .
+                               $out .
+                       "</div>";
+       }
+
+       /**
+        * Generates an appropriate HTML header for the given interwiki prefix
+        *
+        * @param string $iwPrefix Interwiki prefix of wiki to show header for
+        * @param string $term User provided search term
+        * @return string HTML
+        */
+       protected function headerHtml( $iwPrefix, $term ) {
+               if ( isset( $this->customCaptions[$iwPrefix] ) ) {
+                       $caption = $this->customCaptions[$iwPrefix];
+               } else {
+                       $interwiki = $this->iwLookup->fetch( $iwPrefix );
+                       $parsed = wfParseUrl( wfExpandUrl( $interwiki ? $interwiki->getURL() : '/' ) );
+                       $caption = $this->specialSearch->msg( 'search-interwiki-default', $parsed['host'] )->escaped();
+               }
+
+               $href = Title::makeTitle( NS_SPECIAL, 'Search', null, $iwPrefix )->getLocalURL(
+                       [ 'search' => $term, 'fulltext' => 1 ]
+               );
+               $searchLink = Html::rawElement(
+                       'a',
+                       [ 'href' => $href ],
+                       $this->specialSearch->msg( 'search-interwiki-more' )->escaped()
+               );
+
+               return
+                       "<div class='mw-search-interwiki-project'>" .
+                               "<span class='mw-search-interwiki-more'>{$searchLink}</span>" .
+                               $caption .
+               "</div>";
+       }
+
+       protected function loadCustomCaptions() {
+               if ( $this->customCaptions !== null ) {
+                       return;
+               }
+
+               $this->customCaptions = [];
+               $customLines = explode( "\n", $this->specialSearch->msg( 'search-interwiki-custom' )->escaped() );
+               foreach ( $customLines as $line ) {
+                       $parts = explode( ':', $line, 2 );
+                       if ( count( $parts ) === 2 ) {
+                               $this->customCaptions[$parts[0]] = $parts[1];
+                       }
+               }
+       }
+}
index 81d9af1..b1e97be 100644 (file)
        "search-interwiki-default": "Results from $1:",
        "search-interwiki-custom": "",
        "search-interwiki-more": "(more)",
+       "search-interwiki-more-results": "more results",
        "search-relatedarticle": "Related",
        "searchrelated": "related",
        "searchall": "all",
index b141ffc..6ad64aa 100644 (file)
        "search-interwiki-default": "Parameters:\n* $1 - the hostname of the remote wiki from where the additional results listed below are returned",
        "search-interwiki-custom": "#REDIRECT [[MediaWiki:Wmf-search-interwiki-custom/qqq]]",
        "search-interwiki-more": "{{Identical|More}}",
+       "search-interwiki-more-results": "Label for a link that leads to more search results from a given wiki.",
        "search-relatedarticle": "This is a search result (and I guess search engine) dependent messages. I do not know how to trigger the feature. The message is displayed if the search result contains information that related pages can also be provided from the search engine. I assume this is \"More Like This\" functionality. Microsoft glossary defines MLT as \"A way to refine search by identifying the right set of documents and then locating similar documents. This allows the searcher to control the direction of the search and focus on the most fruitful lines of inquiry.\"[http://www.microsoft.com/enterprisesearch/en/us/search-glossary.aspx]\n{{Identical|Related}}",
        "searchrelated": "This is a search result (and I guess search engine) dependent messages. I do not know how to trigger the feature. The message is displayed if the search result contains information that related pages can also be provided from the search engine. I assume this is \"More Like This\" functionality. Microsoft glossary defines MLT as \"A way to refine search by identifying the right set of documents and then locating similar documents. This allows the searcher to control the direction of the search and focus on the most fruitful lines of inquiry.\"[http://www.microsoft.com/enterprisesearch/en/us/search-glossary.aspx]\n{{Identical|Related}}",
        "searchall": "{{Identical|All}}",
index f14787f..7e64b77 100644 (file)
@@ -1983,6 +1983,23 @@ return [
                'styles' => 'resources/src/mediawiki.special/mediawiki.special.search.styles.css',
                'targets' => [ 'desktop', 'mobile' ],
        ],
+       'mediawiki.special.search.interwikiwidget.styles' => [
+               'styles' => 'resources/src/mediawiki.special/'
+                       . 'mediawiki.special.search.interwikiwidget.styles.less',
+               'targets' => [ 'desktop', 'mobile' ]
+       ],
+       'mediawiki.special.search.commonsInterwikiWidget' => [
+               'scripts' => 'resources/src/mediawiki.special/mediawiki.special.search.commonsInterwikiWidget.js',
+               'dependencies' => [
+                       'mediawiki.Uri',
+                       'mediawiki.jqueryMsg'
+               ],
+               'targets' => [ 'desktop', 'mobile' ],
+               'messages' => [
+                       'search-interwiki-more',
+                       'searchprofile-images'
+               ],
+       ],
        'mediawiki.special.undelete' => [
                'scripts' => 'resources/src/mediawiki.special/mediawiki.special.undelete.js',
        ],
diff --git a/resources/src/mediawiki.special/images/special.search/book-icon.png b/resources/src/mediawiki.special/images/special.search/book-icon.png
new file mode 100644 (file)
index 0000000..07e3ec7
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/book-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/book-icon.svg b/resources/src/mediawiki.special/images/special.search/book-icon.svg
new file mode 100644 (file)
index 0000000..6c3fa5f
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>wikisource-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs>
+        <path d="M25.9612634,4.16259168 C25.9612634,3.05318514 26.8209364,1.88015355 27.8804771,1.5831456 C27.8804771,1.5831456 45.019739,-4.60039908 52.9189989,7.7430239 C52.8276879,7.87091176 53.3244937,43.6894771 53.0961715,43.801598 C38.1346526,39.2213878 27.8617804,43.2196252 27.8617804,43.2196252 C26.8121538,43.5410399 25.9612634,42.9124575 25.9612634,41.7928397 L25.9612634,4.16259168 Z" id="path-1"></path>
+        <mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="27.195528" height="43.7625003" fill="white">
+            <use xlink:href="#path-1"></use>
+        </mask>
+        <path d="M1.08483248,4.15020908 C1.08483248,3.04080253 1.94450542,1.86777094 3.00404616,1.57076299 C3.00404616,1.57076299 20.1433081,-4.61278168 28.0425679,7.73064129 C27.951257,7.85852916 28.4480627,43.6770945 28.2197406,43.7892154 C13.2582217,39.2090052 2.98534945,43.2072426 2.98534945,43.2072426 C1.93572291,43.5286573 1.08483248,42.9000749 1.08483248,41.7804571 L1.08483248,4.15020908 Z" id="path-3"></path>
+        <mask id="mask-4" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="27.195528" height="43.7625003" fill="white">
+            <use xlink:href="#path-3"></use>
+        </mask>
+    </defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="wikisource">
+            <g id="Group-2" transform="translate(3.000000, 7.000000)">
+                <g id="Group">
+                    <rect id="Rectangle-3" fill="#000000" x="19.5269846" y="36.730429" width="15.1876547" height="9.47882039" rx="4.7394102"></rect>
+                    <rect id="Rectangle" fill="#000000" x="0" y="8.29396785" width="55.3264563" height="35.5455765" rx="2"></rect>
+                    <use id="Rectangle-2" stroke="#000000" mask="url(#mask-2)" stroke-width="4" fill="#FFFFFF" transform="translate(39.559027, 21.920348) scale(-1, 1) translate(-39.559027, -21.920348) " xlink:href="#path-1"></use>
+                    <use id="Rectangle-2" stroke="#000000" mask="url(#mask-4)" stroke-width="4" fill="#FFFFFF" xlink:href="#path-3"></use>
+                </g>
+                <path d="M5.94322419,22.653192 C15.2672322,19.3261075 22.9765332,23.990418 22.9765332,23.990418" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="round"></path>
+                <path d="M5.94322419,16.7331266 C15.2672322,13.4060421 22.9765332,18.0703525 22.9765332,18.0703525" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="round"></path>
+                <path d="M5.94322419,11.0846878 C15.2672322,7.75760327 22.9765332,12.4219137 22.9765332,12.4219137" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="round"></path>
+                <path d="M5.94322419,28.5732575 C15.2672322,25.246173 22.9765332,29.9104834 22.9765332,29.9104834" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="round"></path>
+                <path d="M5.94322419,34.4933229 C15.2672322,31.1662384 22.9765332,35.8305489 22.9765332,35.8305489" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="round"></path>
+                <path d="M31.8963536,26.2991517 C41.2203616,22.7867165 48.9296626,27.2977748 48.9296626,27.2977748" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="round"></path>
+                <path d="M31.8963536,32.2192172 C41.2203616,28.7067819 48.9296626,33.2178402 48.9296626,33.2178402" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="round"></path>
+                <path d="M32.1957977,11.8254134 C32.1957977,11.8254134 34.7092977,10.1127027 40.1604435,10.1337008 C45.6115894,10.1546989 47.8024685,11.8254134 47.8024685,11.8254134 L47.8024685,21.3219156 C47.8024685,21.3219156 43.8085467,20.1940894 39.931856,20.1940894 C36.0551653,20.1940894 32.1957977,21.3219156 32.1957977,21.3219156 L32.1957977,11.8254134 Z" id="Rectangle-4" fill="#000000"></path>
+            </g>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/images/special.search/course-icon.png b/resources/src/mediawiki.special/images/special.search/course-icon.png
new file mode 100644 (file)
index 0000000..9aad230
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/course-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/course-icon.svg b/resources/src/mediawiki.special/images/special.search/course-icon.svg
new file mode 100644 (file)
index 0000000..4fab1f3
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>wikiversity-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs>
+        <path d="M1.79361627,13.3306367 C-0.140465792,12.4757391 -0.144839204,11.0916093 1.78234628,10.2397601 L23.5026391,0.639016247 C25.4304969,-0.213130142 28.5529839,-0.214539335 30.4952998,0.64399778 L52.8863837,10.5412429 C54.8204658,11.3961405 54.8248392,12.7802702 52.8976537,13.6321195 L31.1773609,23.2328633 C29.2495031,24.0850097 26.1270161,24.0864189 24.1847002,23.2278818 L1.79361627,13.3306367 Z" id="path-1"></path>
+        <mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="-5" y="-5" width="64" height="33.8718796">
+            <rect x="-4.66" y="-5" width="64" height="33.8718796" fill="white"></rect>
+            <use xlink:href="#path-1" fill="black"></use>
+        </mask>
+        <circle id="path-3" cx="7" cy="27" r="5"></circle>
+        <mask id="mask-4" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="-3" y="-3" width="16" height="16">
+            <rect x="-1" y="19" width="16" height="16" fill="white"></rect>
+            <use xlink:href="#path-3" fill="black"></use>
+        </mask>
+    </defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="wikiversity">
+            <g id="Group-2" transform="translate(3.000000, 11.000000)">
+                <path d="M8,16 L47,16 L47,31.89585 C47,31.89585 42.2783874,38.5113751 27.5,38.8710875 C12.7216126,39.2307999 8,31.89585 8,31.89585 L8,22.2392885 L8,16 Z" id="Rectangle-3" fill="#000000"></path>
+                <g id="Rectangle">
+                    <use fill="#000000" fill-rule="evenodd" xlink:href="#path-1"></use>
+                    <use stroke="#F2F4F7" mask="url(#mask-2)" stroke-width="10" xlink:href="#path-1"></use>
+                </g>
+                <path d="M6.1310053,41.2112479 C5.27479784,42.0096083 10.4373919,43.6053602 11.2296387,43.6053602 C13.2555121,37.7460829 11.8321108,35.5517452 11.8321108,29.1181019 L11.8321108,21.2930015 C11.8321108,21.2930015 16.5515035,18.1566713 21.2216931,16.0206053 C25.8918828,13.8845392 31.215528,12.2538646 31.3550046,12.2096604 C32.1176432,11.9679575 31.2752162,9.09848389 30.5125776,9.34018676 C30.3644648,9.38712813 27.3667572,9.04545881 26.6057472,9.30621378 C24.4302064,10.0516482 11.7945726,16.3687146 9.43776817,19.1164347 C7.08096377,21.8641549 8.67910884,38.8352994 6.1310053,41.2112479 Z" id="Path-3" fill="#F2F4F7"></path>
+                <g id="Oval-3">
+                    <use fill="#000000" fill-rule="evenodd" xlink:href="#path-3"></use>
+                    <use stroke="#F2F4F7" mask="url(#mask-4)" stroke-width="6" xlink:href="#path-3"></use>
+                </g>
+                <path d="M1.13550659,38.2112479 C0.245905063,39.0096083 7.57084983,40.6053602 8.39399608,40.6053602 C9.78724127,36.7270479 9.71041095,34.4853149 9.49920479,31.5470605 C9.43416647,30.6422615 9.35638589,29.6714145 9.30486594,28.5663921 C9.27092907,27.8384991 9.24838677,27.052387 9.24838677,26.1885838 C9.24838677,21.7929074 8.92187195,20.3988432 10.0589683,18.8611032 C10.5891389,18.1441327 14.9624282,15.1566713 19.814766,13.0206053 C24.6671038,10.8845392 30.1983835,9.25386462 30.3432999,9.20966036 C31.1356832,8.96795749 30.2603996,6.09848389 29.4680164,6.34018676 C29.3141268,6.38712813 27.238504,7.04545881 26.4478128,7.30621378 C24.187421,8.05164822 9.84272127,11.7529088 7.39399608,14.500629 C4.94527088,17.2483492 3.78299204,35.8352994 1.13550659,38.2112479 Z" id="Path-3" fill="#000000"></path>
+            </g>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/images/special.search/definition-icon.png b/resources/src/mediawiki.special/images/special.search/definition-icon.png
new file mode 100644 (file)
index 0000000..b279f4e
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/definition-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/definition-icon.svg b/resources/src/mediawiki.special/images/special.search/definition-icon.svg
new file mode 100644 (file)
index 0000000..1d58906
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>wiktionary-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs>
+        <rect id="path-1" x="0" y="0" width="38.7837838" height="45.5813953" rx="3"></rect>
+        <mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="38.7837838" height="45.5813953" fill="white">
+            <use xlink:href="#path-1"></use>
+        </mask>
+    </defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="wiktionary">
+            <g id="Group" transform="translate(9.000000, 4.000000)">
+                <rect id="Rectangle-5" fill="#000000" x="2.21621622" y="4.55813953" width="38.7837838" height="44.4418605" rx="3"></rect>
+                <use id="Rectangle-5" stroke="#FFFFFF" mask="url(#mask-2)" stroke-width="4" fill="#000000" xlink:href="#path-1"></use>
+                <rect id="Rectangle-5" fill="#000000" x="2.21621622" y="2.27906977" width="3.32432432" height="45.5813953" rx="1.66216216"></rect>
+                <path d="M9.96584688,24.0254991 L12.5526201,16.7046287 L12.5953767,16.7046287 L15.1393934,24.0254991 L9.96584688,24.0254991 Z M11.4837056,14.8139535 L5.54054054,30.5109549 L7.61423481,30.5109549 L9.32449813,25.7842668 L15.7807422,25.7842668 L17.4482489,30.5109549 L19.6929695,30.5109549 L13.7284262,14.8139535 L11.4837056,14.8139535 Z M19.9922656,28.7521872 L19.9922656,30.5109549 L32.1351351,30.5109549 L32.1351351,28.7521872 L22.4080125,28.7521872 L31.8785956,16.5727212 L31.8785956,14.8139535 L20.7191275,14.8139535 L20.7191275,16.5727212 L29.484227,16.5727212 L19.9922656,28.7521872 Z" id="AZ" fill="#FFFFFF"></path>
+            </g>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/images/special.search/dna-icon.png b/resources/src/mediawiki.special/images/special.search/dna-icon.png
new file mode 100644 (file)
index 0000000..76ae7b9
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/dna-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/dna-icon.svg b/resources/src/mediawiki.special/images/special.search/dna-icon.svg
new file mode 100644 (file)
index 0000000..b6472d2
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>wikispecies-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs>
+        <path d="M30.7731558,0.186194824 C30.7731558,0.186194824 35.1530541,17.902764 16.3205992,24.2966289 C-2.5118558,30.6904937 1.3758711,49.1033824 1.3758711,49.1033824" id="path-1"></path>
+        <path d="M30.7473572,49.159218 C30.7473572,49.159218 35.6539441,38.982551 16.3205992,25.0539186 C-3.01274582,11.1252862 1.37060607,0.169606006 1.37060607,0.169606006" id="path-2"></path>
+    </defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="wikispecies">
+            <g id="Group-3" transform="translate(29.651065, 29.732290) rotate(-18.000000) translate(-29.651065, -29.732290) translate(3.651065, -0.267710)">
+                <g id="Group-2" transform="translate(-0.000000, 0.000000)">
+                    <path d="M16.0550183,26.1396841 L28.2093366,18.8733993" id="Line"></path>
+                    <path d="M8.04887438,16.7717325 L25.4345247,6.48465118" id="Line" stroke="#000000" stroke-width="4" stroke-linecap="square"></path>
+                    <path d="M25.407947,53.9559038 L42.7935973,43.6688225" id="Line" stroke="#000000" stroke-width="4" stroke-linecap="square"></path>
+                    <path d="M15.372315,23.3571115 L32.7579654,13.0700302" id="Line" stroke="#000000" stroke-width="4" stroke-linecap="square"></path>
+                    <path d="M23.3476093,40.6564377 L35.5019275,33.3901529" id="Line"></path>
+                    <path d="M23.587979,44.4357028 L40.6040246,34.7578672" id="Line" stroke="#000000" stroke-width="4" stroke-linecap="square"></path>
+                    <g id="Group" transform="translate(26.088934, 30.408062) rotate(-27.000000) translate(-26.088934, -30.408062) translate(10.088934, 5.408062)">
+                        <g id="Path-2">
+                            <use stroke="#FFFFFF" stroke-width="10" xlink:href="#path-1"></use>
+                            <use stroke="#000000" stroke-width="5" xlink:href="#path-1"></use>
+                        </g>
+                        <g id="Path-2">
+                            <use stroke="#FFFFFF" stroke-width="10" xlink:href="#path-2"></use>
+                            <use stroke="#000000" stroke-width="5" xlink:href="#path-2"></use>
+                        </g>
+                    </g>
+                </g>
+            </g>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/images/special.search/image-icon.png b/resources/src/mediawiki.special/images/special.search/image-icon.png
new file mode 100644 (file)
index 0000000..1ebbc74
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/image-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/image-icon.svg b/resources/src/mediawiki.special/images/special.search/image-icon.svg
new file mode 100644 (file)
index 0000000..b68762e
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>commons-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs></defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="commons">
+            <g id="Group" transform="translate(7.000000, 10.000000)">
+                <rect id="Rectangle-3" fill="#000000" x="0" y="7" width="47" height="32" rx="3"></rect>
+                <path d="M12.5575779,0.983966166 C12.6781522,0.440536658 13.228439,0 13.7774775,0 L33.4411152,0 C33.9942728,0 34.5376987,0.428179934 34.6610148,0.983966166 L36.1940854,7.89352671 C36.3146597,8.43695622 35.9679607,8.87749288 35.4086105,8.87749288 L11.8099821,8.87749288 C11.255602,8.87749288 10.9011913,8.44931294 11.0245073,7.89352671 L12.5575779,0.983966166 Z" id="Rectangle-3" fill="#000000"></path>
+                <ellipse id="Oval" stroke="#FFFFFF" stroke-width="3" cx="23.1981132" cy="23.2091168" rx="10.1981132" ry="10.2091168"></ellipse>
+            </g>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/images/special.search/news-icon.png b/resources/src/mediawiki.special/images/special.search/news-icon.png
new file mode 100644 (file)
index 0000000..6b79590
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/news-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/news-icon.svg b/resources/src/mediawiki.special/images/special.search/news-icon.svg
new file mode 100644 (file)
index 0000000..996bc84
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>wikinews-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs>
+        <rect id="path-1" x="0" y="0" width="40.3125" height="44.3773585" rx="3"></rect>
+        <mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="0" y="0" width="40.3125" height="44.3773585" fill="white">
+            <use xlink:href="#path-1"></use>
+        </mask>
+    </defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="wikinews">
+            <g id="Group-2" transform="translate(7.000000, 2.000000)">
+                <g id="Group">
+                    <use id="Rectangle" stroke="#000000" mask="url(#mask-2)" stroke-width="8" xlink:href="#path-1"></use>
+                    <rect id="Rectangle-2" fill="#000000" x="5.87890625" y="7.10037736" width="14.2773438" height="15.0883019" rx="1"></rect>
+                    <path d="M23.9355469,8.32075472 L33.2060822,8.32075472" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="square"></path>
+                    <path d="M23.9355469,13.8679245 L33.2060822,13.8679245" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="square"></path>
+                    <path d="M23.9355469,19.4150943 L33.2060822,19.4150943" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="square"></path>
+                    <path d="M22.5550667,30.509434 L33.1506715,30.509434" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="square"></path>
+                    <path d="M7.17212403,30.509434 L17.1811761,30.509434" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="square"></path>
+                    <path d="M7.17212403,35.1320755 L17.1811761,35.1320755" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="square"></path>
+                    <path d="M22.5550667,35.1320755 L33.1506715,35.1320755" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="square"></path>
+                    <path d="M7.12514628,24.9622642 L33.2060822,24.9622642" id="Line" stroke="#000000" stroke-width="2" stroke-linecap="square"></path>
+                </g>
+                <path d="M42.1813257,4.62264151 C43.7380365,4.62264151 45,5.85586295 45,7.39864403 L45,46.2239975 C45,47.7571413 43.7493218,49 42.1813257,49 L7.50617429,49 C5.94946346,49 4.6875,47.7667786 4.6875,46.2239975" id="Rectangle" stroke="#000000" stroke-width="4"></path>
+            </g>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/images/special.search/quotation-icon.png b/resources/src/mediawiki.special/images/special.search/quotation-icon.png
new file mode 100644 (file)
index 0000000..9d3ade3
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/quotation-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/quotation-icon.svg b/resources/src/mediawiki.special/images/special.search/quotation-icon.svg
new file mode 100644 (file)
index 0000000..0a24b3e
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>wikiquote-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs></defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="wikiquote" fill="#000000">
+            <path d="M25.6795093,50 L25.6795093,29.5241523 L16.904146,29.5241523 C16.904146,26.2444546 17.52462,23.4744813 18.7655867,21.2141491 C20.0065533,18.9538169 22.3111712,17.2475134 25.6795093,16.0951872 L25.6795093,7.31982385 C22.9316545,7.67438575 20.383279,8.49429786 18.0343064,9.77958478 C15.6853338,11.0648717 13.6687932,12.6825361 11.9846241,14.6326266 C10.300455,16.5827171 8.99302762,18.8430154 8.06230261,21.4135892 C7.13157761,23.984163 6.71054166,26.7319766 6.79918214,29.6571123 L6.79918214,50 L25.6795093,50 Z M54,50 L54,29.5241523 L45.2246367,29.5241523 C45.2246367,26.2444546 45.8451107,23.4744813 47.0860774,21.2141491 C48.3270441,18.9538169 50.6316619,17.2475134 54,16.0951872 L54,7.31982385 C51.2521452,7.67438575 48.7037697,8.49429786 46.3547971,9.77958478 C44.0058245,11.0648717 41.9892839,12.6825361 40.3051148,14.6326266 C38.6209458,16.5827171 37.3135183,18.8430154 36.3827933,21.4135892 C35.4520683,23.984163 35.0310324,26.7319766 35.1196729,29.6571123 L35.1196729,50 L54,50 Z" id="“"></path>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/images/special.search/textbook-icon.png b/resources/src/mediawiki.special/images/special.search/textbook-icon.png
new file mode 100644 (file)
index 0000000..0de2821
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/textbook-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/textbook-icon.svg b/resources/src/mediawiki.special/images/special.search/textbook-icon.svg
new file mode 100644 (file)
index 0000000..52446b8
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>wikibooks-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs></defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="wikibooks">
+            <g id="Group-2" transform="translate(7.000000, 6.000000)">
+                <rect id="Rectangle" fill="#000000" x="0" y="0" width="13.4872062" height="46.9333333" rx="1"></rect>
+                <rect id="Rectangle" fill="#000000" x="16.3773218" y="0" width="13.4872062" height="46.9333333" rx="1"></rect>
+                <rect id="Rectangle-2" fill="#FFFFFF" x="18.3040656" y="3.2" width="9.63371872" height="2.13333333" rx="1"></rect>
+                <rect id="Rectangle-2" fill="#FFFFFF" x="18.3040656" y="7.46666667" width="9.63371872" height="2.13333333" rx="1"></rect>
+                <rect id="Rectangle-2" fill="#FFFFFF" x="18.3040656" y="42.6666667" width="9.63371872" height="2.13333333" rx="1"></rect>
+                <g id="Group" transform="translate(41.629197, 24.582549) rotate(-15.000000) translate(-41.629197, -24.582549) translate(36.629197, 2.082549)">
+                    <rect id="Rectangle" fill="#000000" x="-9.14823772e-14" y="1.0658141e-14" width="9.63371872" height="44.8" rx="1"></rect>
+                    <rect id="Rectangle-2" fill="#FFFFFF" x="1.37624553" y="3.05454545" width="6.88122765" height="2.03636364" rx="1"></rect>
+                    <rect id="Rectangle-2" fill="#FFFFFF" x="4.12873659" y="18.3272727" width="2.0643683" height="8.14545455" rx="1"></rect>
+                    <rect id="Rectangle-2" fill="#FFFFFF" x="1.37624553" y="40.7272727" width="6.88122765" height="2.03636364" rx="1"></rect>
+                </g>
+                <rect id="Rectangle-2" fill="#FFFFFF" x="1.92674374" y="42.6666667" width="9.63371872" height="2.13333333" rx="1"></rect>
+                <rect id="Rectangle-2" fill="#FFFFFF" x="3.85348749" y="21.3333333" width="5.78023123" height="6.4" rx="1"></rect>
+                <rect id="Rectangle-2" fill="#FFFFFF" x="20.2308093" y="21.3333333" width="5.78023123" height="6.4" rx="1"></rect>
+                <rect id="Rectangle-2" fill="#FFFFFF" x="1.92674374" y="2.13333333" width="9.63371872" height="6.4" rx="1"></rect>
+            </g>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/images/special.search/travel-icon.png b/resources/src/mediawiki.special/images/special.search/travel-icon.png
new file mode 100644 (file)
index 0000000..9540e5b
Binary files /dev/null and b/resources/src/mediawiki.special/images/special.search/travel-icon.png differ
diff --git a/resources/src/mediawiki.special/images/special.search/travel-icon.svg b/resources/src/mediawiki.special/images/special.search/travel-icon.svg
new file mode 100644 (file)
index 0000000..c61da34
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 41.2 (35397) - http://www.bohemiancoding.com/sketch -->
+    <title>wikivoyage-icon</title>
+    <desc>Created with Sketch.</desc>
+    <defs></defs>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="wikivoyage">
+            <circle id="Oval" stroke="#000000" stroke-width="5" cx="30.5" cy="29.5" r="22.5"></circle>
+            <polygon id="Line" fill="#000000" points="7.94117647 26 51.7647059 26 51.7647059 21 7.94117647 21"></polygon>
+            <polygon id="Line" fill="#000000" points="11 41 51.7647059 41 51.7647059 36 11 36"></polygon>
+            <path d="M33.3291453,53.239081 C33.3291453,53.239081 36.1487341,50.645866 37.4655139,48.564933 C41.2810931,42.5350981 43.5882353,36.2426616 43.5882353,29.9411765 C43.5882353,23.6228427 41.2687791,17.4752409 37.4345128,11.7108181 C36.1106408,9.72051335 34.6944337,8.91628537 33.2755423,7.32564334 C32.4145319,6.36041143 26.8207622,5.36041143 25.9597518,6.32564334 C24.5408604,7.91628537 23.1246533,9.72051335 21.8007813,11.7108181 C17.9665151,17.4752409 15.6470588,23.6228427 15.6470588,29.9411765 C15.6470588,36.2426616 17.954201,42.5350981 21.7697802,48.564933 C23.08656,50.645866 26.9061488,53.239081 26.9061488,53.239081 L33.3291453,53.239081 Z M25.9949257,45.8913313 C22.6413872,40.5916685 20.6470588,35.1523918 20.6470588,29.9411765 C20.6470588,24.7468098 22.6290732,19.4935807 25.9639246,14.4799765 C27.1264205,12.7322841 28.3724952,11.1396672 29.6176471,9.73642318 C30.8627989,11.1396672 32.1088737,12.7322841 33.2713695,14.4799765 C36.6062209,19.4935807 38.5882353,24.7468098 38.5882353,29.9411765 C38.5882353,35.1523918 36.5939069,40.5916685 33.2403685,45.8913313 C32.0874519,47.7133081 30.8528466,49.389908 29.6176471,50.8822433 C28.3824475,49.389908 27.1478422,47.7133081 25.9949257,45.8913313 Z" id="Oval" fill="#000000"></path>
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/resources/src/mediawiki.special/mediawiki.special.search.commonsInterwikiWidget.js b/resources/src/mediawiki.special/mediawiki.special.search.commonsInterwikiWidget.js
new file mode 100644 (file)
index 0000000..3810ac1
--- /dev/null
@@ -0,0 +1,80 @@
+( function ( mw, $ ) {
+
+       var api = new mw.Api(),
+               pageUrl = new mw.Uri(),
+               imagesText = new mw.Message( mw.messages, 'searchprofile-images' ),
+               moreResultsText = new mw.Message( mw.messages, 'search-interwiki-more' );
+
+       function itemTemplate( results ) {
+
+               var resultOutput = '', i, result, imageCaption, imageThumbnailSrc;
+
+               for ( i = 0; i < results.length; i++ ) {
+                       result = results[ i ],
+                       imageCaption = mw.html.element( 'span', { 'class': 'iw-result__mini-gallery__caption' }, result.title );
+                       imageThumbnailSrc = ( result.thumbnail ) ? result.thumbnail.source : '';
+                       resultOutput += '<div class="iw-result__mini-gallery">' +
+                                               /* escaping response content */
+                                               mw.html.element( 'a', {
+                                                       href: '/wiki/' + result.title,
+                                                       'class': 'iw-result__mini-gallery__image',
+                                                       style: 'background-image: url(' + imageThumbnailSrc + ');'
+                                               }, new mw.html.Raw( imageCaption ) ) +
+                                       '</div>';
+               }
+
+               return resultOutput;
+       }
+
+       function itemWrapperTemplate( pageQuery, itemTemplateOutput ) {
+
+               return '<li class="iw-resultset iw-resultset--image" data-iw-resultsset-pos="0">' +
+                               '<div class="iw-result__header">' +
+                                       '<span class="iw-result__icon iw-result__icon--image"></span>' +
+                                       '<strong>' + imagesText.escaped() + '</strong>' +
+                               '</div>' +
+                               '<div class="iw-result__content">' +
+                               /* template output has been sanitized by mw.html.element */
+                               itemTemplateOutput +
+                               '</div>' +
+                               '<div class="iw-result__footer">' +
+                                       '<a href="/w/index.php?title=Special:Search&search=' + encodeURIComponent( pageQuery ) + '&fulltext=1&profile=images">' +
+                                               moreResultsText.escaped() +
+                                       '</a>' +
+                               '</div>' +
+                       '</li>';
+
+       }
+
+       api.get( {
+               action: 'query',
+               generator: 'search',
+               gsrsearch: pageUrl.query.search,
+               gsrnamespace: mw.config.get( 'wgNamespaceIds' ).file,
+               gsrlimit: 3,
+               prop: 'pageimages',
+               pilimit: 3,
+               piprop: 'thumbnail',
+               pithumbsize: 300,
+               formatversion: 2
+       } )
+       .done( function ( resp ) {
+               var results = ( resp.query && resp.query.pages ) ? resp.query.pages : false,
+                       multimediaWidgetTemplate;
+
+               if ( !results ) {
+                       return;
+               }
+
+               results.sort( function( a, b ) {
+                       return b.index - a.index;
+               } );
+
+               multimediaWidgetTemplate = itemWrapperTemplate( pageUrl.query.search, itemTemplate( results ) );
+               /* we really only need to wait for document ready for DOM manipulation */
+               $( function () {
+                       $( '.iw-results' ).prepend( multimediaWidgetTemplate );
+               } );
+       } );
+
+}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.special/mediawiki.special.search.interwikiwidget.styles.less b/resources/src/mediawiki.special/mediawiki.special.search.interwikiwidget.styles.less
new file mode 100644 (file)
index 0000000..923b81a
--- /dev/null
@@ -0,0 +1,222 @@
+/* interwiki search results */
+/*==========================*/
+
+#mw-interwiki-results {
+       float: right;
+       width: 30%;
+}
+
+.iw-headline {
+       font-weight: bold;
+    font-size: 1rem;
+    font-size: 16px;
+    opacity: 0.7;
+}
+
+.iw-results {
+    list-style: none;
+       margin: 0;
+}
+
+.iw-resultset {
+       margin-bottom: 1.2em;
+       background-color: #f2f4f7;
+    vertical-align: top;
+    width: 100%;
+    float: left;
+    list-style-type: none;
+}
+
+/* clearfix */
+.iw-result:after {
+    visibility: hidden;
+       display: block;
+       font-size: 0;
+       content: " ";
+       clear: both;
+       height: 0;
+}
+
+* html .interwiki-result             { zoom: 1; } /* IE6 */
+*:first-child+html .iw-resultset { zoom: 1; } /* IE7 */
+
+/* padding each .iw-resultset section seperately.
+This allows us greater flexibility in the design.
+For example changing the background color on the
+header and footer. */
+.iw-result__header,
+.iw-result__title,
+.iw-result__content,
+.iw-result__footer {
+    padding-left: 0.85em;
+    padding-right: 0.85em;
+    padding-top: 0.25em;
+    padding-bottom: 0.25em;
+}
+
+/* definition titles appear inline,
+to resemble a traditional dictionary definition */
+.iw-resultset--definition .iw-result__title {
+    display: inline;
+    padding: 0;
+}
+
+.iw-resultset > div:first-child {
+    padding-top: 0.85em;
+}
+
+.iw-resultset > div:last-child {
+    padding-bottom: 0.85em;
+}
+
+.iw-result__title {
+    font-size: 16px; /* rem fallback */
+    font-size: 1rem;
+}
+
+.iw-result__title a.extiw {
+    color: #252525;
+    font-weight: bold;
+}
+
+.iw-result__content:after { /* clearfix */
+     visibility: hidden;
+     display: block;
+     font-size: 0;
+     content: " ";
+     clear: both;
+     height: 0;
+}
+
+.iw-result__footer {
+    float: right;
+}
+
+.iw-result__icon {
+    display: inline-block;
+    width: 24px;
+    height: 24px;
+    vertical-align: middle;
+    margin-right: 0.25em;
+    background: url( images/special.search/definition-icon.svg ) no-repeat 0 0;
+    background-size: 100% 100%;
+}
+
+@interwikiContentTypes: definition, travel, quotation, book, course, news, textbook, image;
+
+.generate-iwIcons();
+
+.generate-iwIcons( @i:1 ) when ( @i =< length( @interwikiContentTypes ) ) {
+     @iwIcon: extract( @interwikiContentTypes, @i );
+
+    .iw-result__icon--@{iwIcon} {
+        /*  stylelint-disable-next-line function-url-quotes */
+        background-image: url( 'images/special.search/@{iwIcon}-icon.png' );
+        /*  stylelint-disable-next-line function-url-quotes */
+        background-image: url( 'images/special.search/@{iwIcon}-icon.svg' );
+    }
+
+    .generate-iwIcons( @i + 1 );
+}
+
+/* image search result */
+.iw-result__mini-gallery {
+    position: relative;
+    float: left;
+    width: 60%;
+    height: 200px;
+    box-sizing: border-box;
+    padding: 0.25rem;
+}
+
+.iw-result__mini-gallery__image {
+    display: block;
+    position: relative;
+    width: 100%;
+    height: 100%;
+    background-size: cover;
+    background-repeat: no-repeat;
+    background-position: center center;
+}
+
+.iw-result__mini-gallery__image:hover > .iw-result__mini-gallery__caption {
+    visibility: visible;
+}
+
+.iw-result__mini-gallery__image > .iw-result__mini-gallery__caption { /* image gallery text */
+  visibility: hidden;
+  position: absolute;
+  bottom: 0;
+  left: 0;
+  text-align: center;
+  color: #fff;
+  text-shadow: 0 0 10px rgba( 0, 0, 0, 0.4 ); /* improves legibility on white background*/
+  font-size: 0.8em;
+  padding: 5px;
+  background-color: rgba( 0, 0, 0, 0.5 );
+}
+
+.iw-result__mini-gallery:nth-child(2),
+.iw-result__mini-gallery:nth-child(3) { /* second and third images are small */
+    width: 40%;
+    height: 100px;
+}
+
+/* different types of interwiki result boxes */
+/* quotation box */
+.iw-resultset--quotation .iw-result__content {
+    border-left: 4px solid #afb1b5;
+    margin-left: 1em;
+    padding-top: 0;
+    margin-top: 0.25em;
+}
+.iw-resultset--quotation .iw-result__title{
+    margin-left: 1em;
+}
+.iw-result--quotation .iw-result__title:before{
+    content: ' — ';
+    display: inline-block;
+}
+.iw-result--quotation .iw-result__footer {
+    text-align: right;
+}
+
+/* no results
+span the interwiki results across the bottom of the page.
+*/
+
+.mw-search-nonefound ~ #mw-search-interwiki {
+    width: 100%;
+}
+
+.mw-search-nonefound ~ #mw-search-interwiki .iw-resultset {
+    width: 30%;
+    max-width: 300px;
+    margin-left: 0.5em;
+    margin-right: 0.5em;
+}
+
+/* mobile */
+@media only screen and ( max-width:768px ) {
+    #mw-interwiki-results {
+        width: 100%;
+    }
+    .mw-search-results {
+        max-width: none !important;
+    }
+    .iw-resultset {
+        width: 45% !important;
+        margin-left: 0.5em !important;
+        margin-right: 0.5em !important;
+    }
+
+}
+
+@media only screen and ( max-width:600px ) {
+        .iw-resultset {
+        width: 100% !important;
+        margin-left: 0 !important;
+        margin-right: 0 !important;
+        max-width: none !important;
+    }
+}
index ebe9ed9..9559f20 100644 (file)
 .mw-search-nonefound + .mw-search-interwiki-header {
        margin-top: 0;
 }
-.searchresult {
-       font-size: 95%;
-       max-width: 38em;
-}
+
 .mw-search-results {
-       margin-left: 0;
+       margin: 0;
        float: left;
+       max-width: 60%;
 }
 .mw-search-visualclear {
        clear: both;
        float: left;
        width: 100%;
 }
+
+/* Advanced options menu */
+/*==========================*/
+
 #mw-searchoptions {
        margin: 0;
        padding: 0.5em 0.75em 0.75em 0.75em;
        padding-left: 6em;
        font-size: 85%;
 }
+
 #mw-search-interwiki {
        float: right;
        width: 18em;
        border: 1px solid #a2a9b1;
        margin-top: 2ex;
 }
+
 .searchalttitle,
 #mw-search-interwiki li {
        font-size: 95%;
        background-color: #eaecf0;
        border-top: 1px solid #c8ccd1;
 }
+
 .searchdidyoumean {
        font-size: 127%;
        margin-top: 0.8em;