Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. // ==UserScript==
  2. // @name mal_extra
  3. // @description extra functions for MAL scripts
  4. // @version 1.2.2
  5. // @author akarin
  6. // ==/UserScript==
  7.  
  8. function Fancybox(prefix) {
  9. this.body = $('<div id="' + prefix + '_fancybox_inner"></div>');
  10. this.outer = $('<div id="' + prefix + '_fancybox_outer"></div>');
  11. this.wrapper = $('<div id="' + prefix + '_fancybox_wrapper"></div>');
  12.  
  13. this.init = function(el) {
  14. this.outer.hide().append(this.body).insertAfter(el);
  15. this.wrapper.hide().click(this.close).insertAfter(el);
  16. };
  17.  
  18. this.start = function(onstart) {
  19. this.body.children().hide();
  20. if (onstart()) {
  21. this.wrapper.show();
  22. this.outer.show();
  23. }
  24. else {
  25. this.close();
  26. }
  27. };
  28.  
  29. this.close = function() {
  30. this.outer.hide();
  31. this.wrapper.hide();
  32. };
  33. }
  34.  
  35. String.prototype.formatJapTitle = function() {
  36. return this
  37. .replace(/\s+/g, ' ')
  38. .replace(/[\uff01-\uff5e]/g, function(ch) { return String.fromCharCode(ch.charCodeAt(0) - 0xfee0); })
  39. .replace(/\s?,\s?/g, '、')
  40. .replace(/\s?\+\s?/g, '+')
  41. .replace(/\s?=\s?/g, '=')
  42. .replace(/[“”]/g, '"')
  43. .replace(/\s?-\s?/g, '-')
  44. .replace(/\s?:\s?/g, ':').replace(/(\d):(\d)/g, '$1:$2')
  45. .replace(/\s?[\(〈]/g, '(').replace(/[\)〉]\s?/g, ')')
  46. .replace(/\s?[\[【]/g, '[').replace(/[\]】]\s?/g, ']')
  47. .replace(/\s?『/g, '「').replace(/』\s?/g, '」')
  48. .replace(/\//g, '/').replace(////g, '//').replace(/\s?/\s?/g, '/')
  49. .replace(/[\.。]/g, '.').replace(/\s?.\s?/g, '.')
  50. .replace(/;/g, ';').replace(/\s?;\s?/g, ';')
  51. .replace(/["“”]/g, '"').replace(/\s?"\s?/g, '"')
  52. .replace(/[.・]{3}/g, '…').replace(/^./g, '.')
  53. .replace(/([^\w])./g, '$1。').replace(/(\d).(\d)/g, '$1.$2')
  54. .replace(/!/g, '!').replace(/\s?!\s?/g, '!')
  55. .replace(/\?/g, '?').replace(/\s??\s?/g, '?')
  56. .replace(/[~〜]/g, '~').replace(/\s?~\s?/g, '~')
  57. .replace(/([^\w]|[\sA-Z])x([^\w]|[\sA-Z])/g, '$1 × $2')
  58. .replace(/\s?×\s?/g, ' × ').replace(/\s?x\s?/g, ' × ');
  59. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement