User:Withersoul 235/common.js

// Attempt to create a button that unfollows a page. Uses part of the source code of Algorithmz's and KockaAdmiralac's FollowDropdown.

$(function {   var $list = $('.page-header__contribution-buttons .wds-list');    if(!$list.exists) {        return;    }    var config = mw.config.get([ 'wgPageName', 'wgUserLanguage' ]);   mw.loader.using('mediawiki.api', function { new mw.Api.get({           action: 'query',            meta: 'allmessages',            ammessages: 'unwatch',            amlang: config.wgUserLanguage        }).done(function(d) {            $list.append( $('') .append(                       $('')                            .attr('href', '/wiki/' + config.wgPageName + '?action=unwatch')                            .text(d.query.allmessages[0]['*'])                    ) );       });    }); });