Расширение:AddThis
![]() | A request to archive this extension has been made on Phabricator. See задача T335463 for the archival request and the rationale for the request, and to leave comments about the request. |
![]() | Автор этого расширения больше не занимается его поддержкой! Хотя оно все еще может работать, любые сообщения об ошибках или запросы на совершенствовании, скорее всего, будут проигнорированы. Если вы заинтересованы в том, чтобы взять на себя задачу разработки и поддержки этого расширения, вы можете запросить право собственности на репозиторий. As a courtesy, you may want to contact the author. Вы также должны будете удалить этот шаблон и указать себя как поддерживающего это расширение в инфобоксе {{extension}}. |
![]() Статус релиза: не поддерживается |
|
---|---|
![]() |
|
Реализация | Тема оформления , Тег |
Описание | No longer functioning since AddThis service has shut. It added an AddThis widget as a portlet to sidebar and displayed an expanded widget as a toolbar in articles. An expanded widget toolbar is also available using <addthis /> tag. |
Автор(ы) | Gregory Varnum (Varnentобсуждение) |
Последняя версия | 1.2.0 (2018-01-07) |
MediaWiki | 1.29+ |
PHP | 5.5+ |
Изменения в БД | Нет |
Лицензия | только GNU General Public License 2.0 |
Скачать | Release notes |
|
|
<addthis /> |
|
Ежеквартальные загрузки | 4 (Ranked 159th) |
Переведите расширение AddThis, если оно доступно на translatewiki.net | |
The AddThis extension adds an AddThis widget to the sidebar and the upper right corner of articles - just below the article's title and the site's tagline. This allows you to have things like Facebook's "Like" or "Recommend" button, a button for Tweeting, Google +'ing, etc. AddThis was a service provided by Oracle until May 2023, and is no longer operating.[1]
Usage
By default, the sidebar is set to appear on all pages.
By default, the toolbar will appear in the header of all articles in a content namespace.
Using the <addthis />
tag, you can:
- Display the toolbar on pages in non-content namespaces
- Display the toolbar when it has been disabled in LocalSettings.php
- Display the toolbar on places other than the page header
Установка
- Скачайте и распакуйте файл(ы) в папку с названием
AddThis
в вашей папкеextensions/
. - Добавьте следующий код в конце вашего файла LocalSettings.php :
wfLoadExtension( 'AddThis' );
- Configure as required.
Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.
Для использующих MediaWiki 1.30 или более ранние версии:
В приведенных выше инструкциях описывается новый способ установки этого расширения с использованием wfLoadExtension()
.
Если вам нужно установить это расширение на более ранние версии (MediaWiki 1.30 и более ранние), вместо wfLoadExtension( 'AddThis' );
, вам необходимо использовать:
require_once "$IP/extensions/AddThis/AddThis.php";
Configuration
You can disable the article header toolbar by adding this to LocalSettings.php :
$wgAddThisHeader = false;
While it does not appear to be required, it is highly recommended that you register an AddThis account and enter your user/profile id number to LocalSettings.php :[2]
$wgAddThispubid = 'ra-xxxxxxxxxxxxxxxxxxx';
Default configuration


Defaults |
---|
$wgAddThispubid = '';
$wgAddThisBackground = '#f6f6f6';
$wgAddThisBorder = '#a7d7f9';
$wgAddThisSidebar = true;
$wgAddThisHeader = true;
$wgAddThisMain = true;
$wgAddThis = [
'addressbarsharing' => false,
];
$wgAddThisSBServ = [
[
'service' => 'compact'
],
[
'service' => 'facebook'
],
[
'service' => 'twitter'
],
[
'service' => 'google_plusone',
'attribs' => 'g:plusone:count="false" style="margin-top:1px;"'
],
[
'service' => 'email'
],
];
$wgAddThisHServ = [
[
'service' => 'facebook'
],
[
'service' => 'twitter'
],
[
'service' => 'google_plusone',
'attribs' => 'g:plusone:count="false" style="margin-top:1px;"'
],
[
'service' => 'linkedin'
],
[
'service' => 'tumblr'
],
[
'service' => 'stumbleupon'
],
[
'service' => 'reddit'
],
[
'service' => 'email'
]
];
|
Configuration parameters
Parameter | Default | Description |
---|---|---|
$wgAddThispubid
|
''
|
AddThis Profile ID - does not appear to be required, but is recommended |
$wgAddThisBackground
|
'#f6f6f6'
|
Background color for AddThis toolbox displayed in article header |
$wgAddThisBorder
|
'#a7d7f9'
|
Border color for AddThis toolbox displayed in article header |
$wgAddThisSidebar
|
true
|
Display AddThis widget as sidebar portlet |
$wgAddThisHeader
|
true
|
Display AddThis widget toolbar in article header |
$wgAddThisMain
|
true
|
Display AddThis widget toolbar on the main page |
$wgAddThis['addressbarsharing']
|
false
|
Enable AddThis Address Bar Sharing |
$wgAddThisSBServ[0]['service']
|
'compact' [3]
|
Service code for 1st button in sidebar |
$wgAddThisSBServ[0]['attribs']
|
''
|
Settings for 1st button in sidebar |
$wgAddThisSBServ[1]['service']
|
'facebook'
|
Service code for 2nd button in sidebar |
$wgAddThisSBServ[1]['attribs']
|
''
|
Settings for 2nd button in sidebar |
$wgAddThisSBServ[2]['service']
|
'twitter'
|
Service code for 3rd button in sidebar |
$wgAddThisSBServ[2]['attribs']
|
''
|
Settings for 3rd button in sidebar |
$wgAddThisSBServ[3]['service']
|
'google_plusone'
|
Service code for 4th button in sidebar |
$wgAddThisSBServ[3]['attribs']
|
'g:plusone:count="false" style="margin-top:1px;"'
|
Settings for 4th button in sidebar |
$wgAddThisSBServ[4]['service']
|
'email'
|
Service code for 5th button in sidebar |
$wgAddThisSBServ[4]['attribs']
|
''
|
Settings for 5th button in sidebar |
$wgAddThisHServ[0]['service']
|
'facebook'
|
Service code for 1st button in article header after AddThis icon (which cannot be moved in the header) |
$wgAddThisHServ[0]['attribs']
|
''
|
Settings for 1st button in article header |
$wgAddThisHServ[1]['service']
|
'twitter'
|
Service code for 2nd button in article header after AddThis icon |
$wgAddThisHServ[1]['attribs']
|
''
|
Settings for 2nd button in article header |
$wgAddThisHServ[2]['service']
|
'google_plusone'
|
Service code for 3rd button in article header after AddThis icon |
$wgAddThisHServ[2]['attribs']
|
'g:plusone:count="false" style="margin-top:1px;"'
|
Settings for 3rd button in article header |
$wgAddThisHServ[3]['service']
|
'linkedin'
|
Service code for 4th button in article header after AddThis icon |
$wgAddThisHServ[3]['attribs']
|
''
|
Settings for 4th button in article header |
$wgAddThisHServ[4]['service']
|
'tumblr'
|
Service code for 5th button in article header after AddThis icon |
$wgAddThisHServ[4]['attribs']
|
''
|
Settings for 5th button in article header |
$wgAddThisHServ[5]['service']
|
'stumbleupon'
|
Service code for 6th button in article header after AddThis icon |
$wgAddThisHServ[5]['attribs']
|
''
|
Settings for 6th button in article header |
$wgAddThisHServ[6]['service']
|
'reddit'
|
Service code for 7th button in article header after AddThis icon |
$wgAddThisHServ[6]['attribs']
|
''
|
Settings for 7th button in article header |
$wgAddThisHServ[7]['service']
|
'email'
|
Service code for 8th button in article header after AddThis icon |
$wgAddThisHServ[7]['attribs']
|
''
|
Settings for 8th button in article header |
- ↑ https://www.addthis.com/
- ↑ Your id is on your settings page
- ↑
'compact'
= AddThis icon used to access full AddThis popup menu
Common service codes
Here are a list of commonly used service codes you can use in the above ['service'] parameters:
|
|
|
Known to not work
- pinterest
- Image, rather than content, oriented and so hard to implement for a wiki
- Will investigate further if there's interest - possibly for displaying just on File pages?
Styling The Buttons
You can change the styling of the buttons using CSS added to MediaWiki:Common.css. An example:
/*increase the size of the buttons to 2em */
span.at-icon-wrapper, svg.at-icon
{
width: 2em!important;
height: 2em!important;
}
If needed, CSS can also be used to hide the entire widget for specific users (see Manual:$wgAllowUserCss), skins or platforms (MediaWiki:Mobile.css).
#addthistoolbar { display: none; }
Development
Release notes
- 1.1.1
- 1.0.1
- Support for AddThis Address Bar Sharing
- Additional code clean-up
- Switched from reddit as a preferred service to digg
- Will not be making these often as wikis should set their own preferred services - but we will make tweaks based on AddThis service trends and your feedback
- 1.0
- Stable release
- 1.0f
- Moved to Wikimedia Subversion server
- Switched to using arrays per feedback - ty Johnduhart!
- Numerous code cleanup and enhancements by Johnduhart - again, thank you!
- 1.0e
- Setting ($wgAddThisMain) to disable appearance on main page (default is set to display on main page)
- Cleaned up code and moved closer to matching MW's coding conventions
- 1.0d
- Addition of tag (<AddThis />) for displaying article header toolbar widget on page outside of the main article namespace or for use on wikis with the header toolbar otherwise disabled
- Improved localization - toolbar now uses language file as well
- 1.0c
- Enable/disable settings for both the sidebar ($wgAddThisSidebar) and article header toolbar ($wgAddThisHeader) widgets
- 1.0b
- Use of ResourceLoader for css rather than loading within extension - fixes bug reported on MW1.18
- Addition of Russian language to language file - thank you Unikum111!
- 1.0a
- Initial release
Planned features
- Pinterest "Pin-it" button on file pages
- Your requests and ideas are welcome
Wish list
- Your requests and ideas are welcome.
- Ability to disallow the extension on certain pages (for example it's not needed on templates and other housekeeping pages). <<--- Yes to this please.
- Ability to move the header box anywhere on the page with CSS, preferably to be on the RHS across from the Page Title.
- Option to load on click as I don't want my users to get watched all the time (just in case they really want to and wish to share something). Example here.
- Ability to control which namespaces contain or do not contain the extension, or to default to all namespaces if desired.
- Load JavaScript for AddThis asynchronously. Adding the
async
attribute will help wikipages to load faster by loading the JavaScript at the same time as the page content, instead of delaying the page load until after the JavaScript is loaded.<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script>
- should instead be
<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js" async="async"></script>
Ideas being considered
Time will be spent on these if folks show interest on the wish list or talk page
- Setting to change default namespaces to display page header toolbar on
- Setting via LocalSetting.php and tag to change toolbar display from the right side to the left
Requests by developer
- Add any wishes to wish list or request on talk page
- Please test on wikis and report back via talk page
- Requires at least MW1.17 due to use of ResourceLoader
- Suggestions from developers are especially welcome! Contributions included will be credited as co-authors
- Language translations will be credited
See also
- Unmaintained extensions/ru
- Skin extensions/ru
- Tag extensions/ru
- GPL licensed extensions/ru
- Extensions in Wikimedia version control/ru
- ArticleViewHeader extensions/ru
- ParserFirstCallInit extensions/ru
- SkinBuildSidebar extensions/ru
- All extensions/ru
- Social bookmarking extensions/ru
- Del.icio.us extensions/ru
- Facebook extensions/ru
- Google extensions/ru
- Reddit extensions/ru
- Twitter extensions/ru
- Yahoo extensions/ru
- Menu bar extensions/ru
- StumbleUpon extensions/ru