// ==UserScript== // @name WPorg-Dev // @namespace wordpress // @description A userscript to help developers access certain pages a lot easier. // @include https://wordpress.org/plugins/* // @include https://wordpress.org/support/plugin/* // @include https://wordpress.org/support/view/plugin-reviews/* // @version 1.0 // @copyright 2015 Armando Lüscher // @author Armando Lüscher // @oujs:author noplanman // @grant GM_addStyle // @require https://code.jquery.com/jquery-1.11.3.min.js // @homepageURL https://github.com/noplanman/WPorg-Dev-Userscript // @supportURL https://github.com/noplanman/WPorg-Dev-Userscript/issues // @downloadURL none // ==/UserScript== // The base URL of the WordPress plugins pages. var pluginsBaseURL = 'https://wordpress.org/plugins/'; var wodu = {}; /** * Extract the plugin slug from a URL. * @param {string} url URL to extract the plugin slug from. * @return {string} The extracted plugin slug. */ wodu.getSlug = function(url) { var p = url.indexOf('wordpress.org/plugins/'); if (p >= 0) { return url.substring(p + 'wordpress.org/plugins/'.length).split('/')[0]; } p = url.indexOf('wordpress.org/support'); if (p >= 0) { url = url.replace(/\/+$/, '').split('/'); return url[url.length-1]; } return ''; }; /** * Generate the failed message and the retry button. * * @param {jQuery} $el The error message panel gets appended to this jQuery object. * @param {Function} cb Callback function when clicking the "Retry" button. * @return {jQuery} The jQuery object containing the message and button. */ wodu.getFailedRetryButton = function($el, cb) { $el.removeClass('wodu-loaded'); return $('
Failed.
') .append($('
Retry
').click(cb)) .appendTo($el); }; /** * Generate a dropdown menu with all the downloadable versions. * * The dropdown also has the functionality, that when the selected value changes, the download of it begins. * * @param {jQuery} $devPage The page containing the links. * @return {jQuery} Dropdown menu with all the links. */ wodu.getDLLinkDropdown = function($devPage) { var $select = $('