Can't <del>like</del>upvote streamed in posts



  • When I try I get this:

    0_1462808817555_upload-72e4f12a-69d1-48b8-9ce2-82322acad0b6


  • Discourse touched me in a no-no place

    No Repro.
    Is that raw button doing something that messes with it maybe?



  • @loopback0 Shouldn't be. Here's the script for the raw button:

    // ==UserScript==
    // @name         View Raw Button
    // @match        https://what.thedailywtf.com/*
    // @grant        none
    // ==/UserScript==
    'use strict';
    
    // Define the base string for the View Raw button
    var viewRawButton = '<a class="viewRaw no-select" component="post/view-raw" href="#"><i class="fa fa-code"/> View Raw</a>';
    
    // append the a.viewRaw and prew.raw classes to the page
    $('<style type="text/css">a.viewRaw { background-color: #337ab7; color: white; padding: 10px; margin-right: 3px; } pre.raw { white-space: pre-wrap; word-wrap: break-word; }</style>').appendTo('head');
    
    // Load the button into the DOM
    $(window).on('action:posts.loaded', function(){
        $('.post-tools:not(:has(a.viewRaw))').prepend(viewRawButton);
    });
    $('.post-tools:not(:has(a.viewRaw))').prepend(viewRawButton);
    $(document).on('click', '.viewRaw', showRaw);
    
    
    function showRaw() {
        // Get the acting raw button, the corresponding post, and the post id
        var viewButton = $(this);
        var post = viewButton.closest('li[component=post]');
        var pid = post.data('pid');
        
        // Get the div containing the baked post content
        var contentDiv = post.find('div[component="post/content"]');
        
        // Check if the baked content is visible
        if (contentDiv.css('display') == 'none')
        {
            // Show baked content
            contentDiv.css('display', 'block');
            
            // Remove the raw content, if it exists
            var rawDiv = post.find('div[component="post/raw"]');
            if (rawDiv.length) { rawDiv.remove(); }
        }
        else
        {
            // Hide the baked content
            contentDiv.css('display', 'none');
            
            // Retrieve and display the raw post
            socket.emit('posts.getRawPost', pid, function(err,rawContent) {
                // Notify on error
                if (err) {
                    if (console && console.error) {
                        console.error(err);
                    }
                    else {
                        alert(err);
                    }
                }
            
                // Build a div for the raw content
                rawContent = $('<pre class="raw"></pre>').text(rawContent);
                rawContent = $('<div class="content" component="post/raw" itemprop="text"></div>').html(rawContent);
                
                contentDiv.before(rawContent);
            });
        }
    }
    

Log in to reply