Raw Source
Mrprocom / Web IRC Format Shortcuts

// ==UserScript==
// @name        Web IRC Format Shortcuts
// @namespace   http://mrprocom.github.io
// @description Adds shortcuts to format messages sent from QwebIRC or KiwiIRC
// @author      Mrprocom
// @downloadURL https://openuserjs.org/install/Mrprocom/Web_IRC_Format_Shortcuts
// @require     http://www.openjs.com/scripts/events/keyboard_shortcuts/shortcut.js
// @include     https://webchat.freenode.net/*
// @include     http://webchat.quakenet.org/*
// @include     https://qchat.rizon.net/*
// @include     https://webchat.gamesurge.net/*
// @include     https://kiwiirc.com/client*
// @version     1.2
// @license     MIT
// @grant       none
// ==/UserScript==

shortcut.add("Ctrl+B", function(){
  if(document.querySelector("input:focus")){
    document.querySelector("input:focus").value += "\002";
  }
});

shortcut.add("Ctrl+K", function(){
  if(document.querySelector("input:focus")){
    document.querySelector("input:focus").value += "\003";
  }
});

shortcut.add("Ctrl+O", function(){
  if(document.querySelector("input:focus")){
    document.querySelector("input:focus").value += "\017";
  }
});

shortcut.add("Ctrl+R", function(){
  if(document.querySelector("input:focus")){
    document.querySelector("input:focus").value += "\026";
  }
});

shortcut.add("Ctrl+I", function(){
  if(document.querySelector("input:focus")){
    document.querySelector("input:focus").value += "\035";
  }
});

shortcut.add("Ctrl+U", function(){
  if(document.querySelector("input:focus")){
    document.querySelector("input:focus").value += "\037";
  }
});

shortcut.add("Ctrl+L", function(){
  if(document.querySelector("input:focus")){
    document.querySelector("input:focus").value += "\u202E";
  }
});

shortcut.add("Ctrl+G", function(){
  if(document.querySelector("input:focus")){
    document.querySelector("input:focus").value += "\00303>";
  }
});