• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "userscripts". Back to normal view
    1. Tildes User Script: Drag and drop usernames in order to mention them in your comments

      It is was a tedious task to mention users: copy, type, paste. This script makes it a single step: drag and drop any username on to the comment you're composing, and tada! It's there. Here is the...

      It is was a tedious task to mention users: copy, type, paste. This script makes it a single step: drag and drop any username on to the comment you're composing, and tada! It's there.

      Here is the script:

      // ==UserScript==
      // @name     tildesDragNDropUsernameForMention
      // @version  1
      // @grant    none
      // @namespace   tildes.net
      // ==/UserScript==
      
      var userLinks = document.querySelectorAll('a.link-user');
      
      var dragstartHandler = function (event) {
        var text = event.target.innerText;
        if(!text.startsWith('@')){
          text = "@" + text;
        }
        event.dataTransfer.setData("text", text);
        event.dataTransfer.dropEffect = 'copy';
      }
      
      userLinks.forEach(function (each) {
        each.setAttribute('draggable', true);
        each.ondragstart = dragstartHandler;
      });
      

      Patches welcome!

      Edit: remove useless code

      9 votes
    2. UserScript that hides votes like in the recent experiment

      For those who want to prolong the experiment, here is a userscript to help: // ==UserScript== // @name tildes // @version 2 // @grant none // @namespace tildes.net // @include https://tildes.net/*...

      For those who want to prolong the experiment, here is a userscript to help:

      // ==UserScript==
      // @name     tildes
      // @version  2
      // @grant    none
      // @namespace   tildes.net
      // @include     https://tildes.net/*
      // ==/UserScript==
      
      document.querySelectorAll('.is-comment-mine .comment-votes').forEach((v) => v.parentNode.removeChild(v));
      
      ['.btn-post-action[name="vote"]', '.btn-post-action[name="unvote"]'].forEach((sel) =>
        document.querySelectorAll(sel).forEach((b) => b.innerText = b.innerText.replace(/ \(.*/, '')));
      

      I am fairly sure that this syntax requires ES6, so if your browser is not compatible, you need to reimplement this using ES5. Should be straightforward but a bit more verbose.

      20 votes