Permite volver a Taringa V6
当前为
// ==UserScript==
// @name Taringa V6
// @namespace https://greasyfork.org/es/users/205385-xarkox
// @description Permite volver a Taringa V6
// @compatible firefox
// @compatible chrome
// @compatible opera
// @match *://*.taringa.net/*
// @version 1.3.2
// @license GPLv3
// @grant none
// @require https://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
var url_host = window.location.hostname;
var path = window.location.pathname;
var hash = window.location.hash;
var url_shouts = /^\/(global\/)?shouts$/;
var url_juegos = /^\/games$/;
var url_hashtag = /^\/search\/story/;
var url_perfil = /^\/[\w-]+$/;
var url_comunidad = /^\/[+][\w-]+$/;
var url_post_shout = /^\/[+]?[\w-]+\/[\w-]+$/;
function redirect(){
if(path.match(url_shouts)){
window.location.replace("https://classic.taringa.net/shouts");
}
else if(path.match(url_juegos)){
window.location.replace("https://classic.taringa.net/juegos");
}
else if(path.match(url_hashtag)){
window.location.replace("https://classic.taringa.net/hashtag/"+hash.replace("#",""));
}
else if(path.match(url_perfil)){
window.location.replace("https://classic.taringa.net"+path);
}
else if(path.match(url_comunidad)){
var name=path.split("/").pop().replace("+","");
$.get("https://beta.taringa.net/api/c/"+name+"/about", function(data){
if(data.classic === undefined){
window.location.replace("https://classic.taringa.net/posts/"+name);
}
else if(data.classic.type === "community"){
$.get("https://api.taringa.net/community/view/"+data.classic.tid, function(data_classic){
window.location.replace(data_classic.canonical);
});
}
}).fail(function(){
window.location.replace("https://classic.taringa.net/");
});
}
else if(path.match(url_post_shout)){
var id=path.split("/").pop().split("_").pop();
$.get("https://beta.taringa.net/api/story/"+id+"/summary", function(data){
if(data.classic.type === "shout"){
$.get("https://api.taringa.net/shout/view/hash/"+data.classic.tid, function(data_classic){
window.location.replace(data_classic.canonical);
});
}
else if(data.classic.type === "post"){
$.get("https://api.taringa.net/post/view/"+data.classic.tid, function(data_classic){
window.location.replace(data_classic.canonical);
});
}
else if(data.classic.type === "topic"){
$.get("https://api.taringa.net/topic/view/"+data.classic.tid, function(data_classic){
window.location.replace(data_classic.canonical);
});
}
}).fail(function(){
window.location.replace("https://classic.taringa.net/");
});
}
else{
window.location.replace("https://classic.taringa.net/");
}
}
function v6_links_fix(){
$("a[href*='www.taringa.net']").attr("href", function(i, url){
return url.replace("www.taringa.net", "classic.taringa.net");
});
$("form.nav-user__search.buscar").attr("action", "/search/");
$("form[action='/buscar/mi/']").attr("action", "http://classic.taringa.net/buscar/mi/");
$("form[action='/buscar/comunidades/']").attr("action", "http://classic.taringa.net/buscar/comunidades/");
}
function taringa_v6(){
if(url_host === "www.taringa.net"){
redirect();
}
else if(url_host === "classic.taringa.net"){
v6_links_fix();
}
}
$(function() {
taringa_v6();
});