Answers.com, no slideshow please!

Replaces the annoying slideshows on Answer.com questions with a simple card.

  1. // ==UserScript==
  2. // @name Answers.com, no slideshow please!
  3. // @namespace http://dieterholvoet.com
  4. // @version 1.0
  5. // @description Replaces the annoying slideshows on Answer.com questions with a simple card.
  6. // @author Dieter Holvoet
  7. // @match www.answers.com/Q/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // HELPER
  16. String.prototype.capitalizeFirstLetter = function() {
  17. return this.charAt(0).toUpperCase() + this.slice(1);
  18. };
  19.  
  20. // Variables
  21. var $container = $('<div class="module feedcards_wikilite"></div>'),
  22. $slideshow = $("#center_top > .question_slideshow .article_slides.current_article"),
  23. $slides = $slideshow.find(".slide");
  24.  
  25. // Get content
  26. var title = $slideshow.find(".question_detail").data("title"),
  27. content = "";
  28.  
  29. $slides.each(function() {
  30. var find = ["click on the link", "see answer"],
  31. text = $(this).text().trim();
  32.  
  33. if(!find.some(function(v) {return text.toLowerCase().indexOf(v) >= 0;}))
  34. content += text+" ";
  35. });
  36.  
  37. // Append new card
  38. $container.insertAfter("#center_top .breadcrumb_category");
  39. $container.append('<div class="feedcard no_image no_avatar" asg-card="gutenberg"><article class="frame"><section class="content"><h1 class="title">'+title+'</h1><div class="content_text" style="line-height: 1.6;">'+content.trim().capitalizeFirstLetter()+'</div></section></article></div>');
  40.  
  41. // Remove slideshow
  42. $("#center_top .question_slideshow").remove();
  43. })();