Taringa V6

Permite volver a Taringa V6

  1. // ==UserScript==
  2. // @name Taringa V6
  3. // @namespace https://greasyfork.org/es/users/205385-xarkox
  4. // @description Permite volver a Taringa V6
  5. // @compatible firefox
  6. // @compatible chrome
  7. // @compatible opera
  8. // @match *://*.taringa.net/*
  9. // @version 2.0.2
  10. // @license GPLv3
  11. // @grant none
  12. // @require https://code.jquery.com/jquery-3.3.1.min.js
  13. // ==/UserScript==
  14.  
  15. this.$ = this.jQuery = jQuery.noConflict(true);
  16. var url_host = window.location.hostname;
  17. var path = window.location.pathname;
  18. var hash = window.location.hash;
  19. var url_shouts = /^\/(global\/)?shouts$/;
  20. var url_juegos = /^\/games$/;
  21. var url_hashtag = /^\/search\/story/;
  22. var url_perfil = /^\/[\w-]+$/;
  23. var url_comunidad = /^\/[+][\w-]+$/;
  24. var url_post_shout = /^\/[+]?[\w-]+\/[\w-]+$/;
  25.  
  26. function onElementHeightChange(elm, callback){
  27. var lastHeight = elm.clientHeight, newHeight;
  28. (function run(){
  29. newHeight = elm.clientHeight;
  30. if( lastHeight != newHeight )
  31. callback();
  32. lastHeight = newHeight;
  33.  
  34. if( elm.onElementHeightChangeTimer )
  35. clearTimeout(elm.onElementHeightChangeTimer);
  36.  
  37. elm.onElementHeightChangeTimer = setTimeout(run, 200);
  38. })();
  39. }
  40.  
  41. function redirect(){
  42. if(path.match(url_shouts)){
  43. window.location.replace("https://classic.taringa.net/shouts");
  44. }
  45. else if(path.match(url_juegos)){
  46. window.location.replace("https://classic.taringa.net/juegos");
  47. }
  48. else if(path.match(url_hashtag)){
  49. window.location.replace("https://classic.taringa.net/hashtag/"+hash.replace("#",""));
  50. }
  51. else if(path.match(url_perfil)){
  52. window.location.replace("https://classic.taringa.net"+path);
  53. }
  54. else if(path.match(url_comunidad)){
  55. var name=path.split("/").pop().replace("+","");
  56. $.get("https://beta.taringa.net/api/c/"+name+"/about", function(data){
  57. if(data.classic === undefined){
  58. window.location.replace("https://classic.taringa.net/posts/"+name);
  59. }
  60. else if(data.classic.type === "community"){
  61. $.get("https://api.taringa.net/community/view/"+data.classic.tid, function(data_classic){
  62. window.location.replace(data_classic.canonical);
  63. });
  64. }
  65. }).fail(function(){
  66. window.location.replace("https://classic.taringa.net/");
  67. });
  68. }
  69. else if(path.match(url_post_shout)){
  70. var id=path.split("/").pop().split("_").pop();
  71. $.get("https://beta.taringa.net/api/story/"+id+"/summary", function(data){
  72. if(data.classic.type === "shout"){
  73. $.get("https://api.taringa.net/shout/view/hash/"+data.classic.tid, function(data_classic){
  74. window.location.replace(data_classic.canonical);
  75. });
  76. }
  77. else if(data.classic.type === "post"){
  78. $.get("https://api.taringa.net/post/view/"+data.classic.tid, function(data_classic){
  79. window.location.replace(data_classic.canonical);
  80. });
  81. }
  82. else if(data.classic.type === "topic"){
  83. $.get("https://api.taringa.net/topic/view/"+data.classic.tid, function(data_classic){
  84. window.location.replace(data_classic.canonical);
  85. });
  86. }
  87. }).fail(function(){
  88. window.location.replace("https://classic.taringa.net/");
  89. });
  90. }
  91. else{
  92. window.location.replace("https://classic.taringa.net/");
  93. }
  94. }
  95.  
  96. function v6_links_fix(){
  97. $("a[href*='www.taringa.net']").attr("href", function(i, url){
  98. return url.replace("www.taringa.net", "classic.taringa.net");
  99. });
  100. $("form.nav-user__search.buscar").attr("action", "/search/");
  101. $("form[action='/buscar/mi/']").attr("action", "http://classic.taringa.net/buscar/mi/");
  102. $("form[action='/buscar/comunidades/']").attr("action", "http://classic.taringa.net/buscar/comunidades/");
  103. }
  104.  
  105. function v6_gifs_posts(){
  106.  
  107. $("div.main-content-post div.webm-js").each(function(i,obj) {
  108. var gif_url=$(obj).children("video[preload='none']").attr("poster");
  109.  
  110. if(gif_url.includes(".gif")===true){
  111. gif_url=gif_url.split(".cover?",1);
  112.  
  113. $(obj).after("<img class='imagen' src='"+gif_url+"' border='0'>");
  114. $(obj).remove();
  115. }
  116. });
  117. }
  118.  
  119. function gifs_shouts(){
  120.  
  121. $("div.shout-main-content > a > div.webm-js").each(function(i,obj) {
  122. var gif_url=$(obj).children("video[preload='none']").attr("poster");
  123. if(gif_url.includes(".gif")===true){
  124. gif_url=gif_url.split(".cover?",1);
  125.  
  126. $(obj).after("<div class='shout-content--img'><img class='og-img' src='"+gif_url+"' border='0'></div>");
  127. $(obj).remove();
  128. }
  129. });
  130. }
  131.  
  132. function gifs_comentarios(){
  133.  
  134. $("div.comment-content > div.webm-js").each(function(i,obj) {
  135. var gif_url=$(obj).children("video[preload='none']").attr("poster");
  136.  
  137. if(gif_url.includes(".gif")===true){
  138. gif_url=gif_url.split(".cover?",1);
  139.  
  140. $(obj).after("<img class='imagen' src='"+gif_url+"' border='0'>");
  141. $(obj).remove();
  142. }
  143. });
  144. }
  145.  
  146. function v6_gifs_fix(){
  147. gifs_shouts();
  148. gifs_comentarios();
  149.  
  150. onElementHeightChange(document.body, function(){setTimeout(v6_gifs_fix, 1000);});
  151. }
  152.  
  153. function v6_cartel(){
  154. $("div#page > div.v6 > div[style='background: #FC6B00']").remove();
  155. }
  156.  
  157. function taringa_v6(){
  158. if(url_host === "www.taringa.net"){
  159. redirect();
  160. }
  161. else if(url_host === "classic.taringa.net"){
  162. v6_cartel();
  163. v6_links_fix();
  164. v6_gifs_posts();
  165. v6_gifs_fix();
  166. }
  167. }
  168.  
  169. function v6_dead(){
  170. window.location.replace("https://peluchan.ga");
  171. }
  172.  
  173. $(function() {
  174. v6_dead();
  175. });