Greasy Fork is available in English.

WatchSeries Host List Sorter

Sorts the host list on watchseries alphabetically

Version au 02/10/2015. Voir la dernière version.

  1. // ==UserScript==
  2. // @name WatchSeries Host List Sorter
  3. // @namespace dannieboi
  4. // @version 0.2
  5. // @description Sorts the host list on watchseries alphabetically
  6. // @author dannieboi
  7. // @match http://watchseries.ag/episode/*.html
  8. // @match http://watchseries.vc/episode/*.html
  9. // @match http://watchseries.se/episode/*.html
  10. // @grant none
  11. // @require https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js
  12. // ==/UserScript==
  13.  
  14. $("select.kwd_search").each(function(){
  15. var $select = $(this);
  16.  
  17. var $selectOptions = $select.find("option");
  18.  
  19.  
  20. var optionValues = _.map($selectOptions.get(), function(x){
  21. return { text: x.innerText, value: x.value };
  22. });
  23.  
  24. var sortedOptionValues = _.sortBy(optionValues, "text");
  25.  
  26. $selectOptions.remove();
  27.  
  28. optionTemplate = _.template("<option value='<%= value %>'><%= text %></option>");
  29.  
  30. _.forEach(sortedOptionValues, function(x){
  31. $select.append(optionTemplate(x));
  32. });
  33. });