Greasy Fork 还支持 简体中文。

WordPress - Sort My Favorites

Sort WordPress favorites alphabetically.

目前為 2015-08-28 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name WordPress - Sort My Favorites
  3. // @version 0.1
  4. // @author Tim Berneman
  5. // @copyright Tim Berneman (c) 2015
  6. // @namespace wordpress_sort_my_favorites
  7. // @description Sort WordPress favorites alphabetically.
  8. // @include /https?:\/\/profiles\.wordpress\.org\/(.*)#content-favorites\/?/
  9. // @include https://wordpress.org/plugins/browse/favorites/
  10. // @grant none
  11. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.js
  12. // @run-at document-end
  13. //
  14. // License: http://creativecommons.org/licenses/by-nc-sa/3.0/
  15. //
  16. // CHANGELOG:
  17. // v0.1 - initial release
  18. //
  19. // ==/UserScript==
  20.  
  21. $(document).ready(function() {
  22. // For profiles.wordpress.org/username#content-favorites
  23. var sorted = $.makeArray($('#content-favorites .favorite-plugins ul li')).sort(function(a,b){
  24. return ( $(a).children('h3').text().trim() < $(b).children('h3').text().trim() ) ? -1 : 1;
  25. });
  26. $('#content-favorites .favorite-plugins ul').html(sorted);
  27. // For wordpress.org/plugins/browse/favorites/
  28. /* STILL WORKING ON THIS! Uses div's and not li's and thus perplexing me. If you tweak it and get it working (before I figure it out) let me know, I will credit you. :)
  29. var sorted = $.makeArray($('div.plugin-group .plugin-card .plugin-card-top .column-name')).sort(function(a,b){
  30. console.log( $(a).children('h4').text().trim() );
  31. return ( $(a).children('h4').text().trim() < $(b).children('h4').text().trim() ) ? -1 : 1;
  32. });
  33. $('div.plugin-group .plugin-card .plugin-card-top').html(sorted);
  34. */
  35. });