Joubu

hide obs bz

Dec 30th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           hide obs bz
  3. // @author         Jonathan Druart <jonathan.druart@bugs.koha-community.org>
  4. // @namespace      http://bugs.koha-community.org
  5. // @description    Hide obsolete patches on Bugzilla
  6. // @license        the beer-ware license
  7. // @grant          none
  8. // @require        http://code.jquery.com/jquery-1.8.3.min.js
  9. // @include        http://bugs.koha-community.org/*
  10. // ==/UserScript==
  11.  
  12. var comment_nodes = $("div.bz_comment");
  13. $(comment_nodes).each(function(){
  14.     var comment_text_node = $(this).find('pre.bz_comment_text');
  15.     if ( $(comment_text_node).find('span.bz_obsolete').size() > 0 && ! $(comment_text_node).html().match(/^Comment on/) ) {
  16.         var show_link = $('<a onclick=\'$(this).siblings("pre.bz_comment_text").show();$(this).hide()\'>Show content</a>');
  17.         $(this).find('pre.bz_comment_text').hide();
  18.         $(this).append(show_link);
  19.     }
  20. });
Add Comment
Please, Sign In to add comment