Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Behind the Scenes
  3. Qt.io webservices
  4. Per-thread "Mark as read" button
Qt 6.11 is out! See what's new in the release blog

Per-thread "Mark as read" button

Scheduled Pinned Locked Moved Qt.io webservices
12 Posts 5 Posters 6.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dangelog
    wrote on last edited by
    #1

    The title says it all: turn you Greasemonkey on and give this a try. Your search experience will improve by 0.012%.

    (Copy and paste the script in a local foobar.user.js file, then open it with Firefox -- Greasemonkey will install it).

    Any HELP is appreciated! Feedbacks are welcome too :)

    http://pastebin.com/icBP3DxB

    (I'm not putting the code here because the forum software breaks due to the "@" symbols inside ... :( )

    Software Engineer
    KDAB (UK) Ltd., a KDAB Group company

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Here we go :-)

      @
      // ==UserScript==
      // @name Qt Developer Network - Mark Thread As Read
      // @namespace developer.qt.nokia.com/markasread
      // @description Adds a button to mark posts as read without having to open them.
      // @match http://developer.qt.nokia.com/forums/search_results/*
      // @match https://developer.qt.nokia.com/forums/search_results/*
      // @version 0.11
      // ==/UserScript==

      $ = unsafeWindow.jQuery;

      $('.forum_main_wrap').each(function(i) {
      var row = $(this);
      var threadUrl = $('a', row).attr('href');

      var button = $('<button>Mark as read</button>')
                    .addClass('jqueryui-button')
                    .css('white-space', 'nowrap');
      
      var buttonDiv = $('<div></div>')
                       .addClass('forum_main_right mark_as_read')
                       .append(button)
                       .hide();
                       
      button.click(function() {
          $(this).attr('disabled', 'disabled');
          $.ajax({
              url: threadUrl,
              cache: false,
              success: function(html) {
                  row.fadeOut('fast');
              }
          });
      });
      
      row.mouseenter(function() { buttonDiv.fadeIn('fast'); });
      row.mouseleave(function() { buttonDiv.fadeOut('fast'); });
      
      $('.forum_main_body', row).before(buttonDiv);
      

      });
      @

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #3

        Well, thanks for the tip :) Now I know that I have to HTML-escape them :)

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          Here you go with a bit advanced version:

          @
          // ==UserScript==
          // @name Qt Developer Network - Mark Thread As Read
          // @namespace developer.qt.nokia.com/markasread
          // @description Adds a button to mark posts as read without having to open them.
          // @match http://developer.qt.nokia.com/forums/search_results/*
          // @match https://developer.qt.nokia.com/forums/search_results/*
          // @version 0.12
          // ==/UserScript==

          $ = unsafeWindow.jQuery;

          $('.forum_main_wrap').each(function(i) {
          var row = $(this);
          var threadUrl = $('a', row).attr('href');
          var cssObj = {
          'padding' : '4px 8px!important',
          '-moz-border-radius' : '5px 5px 5px 5px',
          'border-radius' : '5px 5px 5px 5px',
          'white-space' : 'nowrap',
          // 'margin-bottom' : '10px',
          // 'padding' : '3px 4px'
          'padding' : '1px 1px'
          }

          var button = $('<button>Mark as read</button>')
                        .css(cssObj);
          
          var buttonDiv = $('<div></div>')
                           .addClass('forum_main_right mark_as_read')
                           .append(button)
                           .hide();
                           
          button.click(function() {
              $(this).attr('disabled', 'disabled');
              $.ajax({
                  url: threadUrl,
                  cache: false,
                  success: function(html) {
                      row.fadeOut('fast');
                  }
              });
          });
          
          row.mouseenter(function() { buttonDiv.fadeIn('fast'); });
          row.mouseleave(function() { buttonDiv.fadeOut('fast'); });
          
          $('.forum_main_body', row).before(buttonDiv);
          

          });
          @

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dangelog
            wrote on last edited by
            #5

            Updated version for the 19 Jan 2012 upgrade that broke the button's style
            @
            // ==UserScript==
            // @name Qt Developer Network - Mark Thread As Read
            // @namespace developer.qt.nokia.com/markasread
            // @description Adds a button to mark posts as read without having to open them.
            // @match http://developer.qt.nokia.com/forums/search_results/*
            // @match https://developer.qt.nokia.com/forums/search_results/*
            // @version 0.13
            // ==/UserScript==

            $ = unsafeWindow.jQuery;

            $('.forum_main_wrap').each(function(i) {
            var row = $(this);
            var threadUrl = $('a', row).attr('href');
            var cssObj = {
            'padding' : '4px 8px!important',
            '-moz-border-radius' : '5px 5px 5px 5px',
            'border-radius' : '5px 5px 5px 5px',
            'white-space' : 'nowrap',
            // 'margin-bottom' : '10px',
            // 'padding' : '3px 4px'
            'padding' : '1px 1px'
            }

            var button = $('<button>Mark as read</button>')
                          .css(cssObj)
                          .addClass('qtcdk button');
            
            var buttonDiv = $('<div></div>')
                             .addClass('forum_main_right')
                             .append(button)
                             .hide();
                              
            button.click(function() {
                $(this).attr('disabled', 'disabled');
                $.ajax({
                    url: threadUrl,
                    cache: false,
                    success: function(html) {
                        row.fadeOut('fast');
                    }
                });
            });
            
            row.mouseenter(function() { buttonDiv.fadeIn('fast'); });
            row.mouseleave(function() { buttonDiv.fadeOut('fast'); });
             
            $('.forum_main_body', row).before(buttonDiv);
            

            });
            @

            Software Engineer
            KDAB (UK) Ltd., a KDAB Group company

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dangelog
              wrote on last edited by
              #6

              @
              // ==UserScript==
              // @name Qt Developer Network - Mark Thread As Read
              // @namespace developer.qt.nokia.com/markasread
              // @description Adds a button to mark posts as read without having to open them.
              // @match http://qt-project.org/forums/search_results/*
              // @match https://qt-project.org/forums/search_results/*
              // @match http://qt-project.org/forums/viewforum/*
              // @match https://qt-project.org/forums/viewforum/*
              // @version 0.14
              // ==/UserScript==

              $ = unsafeWindow.jQuery;

              $('.forum_main_wrap').each(function(i) {
              var row = $(this);
              var threadUrl = $('a', row).attr('href');
              var cssObj = {
              'padding' : '4px 8px!important',
              '-moz-border-radius' : '5px 5px 5px 5px',
              'border-radius' : '5px 5px 5px 5px',
              'white-space' : 'nowrap',
              // 'margin-bottom' : '10px',
              // 'padding' : '3px 4px'
              'padding' : '1px 1px'
              }

              var button = $('<button>Mark as read</button>')
                            .css(cssObj)
                            .addClass('qtcdk button');
              
              var buttonDiv = $('<div></div>')
                               .addClass('forum_main_right')
                               .append(button)
                               .hide();
                                
              button.click(function() {
                  $(this).attr('disabled', 'disabled');
                  $.ajax({
                      url: threadUrl,
                      cache: false,
                      success: function(html) {
                          row.fadeOut('fast');
                      }
                  });
              });
              
              row.mouseenter(function() { buttonDiv.fadeIn('fast'); });
              row.mouseleave(function() { buttonDiv.fadeOut('fast'); });
               
              $('.forum_main_body', row).before(buttonDiv);
              

              });
              @

              Software Engineer
              KDAB (UK) Ltd., a KDAB Group company

              1 Reply Last reply
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #7

                Thank you peppe for the script.

                The first post refers to FireFox. However, it is also usable with Chrome (tested on windows).
                Check for GreaseMonkey on addon page. You will not find GreaseMonkey, but a substitute called TamperMonkey. You may basically copy the script as provided here in there. The only "challenge" are the 'at' signs. They are visible here, are hex codes when you copy the script code. Use the editor and replace them with 'at' signs.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  It works quite well on FF, I'm impressed!
                  Thanks a bunch, it solves one of the issues I "posted":/forums/viewthread/15920 earlier today.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dangelog
                    wrote on last edited by
                    #9

                    New version... I promise I'll put it somewhere so that GM can update it automatically. :-)

                    @
                    // ==UserScript==
                    // @name Qt Developer Network - Mark Thread As Read
                    // @namespace developer.qt.nokia.com/markasread
                    // @description Adds a button to mark posts as read without having to open them.
                    // @match http://qt-project.org/forums/search_results/*
                    // @match https://qt-project.org/forums/search_results/*
                    // @match http://qt-project.org/forums/viewforum/*
                    // @match https://qt-project.org/forums/viewforum/*
                    // @version 0.15
                    // ==/UserScript==

                    $ = unsafeWindow.jQuery;

                    $('.forum_main_wrap').each(function(i) {
                    var row = $(this);
                    var threadUrl = $('a', row).attr('href');
                    var cssObj = {
                    'padding' : '4px 8px!important',
                    '-moz-border-radius' : '5px 5px 5px 5px',
                    'border-radius' : '5px 5px 5px 5px',
                    'white-space' : 'nowrap',
                    // 'margin-bottom' : '10px',
                    // 'padding' : '3px 4px'
                    'padding' : '1px 1px',
                    'position': 'absolute'
                    }

                    var button = $('<button>Mark as read</button>')
                                  .css(cssObj)
                                  .addClass('qtcdk button');
                    
                    var buttonDiv = $('<div></div>')
                                     .addClass('forum_main_right')
                                     .css('position', 'relative')
                                     .append(button)
                                     .hide();
                                      
                    button.click(function() {
                        $(this).attr('disabled', 'disabled');
                        $.ajax({
                            url: threadUrl,
                            cache: false,
                            success: function(html) {
                                row.fadeOut('fast');
                            }
                        });
                    });
                    
                    row.mouseenter(function() { buttonDiv.fadeIn('fast'); });
                    row.mouseleave(function() { buttonDiv.fadeOut('fast'); });
                     
                    $('.forum_main_body', row).before(buttonDiv);
                    

                    });
                    @

                    Software Engineer
                    KDAB (UK) Ltd., a KDAB Group company

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #10

                      Change is that now the rows don't change height as often any more, making the DevNet a bit easier on the eyes again. Thanks a bunch!

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        dangelog
                        wrote on last edited by
                        #11

                        [quote author="koahnig" date="1333121898"]Thank you peppe for the script.

                        The first post refers to FireFox. However, it is also usable with Chrome (tested on windows).
                        Check for GreaseMonkey on addon page. You will not find GreaseMonkey, but a substitute called TamperMonkey. You may basically copy the script as provided here in there. The only "challenge" are the 'at' signs. They are visible here, are hex codes when you copy the script code. Use the editor and replace them with 'at' signs. [/quote]

                        Yes, that's the downside of the textile markup... However, I think you can just copy and paste from the forum directly? It seems to work for me here (Firefox 11).

                        Software Engineer
                        KDAB (UK) Ltd., a KDAB Group company

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          goetz
                          wrote on last edited by
                          #12

                          I've just released a chrome extension with this and some more functionality to the google webstore. See the "announcement here":/forums/viewthread/16100.

                          http://www.catb.org/~esr/faqs/smart-questions.html

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved