Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

r2t.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. function FS_dec(fn) {
  2. return function() {
  3. dec_fns[fn.name] && dec_fns[fn.name].pre ? dec_fns[fn.name].pre({that:this, arguments}) : 1
  4. const ret = fn.apply(this, arguments);
  5. // console.log('FSD',fn.name,ret, [this,...arguments]);
  6. const ret2 = dec_fns[fn.name] && dec_fns[fn.name].post ? dec_fns[fn.name].post({that:this, arguments}) : 0
  7. if (ret2){
  8. return ret2.ret
  9. }
  10. // const result = fn.apply(this, arguments);
  11. // console.log('Finished');
  12. return ret;
  13. }
  14. }
  15. function save_orig(){
  16. console.trace("SAVE-ORIG")
  17. glob_orig = window.glob_orig || {
  18. Filmstrip:{},
  19. fs:{},
  20. rf_filmstrip:{},
  21. }
  22. glob_orig.Filmstrip = Object.assign({},glob_react.Filmstrip)
  23. glob_orig.fs = Object.assign({},glob_react.fs)
  24. glob_orig.rf_filmstrip = Object.assign({},glob_react.rf_filmstrip)
  25. save_orig = nop
  26. }
  27. if (window.glob_orig){
  28. save_orig = nop
  29. // save_orig()
  30. }
  31. if (!window.glob_orig && window.glob_react){
  32. // save_orig = nop
  33. save_orig()
  34. }
  35. if (window.glob_orig && window.glob_react){
  36. dec_fs()
  37. // save_orig = nop
  38. // save_orig()
  39. }
  40. // if ((!window.glob_orig) && ){
  41. // }
  42. // glob_react.rf_filmstrip.calculateThumbnailSizeForTileView
  43. // calculateThumbnailSizeForTileView
  44. dec_fns = {
  45. resizeThumbnailsForTileView:{
  46. pre:function(){
  47. // console.trace("resizeThumbnailsForTileView")
  48. },
  49. post:function(){
  50. },
  51. }
  52. }
  53. function rt(w,h = 0,force = true){
  54. h ? 0 : h = w / (16/9)
  55. glob_react.Filmstrip.resizeThumbnailsForTileView(w,h,force)
  56. }
  57. function dec_fs2(){
  58. var k,v
  59. glob_react.rf_filmstrip.calculateThumbnailSizeForTileView = FS_dec(glob_react.rf_filmstrip.calculateThumbnailSizeForTileView)
  60. // for ([k,v] of Object.entries(glob_orig.Filmstrip)){
  61. // for ([k,v] of Object.entries(glob_react.Filmstrip)){
  62. // clog("~",k,v.name)
  63. // glob_react.Filmstrip[k] = FS_dec(v)
  64. // }
  65. }
  66. function dec_fs(){
  67. var k,v
  68. for ([k,v] of Object.entries(glob_orig.Filmstrip)){
  69. // for ([k,v] of Object.entries(glob_react.Filmstrip)){
  70. clog("~",k,v.name)
  71. glob_react.Filmstrip[k] = FS_dec(v)
  72. }
  73. }
  74. fs_dec_list = ["resizeThumbnailsForHorizontalView",
  75. "resizeThumbnailsForVerticalView",
  76. "resizeThumbnailsForTileView",]
  77. function dec_fs_resize(){
  78. var k,v
  79. save_orig()
  80. for (k of fs_dec_list){
  81. clog("~",k)
  82. }
  83. // return
  84. for ([k,v] of Object.entries(glob_orig.Filmstrip)){
  85. // for ([k,v] of Object.entries(glob_react.Filmstrip)){
  86. clog("~",k,v.name,v)
  87. // glob_react.Filmstrip[k] = FS_dec(v)
  88. }
  89. }
  90. modkeys = ["calculateThumbnailSizeForTileView",
  91. "TILE_VIEW_SIDE_MARGINS",
  92. "SET_TILE_VIEW_DIMENSIONS",]
  93. // glob_react.rf_filmstrip
  94. function check_mod_keys(){
  95. var k
  96. for (k of modkeys){
  97. clog(k,glob_react.rf_filmstrip[k])
  98. }
  99. }