|
|
خط ۲۰: |
خط ۲۰: |
| setTimeout(importScript("مدیاویکی:Gadget-decodesummary.js"), 2000); | | setTimeout(importScript("مدیاویکی:Gadget-decodesummary.js"), 2000); |
| }); | | }); |
| // Adds option to share link to the current page in social networks and email
| |
| if (mw.config.get('wgNamespaceNumber') === 0 || mw.config.get('wgNamespaceNumber') === 6) {
| |
| $(document).ready(function() {
| |
| if (mw.config.get('skin') == 'minerva') { //larger button for mobile veiw
| |
| var socialShares = [{
| |
| 'title': 'تلگرام',
| |
| 'url': 'https://telegram.me/share/url?url=' + wgServer + '/' + encodeURIComponent(wgPageName) + '&text=برگرفته از ویکینور',
| |
| 'img': '//upload.wikimedia.org/wikipedia/commons/thumb/8/82/Telegram_logo.svg/28px-Telegram_logo.svg.png'
| |
| }];
| |
| } else {
| |
| var socialShares = [{
| |
| 'title': 'تلگرام',
| |
| 'url': 'https://telegram.me/share/url?url=' + wgServer + '/' + encodeURIComponent(wgPageName) + '&text=برگرفته از ویکینور',
| |
| 'img': '//upload.wikimedia.org/wikipedia/commons/thumb/8/82/Telegram_logo.svg/17px-Telegram_logo.svg.png'
| |
| }];
| |
| }
| |
|
| |
| try {
| |
|
| |
| var whatLinksItem = $("#mw-content-text");
| |
| if (!whatLinksItem.length) return;
| |
|
| |
| var shareText = $("<span>اشتراک در: </span>");
| |
|
| |
| $(socialShares).each(function() {
| |
| var socialSpan = $("<span></span>");
| |
| var socialA = $('<a></a>', {
| |
| href: this.url,
| |
| title: this.title
| |
| });
| |
| var socialImg = $('<img />', {
| |
| 'src': this.img
| |
| });
| |
| socialA.append(socialImg);
| |
| if (mw.config.get('skin') == 'minerva') {
| |
| socialA.append('<span> </span>');
| |
| }
| |
| socialSpan.append(socialA);
| |
| shareText.append(socialSpan);
| |
| });
| |
|
| |
| var item = $("<li></li>", {
| |
| id: 't-socialShare'
| |
| });
| |
| item.append(shareText);
| |
| whatLinksItem.before(item);
| |
| } catch (e) {
| |
| return;
| |
| }
| |
| });
| |
| mw.util.addCSS("#t-socialShare{position:relative;top:-8px;margin:7px -1px -10px 0px!important;}");
| |
| }
| |
| } | | } |
| }); | | }); |