Blue-eagle

T.net custom JS

Oct 25th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name       Fix T.net 7
  3. // @namespace  http://mobdb.com/
  4. // @version    0.1
  5. // @description  Tweakers things on Tweakers.net's latest restyle.
  6. // @match      http://*tweakers.net/*
  7. // @copyright  2012+, Blue-eagle
  8. // @require    http://code.jquery.com/jquery-1.8.2.min.js
  9. // ==/UserScript==
  10.  
  11. var i = 0;
  12. var link = "";
  13.  
  14. $("#highlights table.highlights tbody tr").each(function() {
  15.     link = $(this).find("a:first").attr("href");
  16.     $(this).after("<tr><td class='custom_intro' colspan='3' id='custom_intro_"+ i +"'></td></tr>");
  17.     $("#custom_intro_" + i).load(link + " div.article p.lead");
  18.     i += 1;
  19. });
  20.  
  21. $("div.reactieHeader").append("<a href='javascript:void(0);' class='minmaxreacties'><span class='mm_ind'>-</span><span class='mm_ind' style='display:none;'>+</span></a>").find("a.minmaxreacties").bind("click", function() {
  22.     $(this).parent().parent().parent().parent().find(".reactie").toggle();
  23.     $(this).parent().parent().find(".reactieContent, .scoreButton, .reactieFooter").toggle();
  24.     $(this).find('.mm_ind').toggle();
  25. });
  26.  
  27. var displaceFPItems = [
  28.     { iconClass: "video", fpItemID: "videos", link: "/video/", title: "Video's" },
  29.     { iconClass: "review", fpItemID: "reviews", link: "/reviews/", title: "Reviews" },
  30.     { iconClass: "download", fpItemID: "downloads", link: "/meuktracker/", title: "Downloads" },
  31.     { iconClass: "plan", fpItemID: "plans", link: "/plan/", title: ".plans" }
  32. ];
  33.  
  34. for(var i = 0; i != displaceFPItems.length; i++) {
  35.     var obj = displaceFPItems[i];
  36.     $("<div class='fpItem customFPitem' id='new_"+ obj.fpItemID +"' style='display: none;'><h2><a href='"+ obj.link +"'>"+ obj.title +"</a></h2><ul class='highlights'></ul></div>").insertBefore($("#b_re"));
  37.     $("tr:has(span."+ obj.iconClass +")").each(function() {
  38.         var theLink = $(this).find("td.link a");
  39.         $(theLink).appendTo($("#new_"+ obj.fpItemID +" ul"));
  40.         $(this).remove();
  41.     });
  42.     $("#new_"+ obj.fpItemID +" ul a").wrap("<li />");
  43.     $("#new_"+ obj.fpItemID +" ul li:gt(4)").remove();
  44.     if($("#new_"+ obj.fpItemID +" ul li").length > 0) {
  45.         $("#new_"+ obj.fpItemID).show();
  46.     }
  47. }
  48.  
  49. $('<span class="sprite contentIcon news">Community</span>').insertBefore($("#community li a.thumb"));
Advertisement
Add Comment
Please, Sign In to add comment